Esempio n. 1
0
        private void btnIssueInvoice_Click(object sender, EventArgs e)
        {
            grpRepairsDone.Visible = false;

            //Gets current date
            string d = DateTime.Now.ToString("d-MMM-yyyy");

            //Adds a payment to payments table
            Payments p = new Payments(Int32.Parse(txtPaymentID.Text), Int32.Parse(lblTotalCostFill.Text), d, Int32.Parse(lblCustomerID.Text));

            p.addPayment();

            //Confirmation msg
            MessageBox.Show("PAYMENT RECIEVED\n-------------------\nBALANCE UPDATED", "SUCCESS!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

            //stores status value
            string status = "'PAID'";

            //Getting repair and customer ID
            int cno = Convert.ToInt32(grdAllCustomer.Rows[grdAllCustomer.CurrentCell.RowIndex].Cells[0].Value);
            int rno = Convert.ToInt32(grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[0].Value);

            //Updates customer balance and repair status
            Repair rep = new Repair();

            Repair.updateCustomerBalance(Convert.ToInt32(lblCostFill.Text), Convert.ToInt32(lblCustomerID.Text));
            rep.updateRepairStatusPAYMENT(Convert.ToInt32(cno), Convert.ToInt32(rno), status);
            DataSet DataSet = new DataSet();

            grdAllCustomer.DataSource = Customer.getAllCustomers(DataSet).Tables["ss"];
            string status2 = "'ISSUE INVOICE'";


            DataSet ds = new DataSet();

            grdRepairs.DataSource = Repair.getCustomerRepair(ds, Convert.ToInt32(grdAllCustomer.Rows[grdAllCustomer.CurrentCell.RowIndex].Cells[0].Value), status2).Tables["ss"];

            txtPaymentID.Text = Payments.nextPaymentID().ToString("0000");
        }