Exemplo n.º 1
0
        //List<object> cart,decimal total
        public PaymentForm(List <object> cart, decimal total)
        {
            InitializeComponent();
            CashPayment.Visible = false;
            DebitCard.Visible   = false;
            CreditCard.Visible  = false;
            // Paymentbutton.Visible = false;
            Cart                   = cart;
            Total                  = total;
            Totalamountpay         = total;
            PaymentLabel.Text      = Total.ToString();
            TotalPaymentLable.Text = Total.ToString();
            //MessageBox.Show(customerid.ToString(),"jkjk");
            OrderController orc = new OrderController();

            orc.setcustomerid(customerid);
            orc.settotal(Total);
            orc.setorder();
            orderid = orc.getorderid();
            if (orderid == 0)
            {
                Paymentbutton.Enabled = false;
            }
        }
Exemplo n.º 2
0
 private void Back_Click(object sender, EventArgs e)
 {
     if (details == false)
     {
         OrderController orc = new OrderController();
         // MessageBox.Show(orderid.ToString(), "orderid");
         orc.setorderid(orderid);
         bool i = orc.deleteorder();
         if (i == true)
         {
             //MessageBox.Show("order is deleted");
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             MessageBox.Show("order is not deleted");
             // this.DialogResult = DialogResult.OK;
         }
     }
     else
     {
         this.DialogResult = DialogResult.OK;
     }
 }
Exemplo n.º 3
0
        private void Validatecustomerbutton_Click(object sender, EventArgs e)
        {
            loyaltycardnumber = LoyaltytextBox.Text;

            CustomerContoller co = new CustomerContoller();

            co.Checkcustomer(loyaltycardnumber);
            customerid         = co.getcustomerid();
            totalshopcount     = co.getshopcount();
            totalpurchasevalue = co.gettotalpurchase();

            /*  MessageBox.Show(customerid.ToString() + "customerid");
             * MessageBox.Show(totalshopcount.ToString() + "totalshopcount");
             * MessageBox.Show(totalpurchasevalue.ToString() + "totalpurchasevalue");
             */

            if (customerid != 2)
            {
                MessageBox.Show("loyal customer");


                if (totalpurchasevalue >= 0 && totalpurchasevalue <= 5000)
                {
                    discountpercentage     = 5.00m;
                    discount               = (Total * discountpercentage) / 100;
                    discount               = (decimal)(Math.Round(discount, 2));
                    DiscountLabel.Text     = discount.ToString();
                    Totalamountpay         = Total - discount;
                    Totalamountpay         = (decimal)(Math.Round(Totalamountpay, 2));
                    TotalPaymentLable.Text = Totalamountpay.ToString();
                }
                else if (totalpurchasevalue >= 10000)
                {
                    discountpercentage     = 10.00m;
                    discount               = (Total * discountpercentage) / 100;
                    discount               = (decimal)(Math.Round(discount, 2));
                    DiscountLabel.Text     = discount.ToString();
                    Totalamountpay         = Total - discount;
                    Totalamountpay         = (decimal)(Math.Round(Totalamountpay, 2));
                    TotalPaymentLable.Text = Totalamountpay.ToString();
                }
                else
                {
                    discountpercentage = 0.00m;
                    discount           = 0.00m;

                    DiscountLabel.Text     = discount.ToString();
                    Totalamountpay         = Total - discount;
                    Totalamountpay         = (decimal)(Math.Round(Totalamountpay, 2));
                    TotalPaymentLable.Text = Totalamountpay.ToString();
                }
                OrderController oc = new OrderController();
                oc.setcustomerid(customerid);
                oc.setorderid(orderid);
                bool details = oc.updatecustomerid();
                if (details == false)
                {
                    MessageBox.Show("customer was not updated");
                }
            }
            else
            {
                MessageBox.Show("Please input appropriate telephone number");
                // MessageBox.Show("normal customer");
                DiscountLabel.Text = "0.00";
                customerid         = 2;
            }
        }