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; } }
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; } }