Esempio n. 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         int incomingPrice = Convert.ToInt32(textBox2.Text);
         var data          = (from currentPrice in expenseTracker.ExpenseIncomings
                              select currentPrice.Price).ToList();
         if (data.Count == 0)
         {
             expenseTracker.ExpenseIncomings.InsertOnSubmit(new ExpenseIncoming()
             {
                 Price = incomingPrice
             });
             expenseTracker.SubmitChanges();
             LoadGridView();
         }
         else
         {
             var updateData = (from currentPrice in expenseTracker.ExpenseIncomings
                               select currentPrice.Price).FirstOrDefault();
             ExpenseIncoming incoming = expenseTracker.ExpenseIncomings.Single(a => a.Price == updateData);
             incoming.Price = updateData + incomingPrice;
             expenseTracker.SubmitChanges();
             LoadGridView();
         }
         textBox2.Text = "";
         MessageBox.Show("Incoming Price Added");
     }
     catch (Exception ex)
     {
         MessageBox.Show("There are no records");
     }
 }
Esempio n. 2
0
        private void UpdateTotalIncome(int finalAmount)
        {
            try
            {
                var updateData = (from currentPrice in expenseTracker.ExpenseIncomings
                                  select currentPrice.Price).FirstOrDefault();
                ExpenseIncoming incoming = expenseTracker.ExpenseIncomings.Single(a => a.Price == updateData);
                incoming.Price = finalAmount;

                expenseTracker.SubmitChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
 partial void UpdateExpenseIncoming(ExpenseIncoming instance);
Esempio n. 4
0
 partial void DeleteExpenseIncoming(ExpenseIncoming instance);
Esempio n. 5
0
 partial void InsertExpenseIncoming(ExpenseIncoming instance);