private ActionResult PayCash(TrPaymentMenuViewModel vmodel) { var temp = vmodel.Amount.Replace(".", ","); decimal cash = decimal.Parse(temp); // legal limit for cash if (cash <= 3000) { PaymentBL.CalculCash(vmodel); } else { @ViewBag.limitCash = "Montant cash max de 3000 € dépassé !"; } ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.AmountsPaid = PaymentBL.MakeAmountsList(vmodel.NumTransaction); ViewBag.messageCard = ""; if (ViewBag.tot == "0") { vmodel.Ticket = TicketBL.FillTicket(vmodel.NumTransaction); ViewBag.NumT = vmodel.Ticket.Ticket; vmodel.NumTicket = vmodel.Ticket.Ticket; ViewBag.ticket = true; } else { ViewBag.ticket = false; } return(View(vmodel)); }
private void BtnConfirm_Click(object sender, EventArgs e) { try { lblMsg2.Text = string.Empty; if (Convert.ToDecimal(dgvStudentInfo.Rows[0].Cells["BalanceDue"].Value) <= 0) { lblMsg2.Text = "This student has not any balance due"; //MessageBox.Show("This student has not any balance due"); } else if (txtPayment.Text == string.Empty) { lblMsg2.Text = "Enter a valid amount"; } else if (Convert.ToDecimal(txtPayment.Text) > Convert.ToDecimal(dgvStudentInfo.Rows[0].Cells["BalanceDue"].Value)) { lblMsg2.Text = "The payment cannot be greater than the student's current balancedue"; //MessageBox.Show("The payment cannot be greater than the student's current balancedue"); } else if (txtPayment.Text == string.Empty) { lblMsg2.Text = "Please enter the amount to pay"; //MessageBox.Show("Please enter the amount to pay"); } else { StudentBL studentBL = new StudentBL(); PaymentBL paymentBL = new PaymentBL(); string type = string.Empty; if (rdoCredit.Checked == true) { type = "Credit"; } else { type = "Debit"; } if (studentBL.MakePayment(dgvStudents.CurrentRow.Cells["ID"].Value.ToString(), Convert.ToDecimal(txtPayment.Text)) && paymentBL.AddPayment(Convert.ToInt32(dgvStudents.CurrentRow.Cells["ID"].Value), Convert.ToDecimal(txtPayment.Text), type)) { MessageBox.Show("Payment was successful"); txtSearch.Clear(); txtPayment.Clear(); rdoDebit.Checked = true; dgvStudents.DataSource = null; dgvStudentInfo.DataSource = null; } else { MessageBox.Show("Payment failed"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
public PaymentResponse AuthorizePayment([FromBody] PaymentRequest payment) { var paymentBL = new PaymentBL(); var paymentResponse = paymentBL.AuthorizePayment(payment); return(paymentResponse); }
private void btnConfirmPayment_Click(object sender, EventArgs e) { try { string errMsg = ValidateForm(); if (errMsg != string.Empty) { MessageBox.Show(errMsg, "Invalid Information", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { PaymentBL paymentBL = new PaymentBL(); Payment_Entity p = new Payment_Entity() { StudentId = s.StudentId, AmountOfPayment = Convert.ToDecimal(txtAmountOfPayment.Text), Date = DateTime.Now }; if (paymentBL.MakePayment(p)) { PopulateStudent(s.StudentId); MessageBox.Show("Payment made!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult RprintTicket(TrRprintTicketViewModel vmodel) { try { if (ModelState.IsValid) { TrRprintTicketViewModel vm = new TrRprintTicketViewModel { Tickets = TicketBL.FindTicket(vmodel), MethodsP = PaymentBL.FindMethodsList(), Languages = LanguageBL.FindLanguageListWithoutUniversal() }; ViewBag.ticket = true; return(View(vm)); } vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.ticket = false; return(View(vmodel)); } catch (Exception ex) { //to do insert to log file var e1 = ex.GetBaseException(); // --> log var e4 = ex.Message; // --> log var e5 = ex.Source; // --> log var e8 = ex.GetType(); // --> log var e9 = ex.GetType().Name; // --> log return(View("Error")); } }
public Menu() { AppBl = new ApplicationBL(); UserBl = new UserBL(); PaymentBl = new PaymentBL(); BillBl = new BillBL(); existProgram = false; }
private ActionResult Payment(TrPaymentMenuViewModel vmodel) { if (ModelState.IsValid) { if (Session["Language"] == null) { Session["Language"] = ConfigurationManager.AppSettings["Language"]; } string language = Session["Language"].ToString(); switch (vmodel.MethodP) { //method cash case "1": return(PayCash(vmodel, language)); //method debit card case "2": //simulation if (vmodel.PayCardConfirmed) { return(PayCardDebit(vmodel, language)); } return(PayCardDebitNotConfirmed(vmodel)); //method credit card case "3": ////simulation same process CardDebit if (vmodel.PayCardConfirmed) { return(PayCardDebit(vmodel, language)); } return(PayCardDebitNotConfirmed(vmodel)); //method voucher case "4": //same process PayCash return(PayCash(vmodel, language)); default: ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.messageCard = ""; ViewBag.ticket = false; return(View(vmodel)); } } vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; ViewBag.messageCard = ""; ViewBag.ticket = false; return(View(vmodel)); }
private ActionResult PayCardDebitNotConfirmed(TrPaymentMenuViewModel vmodel) { vmodel.PayCardToConfirm = true; vmodel.MethodsP = PaymentBL.FindMethodsList(); ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.ticket = false; return(View(vmodel)); }
private ActionResult Payment(TrPaymentMenuViewModel vmodel) { if (ModelState.IsValid) { TrPaymentMenuViewModel vm = new TrPaymentMenuViewModel(); switch (vmodel.MethodP) { //method cash case "1": return(PayCash(vmodel)); //method debit card case "2": //simulation if (vmodel.PayCardConfirmed) { return(PayCardDebit(vmodel)); } return(PayCardDebitNotConfirmed(vmodel)); //method credit card case "3": ////simulation same process CardDebit //return (PayCardCredit(vmodel)); if (vmodel.PayCardConfirmed) { return(PayCardDebit(vmodel)); } return(PayCardDebitNotConfirmed(vmodel)); //method voucher case "4": //same process PayCash return(PayCash(vmodel)); default: ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; vmodel.MethodsP = PaymentBL.FindMethodsList(); ViewBag.messageCard = ""; ViewBag.ticket = false; return(View(vmodel)); } } vmodel.MethodsP = PaymentBL.FindMethodsList(); ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; ViewBag.messageCard = ""; ViewBag.ticket = false; return(View(vmodel)); }
public PaymentController(ExpenseTrackerContext context) { try { paymentBL = new PaymentBL(context); paymentBL.AddPayments(); } catch (Exception e) { Console.WriteLine("Exception in getting Context object", e); } }
public IHttpActionResult Post([FromBody] Payment p) { try { PaymentBL.AddPayment(p); return(Ok()); } catch { throw; } }
public HttpResponseMessage AddExpenditure(Expenditure expenditure) { try { ExpenditureBL.Add(expenditure); if (expenditure.type == (int)ExpenditureType.Irregular) { PaymentBL.AddPayment(expenditure); } return(Request.CreateResponse(HttpStatusCode.OK, true)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex)); } }
private ActionResult EndTransac(TrPaymentMenuViewModel vmodel) { if (vmodel.GlobalTotal == "0") { //to do --> print ticket ??? //to do --> add n° ticket & close transaction TransactionBL.AddTicketAndCloseTransac(vmodel.NumTransaction); return(RedirectToAction("Transaction", "Home")); } vmodel.MethodsP = PaymentBL.FindMethodsList(); ViewBag.nopay = "La transaction n'est pas payée!"; ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; ViewBag.ticket = false; return(View(vmodel)); }
private ActionResult EndTransac(TrPaymentMenuViewModel vmodel) { if (vmodel.GlobalTotal == "0") { //to do --> print ticket ??? //add n° ticket & close transaction TransactionBL.CloseTransac(vmodel.NumTransaction, vmodel.DateT.ToString()); return(RedirectToAction("Transaction", "Home")); } vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.nopay = "La transaction n'est pas payée!"; ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; ViewBag.ticket = false; return(View(vmodel)); }
private ActionResult PayCardDebit(TrPaymentMenuViewModel vmodel) { PaymentBL.CalculCash(vmodel); ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; if (ViewBag.tot == "0") { vmodel.Ticket = TicketBL.FillTicket(vmodel.NumTransaction); ViewBag.ticket = true; } else { ViewBag.ticket = false; } vmodel.AmountsPaid = PaymentBL.MakeAmountsList(vmodel.NumTransaction); vmodel.MethodsP = PaymentBL.FindMethodsList(); return(View(vmodel)); }
public void MidnightTest() { var Payment = new Payment { StartDateTime = DateTime.Now.Date.AddHours(17), BedTime = DateTime.Now.Date.AddHours(24), EndDateTime = DateTime.Now.Date.AddDays(1).AddHours(4) }; var paymentBL = new PaymentBL(); var final = paymentBL.CalcAmountOwed(Payment); // 3hrs pre bed - 7*12 = 84 //4hours post bed 0*8 = 0 //4 hours post midnight 4*16 = 64 // total money = 148 Assert.IsTrue(final.AmountOwed == 148); }
public void GeneralTest() { var Payment = new Payment { StartDateTime = DateTime.Now.Date.AddHours(17), BedTime = DateTime.Now.Date.AddHours(20), EndDateTime = DateTime.Now.Date.AddDays(1).AddHours(4) }; var paymentBL = new PaymentBL(); var final = paymentBL.CalcAmountOwed(Payment); // 3hrs pre bed - 3*12 = 36 //4hours post bed 4*8 = 32 //4 hours post midnight 4*16 = 64 // total money = 132 Assert.IsTrue(final.AmountOwed == 132); }
private ActionResult PayCash(TrPaymentMenuViewModel vmodel, string language) { var temp = vmodel.Amount.Replace(".", ","); decimal cash = decimal.Parse(temp); // legal limit for cash if (cash <= 3000) { PaymentBL.CalculCash(vmodel); } else { @ViewBag.limitCash = "Montant cash max de 3000 € dépassé !"; } ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; vmodel.MethodsP = PaymentBL.FindMethodsList(); vmodel.AmountsPaid = PaymentBL.MakeAmountsList(vmodel.NumTransaction); ViewBag.messageCard = ""; if (ViewBag.tot == "0") { //to do --> change init isChange... bool isChange = false; vmodel.Ticket = TicketBL.FillTicket(vmodel.NumTransaction, language, isChange); vmodel.Language = vmodel.Ticket.Language; vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); vmodel.DateT = vmodel.Ticket.DateTicket; ViewBag.DateTi = vmodel.Ticket.DateTicket; ViewBag.ticket = true; } else { ViewBag.ticket = false; } return(View(vmodel)); }
private ActionResult PayCardDebit(TrPaymentMenuViewModel vmodel, string language) { PaymentBL.CalculCash(vmodel); ViewBag.tot = vmodel.GlobalTotal; ViewBag.amount = vmodel.Amount; ViewBag.cashBack = vmodel.CashReturn; if (ViewBag.tot == "0") { //to do --> change init isChange... bool isChange = false; vmodel.Ticket = TicketBL.FillTicket(vmodel.NumTransaction, language, isChange); vmodel.Language = vmodel.Ticket.Language; vmodel.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.DateTi = vmodel.Ticket.DateTicket; ViewBag.ticket = true; } else { ViewBag.ticket = false; } vmodel.AmountsPaid = PaymentBL.MakeAmountsList(vmodel.NumTransaction); vmodel.MethodsP = PaymentBL.FindMethodsList(); return(View(vmodel)); }
//[Authorize(Roles = "admin")] //[Authorize(Roles = "manager")] //[Authorize(Roles = "vendor")] public ActionResult Index(string gTot, string nTransac) { try { TrPaymentMenuViewModel vm = new TrPaymentMenuViewModel(); if (string.IsNullOrEmpty(nTransac)) { throw new NullReferenceException(); } else { if (Session["Language"] == null) { Session["Language"] = ConfigurationManager.AppSettings["Language"]; } string language = Session["Language"].ToString(); if (string.IsNullOrEmpty(gTot)) { gTot = TransactionBL.FindTotalByTransacId(nTransac); } var listAmounts = PaymentBL.MakeAmountsList(nTransac); if (listAmounts.Count == 0) { vm.GlobalTotal = gTot; ViewBag.tot = gTot; ViewBag.ticket = false; } else { vm.AmountsPaid = listAmounts; decimal result = PaymentBL.AdaptTotalWithPaid(gTot, listAmounts); if (result < 0) { decimal temp = Math.Abs(result); vm.CashReturn = temp.ToString(); ViewBag.cashBack = temp.ToString(); vm.GlobalTotal = "0"; ViewBag.tot = "0"; //to do --> change init isChange... bool isChange = false; vm.Ticket = TicketBL.FillTicket(nTransac, language, isChange); ViewBag.ticket = true; } else if (result == 0) { ViewBag.cashBack = "0"; vm.GlobalTotal = "0"; ViewBag.tot = "0"; //to do --> change init isChange... bool isChange = false; vm.Ticket = TicketBL.FillTicket(nTransac, language, isChange); ViewBag.ticket = true; } else { vm.GlobalTotal = result.ToString(); ViewBag.tot = result.ToString(); ViewBag.ticket = false; } } vm.NumTransaction = nTransac; ViewBag.transac = nTransac; } vm.MethodsP = PaymentBL.FindMethodsList(); vm.Languages = LanguageBL.FindLanguageListWithoutUniversal(); ViewBag.messageCard = ""; return(View(vm)); } catch (NullReferenceException ex) { //to do insert to log file var e1 = ex.GetBaseException(); // --> log var e4 = ex.Message; // --> log var e5 = ex.Source; // --> log var e8 = ex.GetType(); // --> log var e9 = ex.GetType().Name; // --> log ViewBag.Error = "Il n'y a pas de transaction en cours !"; return(View("Error")); } catch (Exception ex) { //to do insert to log file var e1 = ex.GetBaseException(); // --> log var e4 = ex.Message; // --> log var e5 = ex.Source; // --> log var e8 = ex.GetType(); // --> log var e9 = ex.GetType().Name; // --> log return(View("Error")); } }
public Payment CalculatePayment([FromBody] Payment hours) { var BL = new PaymentBL(); return(BL.CalcAmountOwed(hours)); }
public List <Payment> Get() { return(PaymentBL.GetAll()); }
public StudentInfoesController() { _studentBl = new StudentBL(); _paymentBl = new PaymentBL(); _gradeBl = new GradeBL(); }
public HttpResponseMessage GetAllPaymentsFromAllTenants(int buildingId) { var x = PaymentBL.GetAllPaymentsFromAllTenants(buildingId); return(Request.CreateResponse(HttpStatusCode.OK, x)); }
public HttpResponseMessage GetPaymentsByUser(int buildingId, int userId) { var x = PaymentBL.GetPaymentsByUser(buildingId, userId); return(Request.CreateResponse(HttpStatusCode.OK, x)); }
public HttpResponseMessage AddPayment(Payment payment) { PaymentBL.AddPayment(payment); return(Request.CreateResponse(HttpStatusCode.OK, true)); }
public HttpResponseMessage GetAllPayments(int buildingId) { List <Payment> payments = PaymentBL.GetPaymentsByBuilding(buildingId); return(Request.CreateResponse(HttpStatusCode.OK, payments)); }
public Payment Get(int id) { return(PaymentBL.GetById(id)); }
public ActionResult Index(string gTot, string nTransac) { try { TrPaymentMenuViewModel vm = new TrPaymentMenuViewModel(); if (string.IsNullOrEmpty(nTransac)) { ////provisoire //vm.GlobalTotal = "399.97"; //vm.NumTransaction = "11"; //ViewBag.tot = "399.97"; //ViewBag.transac = "11"; //ViewBag.ticket = false; throw new NullReferenceException(); } else { if (string.IsNullOrEmpty(gTot)) { gTot = TransactionBL.FindTotalByTransacId(nTransac); } var listAmounts = PaymentBL.MakeAmountsList(nTransac); if (listAmounts.Count == 0) { vm.GlobalTotal = gTot; ViewBag.tot = gTot; ViewBag.ticket = false; } else { vm.AmountsPaid = listAmounts; decimal result = PaymentBL.AdaptTotalWithPaid(gTot, listAmounts); if (result < 0) { decimal temp = Math.Abs(result); vm.CashReturn = temp.ToString(); ViewBag.cashBack = temp.ToString(); vm.GlobalTotal = "0"; ViewBag.tot = "0"; vm.Ticket = TicketBL.FillTicket(nTransac); ViewBag.ticket = true; } else if (result == 0) { ViewBag.cashBack = "0"; vm.GlobalTotal = "0"; ViewBag.tot = "0"; vm.Ticket = TicketBL.FillTicket(nTransac); ViewBag.ticket = true; } else { vm.GlobalTotal = result.ToString(); ViewBag.tot = result.ToString(); ViewBag.ticket = false; } } vm.NumTransaction = nTransac; ViewBag.transac = nTransac; } vm.MethodsP = PaymentBL.FindMethodsList(); ViewBag.messageCard = ""; return(View(vm)); } catch (NullReferenceException ex) { //to do insert to log file var e1 = ex.GetBaseException(); // --> log var e4 = ex.Message; // --> log var e5 = ex.Source; // --> log var e8 = ex.GetType(); // --> log var e9 = ex.GetType().Name; // --> log ViewBag.Error = "Il n'y a pas de transaction en cours !"; return(View("Error")); } catch (Exception ex) { //to do insert to log file var e1 = ex.GetBaseException(); // --> log var e4 = ex.Message; // --> log var e5 = ex.Source; // --> log var e8 = ex.GetType(); // --> log var e9 = ex.GetType().Name; // --> log return(View("Error")); } }