private void delivery_Click(object sender, EventArgs e)
        {
            panel3.Controls.Clear();
            delivery vehiForm = new delivery();

            vehiForm.TopLevel = false;
            panel3.Controls.Add(vehiForm);
            vehiForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            vehiForm.Dock            = DockStyle.Fill;

            vehiForm.Show();
        }
        private void btn_main_delivery_Click(object sender, EventArgs e)
        {
            panel1.Controls.Clear();
            lbl_panalname.Text    = "Vehical";
            lbl_panalname.Visible = true;
            delivery vehiForm = new delivery();

            vehiForm.TopLevel = false;
            panel1.Controls.Add(vehiForm);
            vehiForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            vehiForm.Dock            = DockStyle.Fill;

            vehiForm.Show();
        }
Exemplo n.º 3
0
        private void btnPurSub_Click(object sender, EventArgs e)
        {
            delivery de = new delivery();

            if (co.CardPoints > 0)
            {
                DialogResult dr;
                dr = MessageBox.Show("           " + co.CustomrName + " have " + co.CardPoints + " points \n" +
                                     "                   want to spend?", "Confirm", MessageBoxButtons.YesNo);
                double amountToPay;
                if (dr.ToString() == "Yes")
                {
                    amountToPay = so.PurchaseGrand - co.CardPoints;
                    MessageBox.Show("amount to pay " + amountToPay);

                    mcm.DeductPoints(co, so);
                }
            }

            //call LoyaltyCardAddPoints method to update loyalty points
            double tot_amount = Convert.ToDouble(txtPurGrand.Text);

            mcm.LoyaltyCardAddPoints(tot_amount, txtPurNIC.Text);


            string     q   = "update Invoice set Amount='" + so.PurchaseGrand + "' where NIC= '" + so.NIC + "' and InvoiceID='" + so.InvoiceNo + "' ";
            SqlCommand cmd = new SqlCommand(q, con);

            con.Open();
            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Succesfully Submitted");

                //Ask to change the  card type when customer reaching new card level by getting tot invoice amount
                mcm.changeCardType(txtPurNIC.Text);

                btnPurCreate.Enabled  = true;
                txtPurNIC.Enabled     = true;
                cmbPurPayType.Enabled = true;
                btn9Demo.Enabled      = true;
                btn10Clear.Enabled    = true;

                //update customer rating level when new invoice generate
                mcm.rating();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            con.Close();


            string     q1   = "select* from Delivery where InvoiceID ='" + so.InvoiceNo + "'";
            SqlCommand cmd1 = new SqlCommand(q, con);

            con.Open();
            try
            {
                SqlDataReader rd = cmd1.ExecuteReader();
                if (rd.HasRows)
                {
                    ;
                }
                {
                }
            }catch (Exception ex)
            {
                throw ex;
            }
            con.Close();


            if (chkPurDel.Checked)
            {
                string     q2   = "update Invoice set deliveryStatus='W' where InvoiceID='" + so.InvoiceNo + "'";
                SqlCommand cmd2 = new SqlCommand(q2, con);
                con.Open();
                try
                {
                    cmd2.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                con.Close();
            }
            else
            {
                string     q2   = "update Invoice set deliveryStatus='NW' where InvoiceID='" + so.InvoiceNo + "'";
                SqlCommand cmd2 = new SqlCommand(q2, con);
                con.Open();
                try
                {
                    cmd2.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                con.Close();
            }


            cmbPurType.Enabled  = false;
            cmbPurMake.Enabled  = false;
            cmbPurModel.Enabled = false;
            txtPurSKey.Enabled  = false;
            cmbPurIn.Enabled    = false;
            txtPurNIC.Clear();
            cmbPurPayType.SelectedIndex = -1;
            lblPurName.Text             = "";


            btnPurSub.Enabled    = false;
            btnPurAdd.Enabled    = false;
            btnPurDelete.Enabled = false;
            btn2Demo.Enabled     = false;

            txtPurTot.Text   = "";
            txtPurDis.Text   = "";
            txtPurGrand.Text = "";



            if (chkPurDel.Checked)
            {
                de.Show();
            }
        }