private static List <TotalBalance> CalculateTotalBalance(List <Reports> reportList, List <Region> regionList, List <Product> prolist, int summaCompany) { int regionId = 0; int productId = 0; decimal total = 0; List <TotalBalance> totalList = new List <TotalBalance>(); TotalBalance totalB; foreach (var item in regionList) { regionId = item.RegionId; foreach (var it in prolist) { productId = it.ProductId; foreach (var samoList in reportList) { if (regionId == samoList.RegionID && productId == samoList.OilID) { total += samoList.Value; // reportList.Remove(samoList); } else { } } totalB = new TotalBalance(); totalB.RegionName = item.RegionName; totalB.ProductName = it.ProductName; totalB.TotalSumma = total; totalList.Add(totalB); } } return(totalList); }
public override int GetHashCode() { return (AvailableToTrade.GetHashCode() ^ BalanceCurrency.GetHashCode() ^ SourceExchange.GetHashCode() ^ TotalBalance.GetHashCode()); }
private void SetTuitionFee() { string query; query = "SELECT GradeLevelID FROM GradeLevel WHERE Description = '" + cmbGradeLevel.Text + "'"; lblGradeLevelID.Text = GetOneData(query); query = "SELECT TuitionFee FROM GradeLevel WHERE GradeLevelID = '" + lblGradeLevelID.Text + "'"; TuitionFee = double.Parse(GetOneData(query)); this.TotalBalance = this.TuitionFee + this.EntranceFee; lblTotalBalance.Text = TotalBalance.ToString(); }
public void GivenPlannedAndActualBudgets_WhenTotalBalanceIsCalled_ThenTotalBalanceIsCalculated() { var plannedBudget = new Budget(Month.Create(2018, MonthName.May), Currency.PLN) .WithRevenue(new Money(Amount.Create(100, Currency.PLN), Category.Salary)) .WithRevenue(new Money(Amount.Create(100, Currency.PLN), Category.Salary)) .WithExpense(new Money(Amount.Create(-10, Currency.PLN), Category.BasicExpenditure)) .WithExpense(new Money(Amount.Create(-60, Currency.PLN), Category.CarAndTransport)); var actualBudget = new Budget(Month.Create(2018, MonthName.May), Currency.PLN) .WithRevenue(new Money(Amount.Create(100.90m, Currency.PLN), Category.Salary)) .WithRevenue(new Money(Amount.Create(90, Currency.PLN), Category.Salary)) .WithExpense(new Money(Amount.Create(-8, Currency.PLN), Category.BasicExpenditure)) .WithExpense(new Money(Amount.Create(-50, Currency.PLN), Category.CarAndTransport)); var totalBalance = new TotalBalance(plannedBudget, actualBudget); totalBalance.Amount.Should().Be(Amount.Create(-2.90m, Currency.PLN)); }
public void GivenBudget_WhenTotalBalanceIsCalled_ThenAmountIsCalculated() { var totalBalance = new TotalBalance(_budget); totalBalance.Amount.Should().Be(Amount.Create(2149.45M, _budget.BaseCurrency)); }
private void SetEntranceFee() { EntranceFee = cmbStudentType.Text == "NEW STUDENT" || cmbStudentType.Text == "TRANSFEREE" ? 1000.00 : 0.00; this.TotalBalance = this.TuitionFee + this.EntranceFee; lblTotalBalance.Text = TotalBalance.ToString(); }