public ActionResult Index() { PETiano petiano = LoggedPETiano.GetLogedPETiano(); PaymentFilter paymentFilter = new PaymentFilter() { PETianoId = petiano.Id }; List<Payment> payments = _PaymentService.GetPayments(paymentFilter); List<Payment> paymentsStatement = _PaymentService.GetAccountStatement(paymentFilter); PaymentIndex pi = new PaymentIndex(); pi.Balance = petiano.Balance; pi.Payments = payments; pi.PaymentsStatement = paymentsStatement; Payment credit = new Payment(); credit.Type = EPaymentType.Credit; credit.Date = DateTime.Now; credit.PETiano = petiano; credit.PETianoId = petiano.Id; pi.NewCredit = credit; return View(pi); }
public ActionResult SaveRecordOfMeeting(int id) { if(id != 0) { RecordOfMeeting recordOfMeeting = _RecordOfMeetingService.GetRecordOfMeeting(new RecordOfMeetingFilter() { Id = id }); if (recordOfMeeting != null) { foreach(AbsentOrLate var in recordOfMeeting.AbsentsOrLates) { PETiano target = _PETianoService.GetPETiano(new PETianoFilter() { Id = var.PETianoId }); Payment tal = new Payment(); if(!var.IsJustified) { tal.Type = EPaymentType.Penalty; tal.PETianoId = target.Id; tal.Status = EPaymentStatus.Pending; tal.Photo = null; tal.Date = DateTime.Now; tal.RefusedJustification = null; } if (var.Type == EAbsentOrLate.Absent && !var.IsJustified) { tal.PenaltyJustification = Localization.Meetings.AbsentOrLate.NotJustifiedAbsence; tal.Value = Localization.Meetings.AbsentOrLate.AbsentPenalty; _PaymentService.AddPayment(tal); } else if (var.Type == EAbsentOrLate.Late && !var.IsJustified) { tal.PenaltyJustification = Localization.Meetings.AbsentOrLate.NotJustifiedLate; tal.Value = Localization.Meetings.AbsentOrLate.LatePenalty; _PaymentService.AddPayment(tal); } } recordOfMeeting.Status = ERecordOfMeetingStatus.Closed; recordOfMeeting.PDFFile = getPDFFile(recordOfMeeting.Id); _RecordOfMeetingService.EditRecordOfMeeting(recordOfMeeting); SendRecordToEmail(recordOfMeeting, new List<string>() { "*****@*****.**" }); } } return RedirectToAction("Index"); }
public void AddCredit(Payment credit) { using (IDataProvider provider = base.CreateDataProvider()) using (IPaymentRepository repository = provider.CreatePaymentRepository()) repository.Create(credit); }
public void AddPayment(Payment payment) { using (IBusinessProvider provider = base.CreateBusinessProvider()) using (IPaymentBusinessProvider prov = provider.CreatePaymentBusinessProvider()) prov.AddCredit(payment); }