protected void CheckoutButton_Click(object sender, EventArgs e)
        {
            MainView.ActiveViewIndex = 2;
            ApplicationUserManager userManager = new ApplicationUserManager(new
                                                                            UserStore <ApplicationUser>(new ApplicationDbContext()));
            string userName   = Context.User.Identity.GetUserName();
            int    employeeid = 0;

            if (!string.IsNullOrEmpty(userName))
            {
                employeeid     = userManager.Get_CurrentEmployeeIDFromUserName(userName);
                UserName3.Text = userName;
                UserID3.Text   = employeeid.ToString();
            }
            CheckoutGridView.DataBind();

            ShoppingCartController sysmgr    = new ShoppingCartController();
            List <CartSelection>   cartItems = sysmgr.Get_CartItemsByEmployeeID(employeeid);

            decimal subTotal = cartItems.Sum(x => x.QuantitySelected * x.SellingPrice);

            SubTotalLabel.Text = subTotal.ToString();

            decimal tax = subTotal / 20;

            TaxLabel.Text = tax.ToString();

            decimal discount = Label3.Visible ? decimal.Parse(DiscountLabel.Text) : 0;

            decimal total = subTotal + tax - discount;

            TotalLabel.Text = total.ToString();
        }
        protected void OrderButton_Click(object sender, EventArgs e)
        {
            ApplicationUserManager userManager = new ApplicationUserManager(new
                                                                            UserStore <ApplicationUser>(new ApplicationDbContext()));
            string userName   = Context.User.Identity.GetUserName();
            int    employeeid = 0;

            if (!string.IsNullOrEmpty(userName))
            {
                employeeid = userManager.Get_CurrentEmployeeIDFromUserName(userName);
            }
            MessageUserControl.TryRun(() =>
            {
                Sale sale        = new Sale();
                sale.SaleDate    = DateTime.Now;
                sale.PaymentType = PaymentDDL.SelectedValue;
                sale.EmployeeID  = employeeid;
                sale.TaxAmount   = decimal.Parse(TaxLabel.Text);
                sale.SubTotal    = decimal.Parse(SubTotalLabel.Text);
                if (!string.IsNullOrEmpty(CouponIDLabel.Text))
                {
                    sale.CouponID = int.Parse(CouponIDLabel.Text);
                }

                ShoppingCartController sysmgr = new ShoppingCartController();
                ShoppingCart cart             = sysmgr.Get_ShoppingCartByEmployeeID(employeeid);
                SalesDetailController sysmg2  = new SalesDetailController();
                sysmg2.PlaceOrder(sale, cart);
            }, "Place Order", "Order successfully placed.");
            ProductSelectionListView.DataBind();
            CartListView.DataBind();
            CheckoutGridView.DataBind();
            SubTotalLabel.Text       = "";
            TaxLabel.Text            = "";
            Label3.Text              = "";
            DiscountLabel.Text       = "";
            TotalLabel.Text          = "";
            MainView.ActiveViewIndex = 2;
        }