How to run a method on a particular day and also only once in .net
<p>I am creating a Bank Management system application in C#.net windows application.
As in all banks,acount holders(saving bank account) are paid interest(eg.3.5% of current balance) at the end of the month.
I am prepared the code for it.</p>

<pre><code>    public void frmbankmg_Load(object sender, EventArgs e)

    {
        try
        {
            Transact();

        DateTime date = DateTime.Now.Date;
        //DateTime date = DateTime.Parse("Nov 1,2010");
        int day = date.Day;
        double Account = 0, Balance = 0;
        string status = "";
        if (day == 1)
        {
            SqlConnection conn = ConnectionString();
            string s = "select Account_No,Balance_Amount,Status from SavingAcct";
            SqlCommand cmd = new SqlCommand(s, conn);
            conn.Open();
            SqlDataReader rd = cmd.ExecuteReader();
            while (rd.Read())
            {
                Account = Convert.ToDouble(rd["Account_No"].ToString());
                Balance = Convert.ToDouble(rd["Balance_Amount"].ToString());
                status = rd["Status"].ToString();
                if (status == "Open")
                {
                    Interest(Account, Balance);
                }
            }
            conn.Close();
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}        

private void Transact()
{
    try
    {
        DateTime date = DateTime.Now.Date;
        int month = date.Month;
        int year = date.Year;
        int days = DateTime.DaysInMonth(year, month);
        if (days == date.Day)
        {
            double Account = 0, Balance = 0;
            string status = "";

            SqlConnection conn = ConnectionString();
            string s = "select Account_No,Balance_Amount,Status from SavingAcct";
            SqlCommand cmd = new SqlCommand(s, conn);
            conn.Open();
            SqlDataReader rd = cmd.ExecuteReader();
            while (rd.Read())
            {
                Account = Convert.ToDouble(rd["Account_No"].ToString());
                Balance = Convert.ToDouble(rd["Balance_Amount"].ToString());
                status = rd["Status"].ToString();
                if (status == "Open")
                {
                    string Transaction = "No";
                    string s1 = "insert into Transactions(Account_No,Date,Current_Balance,Month,Year,Transact) values('" + Account + "','" + date + "','" + Balance + "','" + month + "','" + year + "','" + Transaction + "'";
                    SqlCommand cmd1 = new SqlCommand(s1, conn);
                    conn.Open();
                    cmd1.ExecuteNonQuery();
                    conn.Close();
                }
            }
            conn.Close();
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private void Interest(double Acctno,double balance)
{
    try
    {
        DateTime date = DateTime.Now.Date;
        //DateTime date = DateTime.Parse("Nov 1,2010");
        int month = date.Month;
        int year = date.Year;
        month = month - 1;
        SqlConnection conn = ConnectionString();
        string s = "select Date,Current_Balance from Transactions where Account_No='" + Acctno + "' and Month='" + month + "'";
        SqlDataAdapter da = new SqlDataAdapter(s, conn);
        DataSet ds = new DataSet();
        da.Fill(ds, "Transactions");
        int totalRows = ds.Tables["Transactions"].Rows.Count;
        conn.Open();
        DateTime date1 = DateTime.Now, date2, date3;
        int row, row1 = -1, row2 = -1, day1, day2;
        for (row = 0; row &lt; totalRows; row++)
        {
            date1 = (DateTime)ds.Tables["Transactions"].Rows[row][0];
            int d = date1.Day;
            if (d &lt;= 10)
            {
                date2 = date1;
                day1 = d;
                row1 = row;
            }
            else
            {
                date3 = date1;
                day2 = d;
                row2 = row;
            }
        }
        double Bal1 = 0;
        if (row1 == -1)
        {
            Bal1 = NoTransactions_Bet1_and_10(Acctno, month);
        }
        else
        {
            Bal1 = Convert.ToDouble(ds.Tables["Transactions"].Rows[row1][1]);
        }
        double Bal2 = Convert.ToDouble(ds.Tables["Transactions"].Rows[row2][1]);
        double credit = 0;
        if (Bal1 &lt;= Bal2)
        {
            credit = (3.5) / 100 * Bal1;
            balance = balance + (credit);
        }
        else
        {
            credit = (3.5) / 100 * Bal2;
            balance = balance + (credit);
        }
        string str = "update SavingAcct set Balance_Amount='" + balance + "' where Account_No='" + Acctno + "'";
        SqlCommand cmd = new SqlCommand(str, conn);
        cmd.ExecuteNonQuery();


        string comment = "By Interest";
        string transact = "Yes";
        string str1 = "insert into Transactions(Account_No,Date,Particulars,Credit,Current_Balance,Month,Year,Transact) values('" + Acctno + "','" + DateTime.Now.Date + "','" + comment + "','" + credit + "','" + balance + "','" + month + "','" + year + "','" + transact + "')";
        SqlCommand cmd1 = new SqlCommand(str1, conn);
        cmd1.ExecuteNonQuery();
        conn.Close();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private double NoTransactions_Bet1_and_10(double Acct_no,int month)
{
    try
    {
        month = month - 1;
        string s = "select * from Transactions where Account_No='" + Acct_no + "' and Month='" + month + "'";
        SqlConnection con = ConnectionString();

        SqlDataAdapter da = new SqlDataAdapter(s, con);
        DataSet ds = new DataSet();
        da.Fill(ds, "Transactions");

        con.Open();
        int Tot_row = ds.Tables["Transactions"].Rows.Count;
        double Balance = Convert.ToDouble(ds.Tables["Transactions"].Rows[Tot_row - 1][6]);
        con.Close();

        return Balance;
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}
</code></pre>

<p>As i am executing the interest() method in form load event, this method will run on the first day of the month when the application is started.
But it will also run on the same day every time I close and restart my application.
so ,interest will be paid each time the applicaion starts on the 1st day of the month.
As there is no specific time of starting the application,so i can't use the time logic.
Can you help me to solve this problem?</p>
