private static bool ValidateForDailyLimits(double amount, Abstract.model.Currency currency) { const int maxDayLimit = 1000; var dailyAmountExchanged = ((Abstract.model.Report[])GetReportsBO.GetInstance().DoRead()) .Where(report => currency.CurrencyId.Equals(report.CurrencyId) && DateTime.Now.ToShortDateString().Equals(report.Date.ToShortDateString())) .Sum(report => report.IncomAmount); dailyAmountExchanged += amount; return(dailyAmountExchanged <= maxDayLimit); }
public ReportList() { InitializeComponent(); foreach (var report in (Abstract.model.Report[])GetReportsBO.GetInstance().DoRead()) { var user = GetEmployeeBO.GetUserById(report.UserId); var currency = GetCurrencyBO.GetCurrencyById(report.CurrencyId); var person = GetCustomerBO.GetPersonById(report.PersonId); Reports.Children.Add(new TextBlock { Text = " - " + person.FirstName + " " + person.LastName + ", " + person.BirthDate.Value.ToShortDateString() + " birth, passport id: " + person.PassportId + " has exchanged " + report.IncomAmount + " " + currency.CurrencyName + " to " + report.OutcomeAmount + " units. \nResponsible for the operation is " + user.FirstName + " " + user.LastName + ". Date: " + report.Date.ToShortDateString() + ".\n\n" }); } }