private void Refresh() { AccountingBalance Re = Account.ReportMainForm(); lblIncome.Text = Re.recive.ToString("#,0"); lblOutcome.Text = Re.Pay.ToString("#,0"); lblBalance.Text = Re.Balance.ToString("#,0"); }
public static AccountingBalance ReportMainForm() { AccountingBalance dn = new AccountingBalance(); using (UnitOfWork un = new UnitOfWork()) { PersianCalendar pc = new PersianCalendar(); DateTime Value = DateTime.Now; DateTime Start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); DateTime End = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 20); var test = un.AccountingRepository.Get().Select(a => a.DateTitle); var Income = un.AccountingRepository.Get(a => a.TypeID == 1 && a.DateTitle >= Start && a.DateTitle <= End).Select(a => a.Amount).ToList(); var Outcome = un.AccountingRepository.Get(a => a.TypeID == 2 && a.DateTitle >= Start && a.DateTitle <= End).Select(a => a.Amount).ToList(); dn.recive = Income.Sum(); dn.Pay = Outcome.Sum(); dn.Balance = dn.recive - dn.Pay; } return(dn); }