public void Match() { var sut = new SplitMatcher(); var input = new[] { 300M, 300M }; var m1 = new MonthlyExpense(200); var m2 = new MonthlyExpense(200); var consumers = new[] { m1, m2 }; MatchResult <decimal, decimal> res = sut.Match2(input, consumers, (x, y) => x + y); // both consumers are complete Assert.AreEqual(2, res.Consumers[ConsumerStatus.Complete].Count); Assert.AreEqual(0, res.Consumers[ConsumerStatus.Active].Count); // The first input of $300 paid both monthly expense 1 and 2 var firstMatchConsumers = res.Matches[0].Consumers; CollectionAssert.AreEqual(consumers, firstMatchConsumers.Select(x => x.Consumer).ToArray()); // The first consumer is "m1" and has consumed $200 Assert.AreEqual(m1, firstMatchConsumers.First().Consumer); Assert.AreEqual(200, firstMatchConsumers.First().Consumption); // The second input only paid monthly expense 2 Assert.AreEqual(m2, res.Matches[1].Consumers.Single().Consumer); }
public StackingLineChartViewModel() { this.MonthlyExpense = new ObservableCollection <Expense>(); MonthlyExpense.Add(new Expense() { Name = "Food", Father = 55, Mother = 40, Son = 45, Daughter = 48 }); MonthlyExpense.Add(new Expense() { Name = "Transport", Father = 33, Mother = 45, Son = 54, Daughter = 28 }); MonthlyExpense.Add(new Expense() { Name = "Medical", Father = 43, Mother = 23, Son = 20, Daughter = 34 }); MonthlyExpense.Add(new Expense() { Name = "Clothes", Father = 32, Mother = 54, Son = 23, Daughter = 84 }); MonthlyExpense.Add(new Expense() { Name = "Books", Father = 56, Mother = 18, Son = 43, Daughter = 55 }); MonthlyExpense.Add(new Expense() { Name = "Others", Father = 23, Mother = 54, Son = 33, Daughter = 56 }); }
private void cmdMakeMonthly_Execute() { if (Payment.Sum <= 0) { FlyErrorMsg = "Введите cумму платежа"; IsFlyErrorOpened = true; return; } if (CreatingNew) { MonthlyExpense NewMonthlyExpense = new MonthlyExpense { Amount = Payment.Sum, Designation = Payment.Designation, Day = Payment.Date.Day, RemindingDay = Payment.Date.AddDays(-5).Day }; var addedExpense = ContextManager.Context.MonthlyExpenses.Add(NewMonthlyExpense); MonthlyPayment NewMonthlyPayment = new MonthlyPayment { Date = DateTime.Now, PaidAmount = Payment.Sum, MonthlyExpense = addedExpense, Account = ContextManager.Context.Accounts.FirstOrDefault() }; ContextManager.Context.MonthlyPayments.Add(NewMonthlyPayment); } SaveContext(); if (CreatingNew) { OnOpenNew(); } }
protected override void OnOpenNew() { Expense = new MonthlyExpense { Day = DateTime.Now.Day, RemindingDay = DateTime.Now.AddDays(-5).Day }; }
public void Match() { var sut = new SplitMatcher(); var m1 = new MonthlyExpense(200); var m2 = new MonthlyExpense(200); var res = sut.Match(new[] { 300M, 300M }, new[] { m1, m2 }, (x, y) => x + y); }
public override string ToString() { //this method must return a string string outputStr = "Street Address: " + Address + "\n" + "Year Built: " + Year + "\n" + "Purchase Price: " + PurchasePrice.ToString("C") + "\n" + "Income From Rent: " + IncomeFromRent.ToString("C") + "\n" + "Monthly Expense: " + MonthlyExpense.ToString("C") + "\n" + "Monthly Earnings: " + MonthlyEarnings.ToString("C"); return(outputStr); }
private static void ExecutionWithoutVisitor(Employee emp) { double NetEarningoftheYear = 0.0; double TaxableAmount = 0.0; foreach (Interfaces.ISalary salary in emp.Salaries) { switch (salary.GetType().Name) { case nameof(MonthlySalary_Earning): MonthlySalary_Earning monthlySalary_Earning = salary as MonthlySalary_Earning; NetEarningoftheYear += (monthlySalary_Earning.BasicSalary + monthlySalary_Earning.ConveyanceAllowance + monthlySalary_Earning.FoodCard_Bill + monthlySalary_Earning.HRAExemption + monthlySalary_Earning.MedicalAllowance + monthlySalary_Earning.OtherBills + monthlySalary_Earning.PersonalAllowance + monthlySalary_Earning.TelephoneBill); TaxableAmount += (monthlySalary_Earning.BasicSalary + monthlySalary_Earning.HRAExemption + monthlySalary_Earning.MedicalAllowance + monthlySalary_Earning.PersonalAllowance); break; case nameof(MonthlySalary_Deduction): MonthlySalary_Deduction monthlySalary_Deduction = salary as MonthlySalary_Deduction; NetEarningoftheYear -= (monthlySalary_Deduction.ProvidentFund_EmployeeContribution + monthlySalary_Deduction.ProvidentFund_EmployerContribution + monthlySalary_Deduction.ProfessionTax + monthlySalary_Deduction.OtherDeduction); TaxableAmount -= (monthlySalary_Deduction.ProvidentFund_EmployeeContribution + monthlySalary_Deduction.ProvidentFund_EmployerContribution + monthlySalary_Deduction.ProfessionTax + monthlySalary_Deduction.OtherDeduction); break; case nameof(MonthlyExpense): MonthlyExpense monthlyExpense = salary as MonthlyExpense; TaxableAmount -= monthlyExpense.MonthlyRent; break; case nameof(AnnualInvestment): AnnualInvestment annualInvestment = salary as AnnualInvestment; TaxableAmount -= annualInvestment.InvestmentAmmount; break; } } Console.WriteLine("Annual Net Earning Amount : {0}", NetEarningoftheYear); Console.WriteLine("Annual Taxable Amount : {0}", TaxableAmount); }
private List <MonthlyExpense> MapMonthlyExpense(Dictionary <int, decimal> result) { List <MonthlyExpense> monthlyExpenses = null; if (result != null) { monthlyExpenses = new List <MonthlyExpense>(); foreach (var key in result.Keys) { MonthlyExpense monthlyExpense = new MonthlyExpense { Month = key, TotalExpense = result[key] }; monthlyExpenses.Add(monthlyExpense); } } return(monthlyExpenses); }
public async Task <ActionResult <MonthlyExpense> > PostMonthlyExpense(MonthlyExpenseInputModel monthlyExpenseInput) { var user = await _context.Users.FindAsync(GetUserId()); var expenseToAdd = new MonthlyExpense { ExpiryDate = monthlyExpenseInput.ExpiryDate, TriggeringDateOfMonth = monthlyExpenseInput.TriggeringDayOfMonth, ExpenseData = new ExpenseData { Amount = monthlyExpenseInput.Amount, Description = monthlyExpenseInput.Description }, User = user }; _context.MonthlyExpenses.Add(expenseToAdd); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMonthlyExpense", new { id = expenseToAdd.Id }, expenseToAdd)); }
public async Task <BudgetBoardDetailDTO> GetBudgetBoardById(int budgetBoardId) { //Get Budget Board Entity Data var budgetBoard = await _midasContext.BudgetBoard.FirstOrDefaultAsync(bb => bb.BudgetBoardId == budgetBoardId); //Query the Transaction table to see what Monthly Expenses are associated with a Budget Board var budgetBoardMonthlyExpenses = await _midasContext.BudgetBoardMonthlyExpense.Where(bbme => bbme.BudgetBoardId == budgetBoardId).ToArrayAsync(); //New list to store monthly expense data for mapping to the DTO var monthlyExpenses = new List <MonthlyExpense>(); foreach (BudgetBoardMonthlyExpense entity in budgetBoardMonthlyExpenses) { //Query the Monthly Expense Table to get table data var expense = _midasContext.MonthlyExpense.FirstOrDefault(me => me.MonthlyExpenseId == entity.MonthlyExpenseId); var newExpense = new MonthlyExpense { MonthlyExpenseId = expense.MonthlyExpenseId, BillName = expense.BillName, BillAmount = expense.BillAmount }; monthlyExpenses.Add(newExpense); } var dto = new BudgetBoardDetailDTO { BudgetBoardId = budgetBoard.BudgetBoardId, BudgetBoardName = budgetBoard.BudgetBoardName, LivingAmount = budgetBoard.LivingAmount, SavingsAmount = budgetBoard.SavingsAmount, LeisureAmount = budgetBoard.LeisureAmount, MonthlyExpenses = monthlyExpenses }; return(dto); }
protected override void OnOpenEdit(object argEntity) { Expense = argEntity as MonthlyExpense; }
public void Visit(MonthlyExpense monthlyExpense) { TaxableAmount -= monthlyExpense.MonthlyRent; }
public static MonthlyExpense CreateMonthlyExpense(int monthlyExpensesID, decimal gasAt, decimal electricityAt) { MonthlyExpense monthlyExpense = new MonthlyExpense(); monthlyExpense.MonthlyExpensesID = monthlyExpensesID; monthlyExpense.GasAt = gasAt; monthlyExpense.ElectricityAt = electricityAt; return monthlyExpense; }
public StackingLineChartViewModel() { this.MonthlyExpense = new ObservableCollection <Expense>(); MonthlyExpense.Add(new Expense() { Name = "Food", Father = 55, Mother = 40, Son = 45, Daughter = 48 }); MonthlyExpense.Add(new Expense() { Name = "Transport", Father = 33, Mother = 45, Son = 54, Daughter = 28 }); MonthlyExpense.Add(new Expense() { Name = "Medical", Father = 43, Mother = 23, Son = 20, Daughter = 34 }); MonthlyExpense.Add(new Expense() { Name = "Clothes", Father = 32, Mother = 54, Son = 23, Daughter = 84 }); MonthlyExpense.Add(new Expense() { Name = "Books", Father = 56, Mother = 18, Son = 43, Daughter = 55 }); MonthlyExpense.Add(new Expense() { Name = "Others", Father = 23, Mother = 54, Son = 33, Daughter = 56 }); ResourceFac = new ResourceFactory(); AdornmentInfo5 = new ChartAdornmentInfo(); AdornmentInfo51 = new ChartAdornmentInfo(); AdornmentInfo52 = new ChartAdornmentInfo(); AdornmentInfo53 = new ChartAdornmentInfo(); AdornmentInfo50 = new ChartAdornmentInfo(); AdornmentInfo510 = new ChartAdornmentInfo(); AdornmentInfo520 = new ChartAdornmentInfo(); AdornmentInfo530 = new ChartAdornmentInfo(); AdornmentInfo5.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo5.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo5.ShowLabel = true; AdornmentInfo5.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo51.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo51.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo51.ShowLabel = true; AdornmentInfo51.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo52.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo52.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo52.ShowLabel = true; AdornmentInfo52.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo53.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo53.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo53.ShowLabel = true; AdornmentInfo53.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo50.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo50.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo50.ShowLabel = true; AdornmentInfo50.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo510.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo510.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo510.ShowLabel = true; AdornmentInfo510.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo520.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo520.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo520.ShowLabel = true; AdornmentInfo520.LabelTemplate = ResourceFac.labelTemplate10; AdornmentInfo530.HorizontalAlignment = HorizontalAlignment.Center; AdornmentInfo530.VerticalAlignment = VerticalAlignment.Center; AdornmentInfo530.ShowLabel = true; AdornmentInfo530.LabelTemplate = ResourceFac.labelTemplate10; }
public void SetUp() { monthlyExpense = new MonthlyExpense {SalaryPaid = 10, BranchName = "foo"}; }
public async Task <WrapperMonthExpenseVM> MonthlyExpense(MonthlyReport vm) { vm.To = vm.To.ToLocalTime(); vm.From = vm.From.ToLocalTime(); WrapperMonthExpenseVM returnData = new WrapperMonthExpenseVM(); //Task<List<Expense>> ExpenseT = _repositoryWrapper // .Expense // .FindAll() // .Where(x => x.FactoryId == vm.FactoryId) // .Where(x => x.Month == vm.Month) // .Include(x => x.Staff) // .Include(x => x.Supplier) // .Include(x => x.Customer) // .ToListAsync(); Task <List <Expense> > ExpenseT = _repositoryWrapper .Expense .FindAll() .Where(x => x.FactoryId == vm.FactoryId) .Where(x => x.OccurranceDate >= vm.From) .Where(x => x.OccurranceDate <= vm.To) .Include(x => x.Staff) .Include(x => x.Supplier) .Include(x => x.Customer) .ToListAsync(); await ExpenseT; //Task<List<Expense>> ExpenseT_1 = _repositoryWrapper // .Expense // .FindAll() // .Where(x => x.FactoryId == vm.FactoryId) // .Where(x => x.Month == vm.Month) // .Include(x => x.Supplier) // .ToListAsync(); //await ExpenseT_1; //Task<List<Expense>> ExpenseT_2 = _repositoryWrapper // .Expense // .FindAll() // .Where(x => x.FactoryId == vm.FactoryId) // .Where(x => x.Month == vm.Month) // .Include(x => x.Staff) // .ToListAsync(); //await ExpenseT_2; // await Task.WhenAll(ExpenseT); List <Expense> lst = ExpenseT.Result.ToList(); // lst = _utilService.ConcatList<Expense>(ExpenseT.Result.ToList(), _utilService.ConcatList<Expense>(ExpenseT_1.Result.ToList(), ExpenseT_2.Result.ToList())); List <MonthlyExpense> monthlyExpense = new List <MonthlyExpense>(); monthlyExpense = _utilService.Mapper.Map <List <Expense>, List <MonthlyExpense> >(lst); returnData.TotalRecords = monthlyExpense .ToList() .Count(); MonthlyExpense lastRow = new MonthlyExpense(); returnData.ListOfData = monthlyExpense; lastRow.Amount = returnData.ListOfData.Sum(x => (x.Amount)); returnData.ListOfData = monthlyExpense .OrderByDescending(x => x.CreatedDateTime) .Skip((vm.PageNumber - 1) * (vm.PageSize)) .Take(vm.PageSize) .ToList(); returnData.Total_TillNow = lastRow.Amount; returnData.Total_Monthly = returnData.ListOfData.Sum(x => (x.Amount)); returnData.ListOfData.Add(lastRow); return(returnData); }
public void Visit(MonthlyExpense monthlyExpense) { //do nothing }
public void AddToMonthlyExpense(MonthlyExpense monthlyExpense) { base.AddObject("MonthlyExpense", monthlyExpense); }