Esempio n. 1
0
 private void btn_add_addData_Click(object sender, EventArgs e)
 {
     try
     {
         string month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dt_add_date.Value.Month);
         string year  = dt_add_date.Value.Year.ToString();
         int    amt   = Int32.Parse(txt_add_amt.Text);
         Form_Methods.AddNewEntry(cmb_add_account.Text, cmb_add_type.Text, amt, dt_add_date.Text, month, year, txt_add_details.Text);
         string message_2 = "Added " + amt + " as " + cmb_add_type.Text + " to " + cmb_add_account.Text;
         MessageBox.Show(message_2);
         Form_Methods.AddLog(rt_log.Text, message_2);
         Form_Methods.ReadLog(rt_log);
         cmb_add_account.Text = "";
         cmb_add_type.Text    = "";
         txt_add_amt.Text     = "";
         dt_add_date.Text     = "";
         txt_add_details.Text = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         Form_Methods.close_connection();
     }
 }
Esempio n. 2
0
        //DBConnection conn;

        public frm_main()
        {
            InitializeComponent();
            dashRefresh();
            try
            {
                Form_Methods.ReadLog(rt_log);
                Form_Methods.GetAccounts(cmb_add_account);
                cmb_add_type.Items.Add("income");
                cmb_add_type.Items.Add("expense");
                Form_Methods.getMonth(cmb_month);
                Form_Methods.GetAccounts(cmb_account);
                Form_Methods.getYear(cmb_year);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Form_Methods.close_connection();
            }
        }