Ejemplo n.º 1
0
 private void bSave_Click(object sender, EventArgs e)
 {
     ContractRepository crep = new ContractRepository();
     Contract contract = crep.getContract(contractId);
     PaymentRepository repository = new PaymentRepository();
     PersianDateFormatter pdf = new PersianDateFormatter();
     Payment payment = new Payment();
     payment.ContractId = contractId;
     payment.AmountOfPayment = Convert.ToInt32(tPayment.Text);
     payment.DateOfPayment = pdf.convert(tPaymentDate.Text);
     DateModel dm = pdf.getSplittedDateIntegers(payment.DateOfPayment.Value);
     payment.Year = dm.Year;
     payment.Month = dm.Month;
     payment.Day = dm.Day;
     contract.Payment += payment.AmountOfPayment;
     repository.addPayment(payment);
     crep.updateContract(contract);
 }