private void monthsCombobox_SelectedIndexChanged(object sender, EventArgs e) { /// <summary> /// Handler for monthsCombobox index update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> List <Apartment> apartments = new List <Apartment>(this.service.getApartments()); int month = monthsCombobox.SelectedIndex; monthlyPaymentsGridView.Rows.Clear(); foreach (Apartment apartment in apartments) { if (apartment.owner != "fara") { MonthlyPayment monthlyPayment = this.service.getMonthlyPayment(apartment); //Preluare dictionar cu categorie taxa (key) si valoare plata (value) Dictionary <String, int> paymentDict = new Dictionary <String, int>(monthlyPayment.getMonthlyPayment(month)); //Introducere date in tabel monthlyPaymentsGridView.Rows.Add( apartment.noApartment, apartment.owner, paymentDict["Gas"], paymentDict["Maintenance & water"], paymentDict["Electricity"], paymentDict["Internet"], paymentDict["Total"]); } } }
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(); } }
public void AddMonthlyPayment(MonthlyPayment mp) { using (var context = new ShulDataContext(_conStr)) { context.MonthlyPayments.InsertOnSubmit(mp); context.SubmitChanges(); } }
private void setObjectFromFieldValues(MonthlyPayment pay, int monthNumber) { int month = 1 + (monthCombo.SelectedIndex + monthNumber) % 12; int year = Int32.Parse(yearText.Text) + ((monthCombo.SelectedIndex + monthNumber) / 12); pay.MemberID = memberID; pay.Month = new DateTime(year, month, adhiPohoyaTick.Checked == true ? 2 : 1); pay.Amount = monthlyAmount; pay.paidDate = paidDate.Value; pay.ExtraAmount = (int)extraAmountNum.Value; pay.paymentMethod = paymentTypeCombo.SelectedIndex; pay.paymentReference = receptNum.Text; }
private void findMember(MemberInfo memInfo) { setMemberFields(memInfo); using (MonthlyPayment pay = new MonthlyPayment(true)) { pay.MemberID = memInfo.ID; SetHistryGrid(pay.GetPaymentHistry()); } amountText.Focus(); amountText.Select(0, 5); }
public void TestMonthlyPayments_WhereReturnValueIsAlwaysAValue( decimal totalInterest, int loan, int years) { var classobj = new MonthlyPayment { LoanAmount = loan, NumberOfYears = years, TotalInterest = totalInterest }; var result = this._calculator.PerformCalculation(classobj); Assert.NotNull(result); }
public CalculatedResult Calculation(int loanAmount, IEnumerable <FileData> investments) { //Total Payments this.TotalPayments = CalculateTotalPayment(investments, loanAmount); if (this.TotalPayments > 0) { //Interest //Formula: I = P . R . T var rate = new Rates { LoanAmount = loanAmount, NumberOfYears = NumberOfYears, TotalInterest = this.TotalPayments }; this.Annualpercentagerate = this._calculator.PerformCalculation(rate); //Finanace Charges //Formula: FC = P x R x T var financecharges = new FinanceCharge { Rate = this.Annualpercentagerate, LoanAmount = loanAmount, NumberOfYears = NumberOfYears }; this.FinanceCharge = this._calculator.PerformCalculation(financecharges); ////Monthly Payments ////Formula: (P + FC) / T var monthlypayments = new MonthlyPayment { LoanAmount = loanAmount, NumberOfYears = NumberOfYears, TotalInterest = this.TotalPayments }; this.MonthlyPayments = this._calculator.PerformCalculation(monthlypayments); return(new CalculatedResult { RequestedAmount = loanAmount, Rate = this.Annualpercentagerate, MonthlyRepayments = this.MonthlyPayments, TotalRepayments = this.TotalPayments }); } return(default);
public MonthlyBill(List <CallDetail> processedCalls, MonthlyPayment monthlyPayment) { ProcessedCalls = processedCalls; MonthlyPayment = monthlyPayment; }
public CreditCardPayoffPage EnterMonthlyPayment(double monthlyPayment) { MonthlyPayment.SendKeys(monthlyPayment.ToString()); return(this); }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { if (paymentID == 0 && monthlyAmount > 0) { int numberofMonths = (int)amountText.Value / monthlyAmount; for (int i = 0; i < numberofMonths; i++) { using (MonthlyPayment pay = new MonthlyPayment(true)) { setObjectFromFieldValues(pay, i); if (pay.MemberID > 0 && pay.Add() == 1) { // MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); statusText.Visible = true; timer1.Enabled = true; extraAmountNum.Value = 0; } } } clear(1); } else if (memberID > 0) { using (MonthlyPayment pay = new MonthlyPayment(true)) { pay.ID = paymentID; setObjectFromFieldValues(pay, 0); if (MessageView.ShowQuestionMsg("Update record") == DialogResult.OK) { if (pay.Update() == 1) { SetHistryGrid(pay.GetPaymentHistry()); extraAmountNum.Value = 0; } } } } } } // catch() catch (Exception ex) { if (ex.Message.StartsWith("Duplicate entry")) { MessageView.ShowErrorMsg("Already Added"); } else { MessageView.ShowErrorMsg(ex.Message); } } }
public override string ToString() { return($"{Term} months (effective {AnnualPercentageRate}, nominal {NominalRate}): monthly {MonthlyPayment.ToString()}, total {TotalCost.ToString()}, interest {TotalInterest.ToString()}"); }
public static void Main(string[] args) { Console.WriteLine(" 1. Replace String \n 2. FlipCoin \n 3. LeapYear \n 4. PowerOf2 \n 5. HarmonicNo." + " \n 6. PrimeFactor \n 7. WindChill Temperature \n 8. Euclidean distance \n 9. QuadraticEquation " + "\n 10. FindTriplets \n 11. Gambler \n 12. 2DArray \n 13. CouponNumber \n 14. StopWatch \n 15. TicTaeToe" + "\n 16. Vending Machine \n 17. Day of week \n 18. TemperatureConversion \n 19. MonthlyPayment \n 20. SquareRoot" + "\n 21. BinaryConversion \n 22. SwapNibbles \n 23. ResultantNo is Power of two \n 24. BinarySearch \n 25. BubbleSort" + "\n 26. Insertion Sort \n 27. Merge Sort \n 28. Anagram \n 29. Prime btw 1-1000 \n 30. Permutation Recursive \n 31. Permutation Iterartion "); int option = Utility.readInt(); switch (option) { case 1: ReplaceString.Replace(); break; case 2: FlipCoin.flipCoin(); break; case 3: LeapYear.LeapYears(); break; case 4: PowerOf2.PrintTable(); break; case 5: Harmonic.HarmonicNo(); break; case 6: PrimeFactor.Primefactor(); break; case 7: WindChill.Chill(); break; case 8: Distance.EuclideanDistance(); break; case 9: QuadraticEquation.Quadratic(); break; case 10: Sumof3No.SumZero(); break; case 11: Gambler.Gambling(); break; case 12: Array2D.IntegerArray(); break; case 13: CouponNumber.couponNumber(); break; case 14: StopWatch.Watch(); break; case 15: TicTacToe.TictaeToeGame(); break; case 16: VendingMachine.Atm(); break; case 17: DayOfWeek.checkday(); break; case 18: TemperatureConversion.Conversion(); break; case 19: MonthlyPayment.PaymentMonthly(); break; case 20: Sqrt.Root(); break; case 21: Binary.DecToBinary(); break; case 22: BinarySwaapNibble.SwapNibble(); break; case 23: ResultantPower2.Resultant(); break; case 24: BinarySearch.Search(); break; case 25: BubbleSort.Bubblesort(); break; case 26: Insertion.InsertionSorting(); break; case 27: MergeSort.Mergesorting(); break; case 28: Anagram.AnagramString(); break; case 29: PrimeNoRange.Range(); break; case 30: Permutation.Recursion(); break; case 31: permutationIterative.Iterative(); break; case 32: PlaindromePrimeNo.AnagramPrime(); //PlaindromePrimeNo.Palindrome(); break; } }
public ActionResult Index(int amount, string name, string street, string zipcode, string exp, string xCardNum, string xCVV, int memberId, int expenseId, int?count, string account, string routing, bool credit) { if (amount == 0 || string.IsNullOrEmpty(name) || memberId == 0 || expenseId == 0 || amount > 1000000 || name.Length > 100) { return(RedirectToAction("Index", "Home")); } if (credit) { if (string.IsNullOrEmpty(street) || string.IsNullOrEmpty(zipcode) || string.IsNullOrEmpty(exp) || string.IsNullOrEmpty(xCardNum) || string.IsNullOrEmpty(xCVV) || street.Length > 250 || zipcode.Length > 9 || exp.Length > 4) { return(RedirectToAction("Index", "Home")); } } else { if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(routing)) { return(RedirectToAction("Index", "Home")); } } string command = credit ? "cc:Sale" : "check:Sale"; System.Collections.Specialized.NameValueCollection MyPost = new System.Collections.Specialized.NameValueCollection(); MyPost.Add("xKey", "YehoshuaLevinDev_Test_12301258f0bf44f2a6fcf0e"); MyPost.Add("xVersion", "4.5.5"); MyPost.Add("xSoftwareName", "ylevin"); MyPost.Add("xSoftwareVersion", " 1.4.2"); MyPost.Add("xCommand", command); MyPost.Add("xName", name); MyPost.Add("xAmount", amount.ToString()); if (credit) { MyPost.Add("xStreet", street); MyPost.Add("xZip", zipcode); MyPost.Add("xExp", exp); MyPost.Add("xCardNum", xCardNum); MyPost.Add("xCVV", xCVV); } else { MyPost.Add("xAccount", account); MyPost.Add("xRouting", routing); } System.Net.WebClient MyClient = new System.Net.WebClient(); string MyResponse = System.Text.Encoding.ASCII.GetString(MyClient.UploadValues("https://x1.cardknox.com/gateway", MyPost)); // Response System.Collections.Specialized.NameValueCollection MyResponseData = HttpUtility.ParseQueryString(MyResponse); string MyStatus = ""; if (MyResponseData.AllKeys.Contains("xStatus")) { MyStatus = MyResponseData["xStatus"]; } string MyError = ""; if (MyResponseData.AllKeys.Contains("xError")) { MyError = MyResponseData["xError"]; } string MyRefNum = ""; if (MyResponseData.AllKeys.Contains("xRefNum")) { MyRefNum = MyResponseData["xRefNum"]; } string MyToken = ""; if (MyResponseData.AllKeys.Contains("xToken")) { MyToken = MyResponseData["xToken"]; } Response response = new Response { Status = MyStatus, RefNum = MyRefNum, Error = MyError, }; FinancialRepository fr = new FinancialRepository(Settings.Default.ConStr); if (MyStatus == "Approved") { Payment p = new Payment { MemberId = memberId, ExpenseId = expenseId, Amount = amount, Date = DateTime.Today }; fr.AddPayment(p); } Member member = fr.GetMember(memberId); SendEmail(member, response, expenseId, amount); count--; if (MyStatus == "Approved" && count != null && credit) { MonthlyPayment mp = new MonthlyPayment { Amount = amount, Token = MyToken, Name = name, MemberId = memberId, ExpenseId = expenseId, Count = count.Value, Street = street, Zipcode = zipcode, Exp = exp, Credit = true }; fr.AddMonthlyPayment(mp); } else if (MyStatus == "Approved" && count != null && !credit) { MonthlyPayment mp = new MonthlyPayment { Amount = amount, Token = MyToken, Name = name, MemberId = memberId, ExpenseId = expenseId, Count = count.Value, Credit = false }; fr.AddMonthlyPayment(mp); } return(View(response)); }
public static MonthlyPaymentsInYearsResult ToYears(IQueryable <MonthlyPayment> payments, IQueryable <EnterChild> enters, Tarif tarif) { var paymentList = payments.OrderBy(p => p.PaymentDate).ToList(); var enterList = enters.OrderBy(e => e.EnterDate).ToList(); var yearsResult = new List <MonthlyPaymentsInYear>(); int paymentIndex = 0; int lastYear = -1; MonthlyPayment lastPaymentForLastMonth = paymentIndex < paymentList.Count ? paymentList[paymentIndex] : null; // for enters foreach (var enter in enterList) { var startDate = enter.EnterDate; var endDate = enter.ExpulsionDate ?? DateTime.Now; for (int year = startDate.Year; year <= endDate.Year; year++) { // concats enters for one year MonthlyPaymentsInYear yearPayment; if (lastYear != year) { yearPayment = new MonthlyPaymentsInYear { Year = year }; yearsResult.Add(yearPayment); lastYear = year; } else { yearPayment = yearsResult[yearsResult.Count - 1]; } var startMonth = startDate.Year == year ? startDate.Month : 1; var endMonth = endDate.Year == year ? endDate.Month : 12; for (int month = startMonth; month <= endMonth; month++) { var monthPayment = new Month { Index = month - 1, Payments = new List <MonthlyPayment>() }; // to show archived months. payments = null var months = yearPayment.Months; if (months.Count > 0 && months[months.Count - 1].Index != monthPayment.Index) { for (int i = months[months.Count - 1].Index + 1; i < monthPayment.Index; i++) { var monthlyPayment = paymentList.Count > paymentIndex && paymentList[paymentIndex].PaymentDate.Month == i + 1 ? new List <MonthlyPayment> { paymentList[paymentIndex++] } : null; months.Add(new Month { Index = i, Payments = monthlyPayment, Archived = true }); } } // days while (paymentIndex < paymentList.Count) { var payment = paymentList[paymentIndex]; var paymentDate = payment.PaymentDate; if (paymentDate.Year != year || paymentDate.Month != month) { break; } monthPayment.Payments.Add(payment); ++paymentIndex; } if (monthPayment.Payments.Count == 0) { monthPayment.NotPaid = true; var monthlyPayment = new MonthlyPayment { PaymentDate = new DateTime(year, month, 1) }; if (lastPaymentForLastMonth == null) { monthlyPayment.MoneyPaymentByTarif = tarif.MonthlyPayment; monthlyPayment.DebtAfterPaying = tarif.MonthlyPayment; } else { var lastp = lastPaymentForLastMonth; if (monthlyPayment.PaymentDate.Month == lastp.PaymentDate.Month) { continue; } monthlyPayment.DebtAfterPaying = lastp.PaymentDate < monthlyPayment.PaymentDate ? lastp.MoneyPaymentByTarif + lastp.DebtAfterPaying : lastp.MoneyPaymentByTarif; monthlyPayment.MoneyPaymentByTarif = lastp.MoneyPaymentByTarif; } monthPayment.Payments.Add(monthlyPayment); lastPaymentForLastMonth = monthlyPayment; } else { lastPaymentForLastMonth = monthPayment.Payments[monthPayment.Payments.Count - 1]; if (lastPaymentForLastMonth.Description == null) // PaidMoney == 0 { monthPayment.NotPaid = true; } } months.Add(monthPayment); } } } Reverse(yearsResult); var lastPayment = yearsResult[0].Months[0].Payments[0]; return(new MonthlyPaymentsInYearsResult(new ObservableCollection <MonthlyPaymentsInYear>(yearsResult), lastPayment)); }
public MonthlyPaymentsInYearsResult(ObservableCollection <MonthlyPaymentsInYear> monthlyPaymentsInYears, MonthlyPayment lastPayment) { MonthlyPaymentsInYears = monthlyPaymentsInYears; LastPayment = lastPayment; }