示例#1
0
        public decimal TotalPaid(int invoiceId)
        {
            DataTable dtPaymentFromCustomer = BLPaymentFromClient.GetPaymentFromClientByInvoiceId(invoiceId);
            decimal totalPaid = 0;

            for (int i = 0; i < dtPaymentFromCustomer.Rows.Count; i++)
            {
                totalPaid = totalPaid + decimal.Parse(dtPaymentFromCustomer.Rows[i]["PaymentAmount"].ToString());
            }
            return totalPaid;
        }
示例#2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     Invoice invoice = BLInvoice.GetInvoiceListById(APCContext,int.Parse(tbInvoiceId.Text));
     BLPaymentFromClient.insertPaymentFromClient(APCContext,invoice,decimal.Parse(tbPaymentAmount.Text), calPaidDate.Value);
     
     //check if payment has been made full - if yes then can mark as paid.
     if (invoice.TotalDue <= TotalPaid(invoice.Id))
     {
         invoice.Paid = true;
         invoice.DatePaid = DateTime.Now;
         APCContext.SaveChanges();
     }
     
     MessageBox.Show("Payment has been recorded");
 }