private void btn_Save(object sender, RoutedEventArgs e) { if (dg_AllExpenceHeads.SelectedItem != null || dg_AllExpenceSubHeads.SelectedItem != null || dg_AllExpenceSubHeads.SelectedItem != null || tb_Cost.Text != null) { try { tbl_ExpenceHead eh = (tbl_ExpenceHead)dg_AllExpenceHeads.SelectedItem; tbl_ExpenceSubHead esh = (tbl_ExpenceSubHead)dg_AllExpenceSubHeads.SelectedItem; string name = tb_Name.Text; int cost = Convert.ToInt32(tb_Cost.Text); tbl_Expence expence = new tbl_Expence(); expence.Comment = name; expence.Amount = cost; expence.ExpenseHead_Id = eh.Id; expence.ExpenceSubHead_Id = esh.Id; DateTime date = DateTime.Now; expence.DatenTime = date; Expence.insert(expence); AutoClosingMessageBox.Show("Expence Added", "Success", 3000); Close(); } catch { AutoClosingMessageBox.Show("Some Error Occures", "Failed", 3000); } } else { AutoClosingMessageBox.Show("Please Insert Data Properly", "Alert", 3000); } }
void initFormOperations() { foreach (tbl_FinanceChart item in FinanceChart.getAll()) { dg_FinanceChart.Items.Add(item); } lbl_TotalSale.Content = Sale.getAllTotalAmmount(); lbl_TotalDeposit.Content = FinanceChart.getTotalDeposit(); lbl_TotalExpence.Content = Expence.getAllTotalAmmount(); }
private void BtnAdd_Click(object sender, EventArgs e) { if (btnAdd.Text == "Add New") { //Get category list var cat = _UnitOfWork.ExpenceCat.FirstOrDefault(c => c.Name == dwnCategories.selectedValue.ToString()); //Add category if (cat != null) { Expence expence = new Expence { Payment = Convert.ToInt64(txtPaymnt.Text), CreatedDate = DateTime.Now, Description = txtDescrip.Text, ExpenceCatId = cat.Id, UserId = UserId }; _UnitOfWork.Expence.InsertOrUpdate(expence); _UnitOfWork.Complete(); MessageBox.Show("You've Successfully Added new Expence Category", "Success"); this.Hide(); } } else { var expence = _UnitOfWork.Expence.Find(expId); if (dwnCategories.selectedIndex != -1) { if (expence != null) { // var cat = _UnitOfWork.ExpenceCat.FirstOrDefault(c => c.Name == dwnCategories.selectedValue.ToString()); expence.UserId = UserId; expence.CreatedDate = DateTime.Now; expence.Description = txtDescrip.Text; expence.Payment = Convert.ToInt64(txtPaymnt.Text); expence.ExpenceCat.Name = dwnCategories.selectedValue.ToString(); _UnitOfWork.Expence.InsertOrUpdate(expence); _UnitOfWork.Complete(); MessageBox.Show("You've Successfully Updated new Expence Category", "Success"); _UnitOfWork.Dispose(); this.Hide(); } } else { MessageBox.Show("Select a Category For The Expence", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public static Expence BLL_to_Expence(Profit_ExpanceBLL profit_ExpenceBLL) { Expence expence = new Expence { Date_ = profit_ExpenceBLL.Date_, Sum = profit_ExpenceBLL.Sum, Description = profit_ExpenceBLL.Description, User = new User(), Expence_Type = new Expence_Type() { Name = profit_ExpenceBLL.Profit_Expance_Type } }; return(expence); }
void initFormOperations() { try { tb_OpeningBalance.Text = Convert.ToString(FinanceChart.getLastDayClosingBalance()); dp_Date.Content = DateTime.Now.ToShortDateString(); tb_Sale.Text = Convert.ToString(Sale.getAllTodayOnRestaurentAmmount()); tb_Delivery.Text = Convert.ToString(Sale.getAllTodayOnDeliveryAmmount()); tb_TotalSale.Text = Convert.ToString(Sale.getAllTodayOnRestaurentAmmount() + Sale.getAllTodayOnDeliveryAmmount()); tb_TotalCash.Text = Convert.ToString(FinanceChart.getLastDayClosingBalance() + Sale.getAllTodayOnRestaurentAmmount() + Sale.getAllTodayOnDeliveryAmmount()); tb_Expence.Text = Convert.ToString(Expence.getTodayTotalAmmount()); tb_Deposit.Text = Convert.ToString(Deposit.getAllTodayAmmount()); int deposit = Convert.ToInt32(tb_Deposit.Text); int ClosingBalance = FinanceChart.getLastDayClosingBalance() + Sale.getAllTodayOnRestaurentAmmount() + Sale.getAllTodayOnDeliveryAmmount() - Expence.getTodayTotalAmmount() - deposit; tb_ClosingBalance.Text = Convert.ToString(ClosingBalance); } catch {} }
private void btn_Search(object sender, RoutedEventArgs e) { if (dp_StartDate.SelectedDate != null && dp_EndDate.SelectedDate != null) { DateTime startDate = TimeUtils.getStartDate(dp_StartDate.SelectedDate); DateTime endDate = TimeUtils.getEndDate(dp_EndDate.SelectedDate); dg_AllExpences.ItemsSource = null; dg_AllExpences.ItemsSource = Expence.getAllCustomDate(startDate, endDate); int total = 0; foreach (tbl_Expence item in Expence.getAllCustomDate(startDate, endDate)) { total += (int)item.Amount; } lbl_total.Content = total; } }
private void btn_FindExpencesBySubHead(object sender, RoutedEventArgs e) { if (cb_SubHead.SelectedValue != null && dp_StartDate.SelectedDate != null && dp_EndDate.SelectedDate != null) { int subHeadId = (int)cb_SubHead.SelectedValue; DateTime startDate = TimeUtils.getStartDate(dp_StartDate.SelectedDate); DateTime endDate = TimeUtils.getEndDate(dp_EndDate.SelectedDate); dg_AllExpences.ItemsSource = null; dg_AllExpences.ItemsSource = Expence.getAllBySubHeadIdAndDateTime(subHeadId, startDate, endDate); int total = 0; foreach (tbl_Expence item in Expence.getAllBySubHeadIdAndDateTime(subHeadId, startDate, endDate)) { total += (int)item.Amount; } lbl_total.Content = total; } }
private bool Insert() { try { Expence roo = new Expence(); roo.ExpencesTypeId = ExpencesTypeId; roo.ExpencesDate = ExpencesDate; roo.ExpencesValue = ExpencesValue; roo.Notes = Notes; MainClass.DbObj.Expences.InsertOnSubmit(roo); MainClass.DbObj.SubmitChanges(); ExpencesId = roo.ExpencesId; return(true); } catch { return(false); } }
public static void FillSQLite() { using (TaxesEntities taxes = new TaxesEntities()) { var mongo = new MongoDBProvider(); var allExpences = mongo.ListAllExpenses(); var allReporst = mongo.ListAllReports(); foreach (var report in allReporst) { Report reportToInsert = new Report(); reportToInsert.TotalIncome = report.TotalIncomes; reportToInsert.TotalQuantitySold = report.TotalQuantitySold; reportToInsert.VendorName = report.VendorName; reportToInsert.ProductName = report.ProductName; taxes.Reports.Add(reportToInsert); } taxes.SaveChanges(); foreach (var expence in allExpences) { Expence expenceToInsert = new Expence(); expenceToInsert.CurrentExpence = expence.CurrentExpense; expenceToInsert.CurrentMoth = expence.CurrentMonth; expenceToInsert.VendorName = expence.VendorName; taxes.Expences.Add(expenceToInsert); } taxes.SaveChanges(); } }
void initFormOperations() { dg_AllExpences.ItemsSource = Expence.getAll(); int total = 0; foreach (tbl_Expence item in Expence.getAll()) { total += (int)item.Amount; } lbl_total.Content = total; foreach (tbl_ExpenceHead head in ExpenceHead.getAll()) { cb_Head.ItemsSource = ExpenceHead.getAll(); cb_Head.SelectedValuePath = "Id"; cb_Head.DisplayMemberPath = "Name"; } foreach (tbl_ExpenceSubHead subHead in ExpenceSubHead.getAll()) { cb_SubHead.ItemsSource = ExpenceSubHead.getAll(); cb_SubHead.SelectedValuePath = "Id"; cb_SubHead.DisplayMemberPath = "Name"; } }