Esempio n. 1
0
        private void cmbCategory_TextChanged(object sender, EventArgs e)
        {
            CoffeeContextDB context  = new CoffeeContextDB();
            List <Food>     listFood = context.Foods.ToList().Where(p => p.FoodCategory.name == cmbCategory.Text).ToList();

            cmbFoody(listFood);
        }
Esempio n. 2
0
        private void Admin_Load(object sender, EventArgs e)
        {
            //Format Date
            //Init SQL DB
            CoffeeContextDB context = new CoffeeContextDB();
            List <Account>  listAcc = context.Accounts.ToList();

            BindGrid_Account(listAcc);
            BindGrid_InCome();
        }
Esempio n. 3
0
        private void fTable_Load(object sender, EventArgs e)
        {
            CoffeeContextDB     context      = new CoffeeContextDB();
            List <FoodCategory> listCategory = context.FoodCategories.ToList();
            List <Food>         listFood     = context.Foods.ToList();
            List <TableFood>    listTable    = context.TableFoods.ToList();

            InitTable();
            cmbType(listCategory);
            cmbFoody(listFood);
            cmbTableChanged(listTable);
        }
Esempio n. 4
0
 private void BindGrid_InCome()
 {
     using (CoffeeContextDB _contextDB = new CoffeeContextDB())
     {
         List <BillInfo> listBill = _contextDB.BillInfoes.ToList();
         dgvInCome.Rows.Clear();
         foreach (var item in listBill)
         {
             int index = dgvInCome.Rows.Add();
             dgvInCome.Rows[index].Cells[0].Value = item.Bill.TableFood.name;
             dgvInCome.Rows[index].Cells[1].Value = item.Bill.DateCheckIn;
             dgvInCome.Rows[index].Cells[2].Value = item.Bill.DateCheckOut;
             dgvInCome.Rows[index].Cells[3].Value = item.Bill.discount;
             dgvInCome.Rows[index].Cells[4].Value = item.count * item.Food.price;
         }
     }
 }
Esempio n. 5
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            string UserName = txtUserName.Text.Trim();
            string Password = txtPassword.Text.Trim();

            if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Password))
            {
                MessageBox.Show("Tài Khoản hoặc mật khẩu chưa chính xác, Vui lòng nhập lại !", "Thông Báo",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                return;
            }
            else
            {
                using (var _dbContext = new CoffeeContextDB())
                {
                    Account checkUser     = _dbContext.Accounts.Where(p => p.UserName == UserName).FirstOrDefault();
                    Account checkPassword = _dbContext.Accounts.Where(p => p.PassWord == Password).FirstOrDefault();


                    if (checkUser == null && checkPassword == null)
                    {
                        MessageBox.Show("Tài Khoản Không Tồn Tài !", "Thông Báo",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    }
                    else if (checkUser == null)
                    {
                        MessageBox.Show("Sai Tài Khoản !", "Thông Báo",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    }
                    else if (checkPassword == null)
                    {
                        MessageBox.Show("Sai Mật Khẩu !", "Thông Báo",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    }
                    else
                    {
                        this.Hide();
                        if (accountAccuracy != null)
                        {
                            accountAccuracy(checkUser);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
 private void bindDgvBill(int id)
 {
     using (CoffeeContextDB _contextDB = new CoffeeContextDB())
     {
         List <List> listBillInfo = MenuDAO.Instance.GetListMenu(id);
         dgvTableDetails.Rows.Clear();
         float total = 0;
         foreach (List item in listBillInfo)
         {
             int index = dgvTableDetails.Rows.Add();
             dgvTableDetails.Rows[index].Cells[0].Value = item.name;
             dgvTableDetails.Rows[index].Cells[1].Value = item.count;
             dgvTableDetails.Rows[index].Cells[2].Value = item.Price;
             dgvTableDetails.Rows[index].Cells[3].Value = item.Totalprice;
             total += item.Totalprice;
         }
         CultureInfo culture = new CultureInfo("vi-VN");
         txtTotalPrice.Text = total.ToString("c", culture);
     }
 }