Ejemplo n.º 1
0
        public void loadInfoOrder(BillSell billSell)
        {
            fORDER f1 = Application.OpenForms.OfType <fORDER>().FirstOrDefault();

            if (f1 != null)
            {
                if (billSell == null)
                {
                    f1.lbCount.Text = 0.ToString();
                    f1.lbTotal.Text = String.Format("{0:0,00} VNĐ", 0.0);
                    return;
                }
                DetailBillSellService detailBillSellService = new DetailBillSellService(new CoffeShopContext());
                f1.lbCount.Text = detailBillSellService.GetCountDetail(billSell).ToString();
                BillSellService bsService = new BillSellService(new CoffeShopContext());
                var             detail    = detailBillSellService.GetDetailBillSell(billSell);
                if (detail.Count == 0)
                {
                    f1.lbCount.Text = detailBillSellService.GetCountDetail(billSell).ToString();
                    f1.lbTotal.Text = String.Format("{0:0,00} VNĐ", 0.0);
                    return;
                }

                bsService.SetTotal(detail, billSell);
                f1.lbTotal.Text = String.Format("{0:0,00} VNĐ", bsService.GetTotal(billSell));
            }
        }
Ejemplo n.º 2
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            bool   check = true;
            fORDER f1    = Application.OpenForms.OfType <fORDER>().FirstOrDefault();

            if (f1 != null)
            {
                try
                {
                    BillSell billSell = f1.getBillSellofTable();
                    DetailBillSellService detailBillSellService = new DetailBillSellService(new CoffeShopContext());
                    int number         = Convert.ToInt32(cbbNumber.SelectedItem);
                    var DetailBillSell = detailBillSellService.CreateDetailBillSell(billSell, _product, number);
                    var DetailBill     = detailBillSellService.GetDetailBill(DetailBillSell);
                    f1.addProductToListOrder(DetailBill);
                    f1.lbCount.Text = detailBillSellService.GetCountDetail(billSell).ToString();
                    BillSellService bsService = new BillSellService(new CoffeShopContext());
                    bsService.SetTotal(detailBillSellService.GetDetailBillSell(billSell), billSell);
                    f1.lbTotal.Text = String.Format("{0:0,00} VNĐ", bsService.GetTotal(billSell));
                }
                catch (Exception)
                {
                    cbbNumber.Refresh();
                    check = false;
                }
            }
            if (check)
            {
                this.Dispose();
            }
        }
Ejemplo n.º 3
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            UserService userService = new UserService(new CoffeShopContext());

            if (userService.ValidateUser(teLogin.Text, tePassword.Text))
            {
                this.Hide();
                var user = userService.GetUser(teLogin.Text);
                if (user.userName == Constants.administrator)
                {
                    fMain fMain = new fMain();
                    fMain.Show();
                    return;
                }
                fORDER fORDER = new fORDER(user);
                fORDER.Show();
            }
            else
            {
                MessageBox.Show("Đăng Nhập Không Thành Công", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }