示例#1
0
        private void btnSubmit_Click(object sender, EventArgs e) //
        {
            if (orderedFood.Count == 0)
            {
                Form_Alert.Alert("Chưa có món ăn!", Form_Alert.enmType.Warning);
            }
            else if (this.ParentForm.idBanAn != null) // Delete existing banAn and its ThucDonBan
            {
                this.idBanAn = this.ParentForm.idBanAn;
                THUCDONBAN.Ins.XoaAllMonTheoBanAn(idBanAn);
                addThucDonBan();
                this.ParentForm.resetInfoForm();

                Form_Alert.Alert("Thêm món thành công!", Form_Alert.enmType.Success);
            }
            else
            {
                addBanAn();
                addThucDonBan();
                this.ParentForm.resetInfoForm();

                Form_Alert.Alert("Đặt món thành công!", Form_Alert.enmType.Success);
                BANAN.Ins.setTableStatus(this.selectedTable.tableId, "1");
            }
            this.Close();
        }
        private void checkValue(object sender, EventArgs e)
        {
            TextBox txtBoxNumber = sender as TextBox;
            int     num          = 0;

            if (txtBoxNumber.Text == "")
            {
                return;
            }
            if (!Int32.TryParse(txtBoxNumber.Text, out num))
            {
                Form_Alert.Alert("Chỉ được nhập số", Form_Alert.enmType.Warning);

                if (txtBoxNumber.Text.Length > 1)
                {
                    txtBoxNumber.Text = txtBoxNumber.Text.Remove(txtBoxNumber.Text.Length - 1, 1);
                }
                else if (txtBoxNumber.Text.Length == 1)
                {
                    txtBoxNumber.Text = "1";
                }
                return;
            }
            if (num <= 0)
            {
                Form_Alert.Alert("Số lượng phải >= 0", Form_Alert.enmType.Warning);
                txtBoxNumber.Text = "1";
                return;
            }
            updatePriceTxtBox();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (selectedTable == null)
            {
                Form_Alert.Alert("Thêm bàn trước!", Form_Alert.enmType.Warning);
                return;
            }
            IconButton button       = sender as IconButton;
            Food       selectedFood = button.Tag as Food;

            selectedFood.Number = Convert.ToInt32(selectedFood.Num.Text);
            Food newFoodItem = new Food(selectedFood);

            tempPrice    += selectedFood.Price * selectedFood.Number;
            allFoodCount += selectedFood.Number;
            if (orderedFood.ContainsKey(selectedFood.Id))
            {
                orderedFood[selectedFood.Id].Number += selectedFood.Number;
            }
            else
            {
                orderedFood.Add(selectedFood.Id, newFoodItem);
                idOrderedFood.Add(selectedFood.Id);
            }
            //button.Tag = selectedFood;
            btnPrice.Text = tempPrice.ToString("#,##0");
        }
        private void btnSelectTable_Click(object sender, EventArgs e)
        {
            if (this.lblTableStatus.Text == "Trống")
            {
                if (selectedTable != null)
                {
                    BANAN.Ins.setTableStatus(selectedTable.tableId, "0");
                }
                this.selectedTable = this.selectingTable;
                Form_Alert.Alert("Thêm bàn thành công!", Form_Alert.enmType.Success);
                BANAN.Ins.setTableStatus(selectingTable.tableId, "");
                // khách hàng



                this.Close();
            }
            else if (this.lblTableStatus.Text == "Đã có khách")
            {
                this.selectedTable = this.selectingTable;
                this.Close();
            }
            else
            {
                Form_Alert.Alert("Thêm bàn thất bại!", Form_Alert.enmType.Error);
            }
        }
示例#5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox1.Text == "" || txtUserName.Text == "" || txtPass.Text == "" | txtPassConfirm.Text == "")
                {
                    throw new Exception("Nhập chưa đủ thông tin");
                }
                if (Account.Ins.ExistUserName(txtUserName.Text))
                {
                    throw new Exception("Tên tài khoản đã tồn tại");
                }
                if (txtPass.Text != txtPassConfirm.Text)
                {
                    throw new Exception("Mật khẩu nhập không trùng khớp");
                }
                string id = comboBox1.Text;

                bool rs = Account.Ins.Insert(id, txtUserName.Text, txtPass.Text, Account.TypeAcc.Staff);
                if (rs == true)
                {
                    Form_Alert.Alert("Thêm thành công", Form_Alert.enmType.Success);
                    this.Close();
                }
                else
                {
                    Form_Alert.Alert("Thêm thát bại", Form_Alert.enmType.Error);
                    this.Close();
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
示例#6
0
        //exibe mensagens de notificação para o usuário
        public static void notificacao(string mensagem, Form_Alert.enmType tipo)
        {
            Form_Alert f = new Form_Alert
            {
                ShowInTaskbar = false,
                TopMost       = true
            };

            f.showAlert(mensagem, tipo);
        }
示例#7
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string id = lbID.Text;
            bool   rs = NhanVien.Ins.Delete(id);

            if (rs = true)
            {
                Form_Alert.Alert("Xóa thành công!", Form_Alert.enmType.Success);
            }
            this.Dispose();
        }
        private void checkEmpty(object sender, EventArgs e)
        {
            TextBox txtBoxNumber = sender as TextBox;
            int     num          = 0;

            if (txtBoxNumber.Text == "")
            {
                Form_Alert.Alert("Không được để trống", Form_Alert.enmType.Warning);
                txtBoxNumber.Text = "1";
            }
        }
 private void btnPrice_Click(object sender, EventArgs e)
 {
     if (selectedTable != null && idBanAn != null && (BANAN.Ins.getBanAnChuaThanhToan(selectedTable.tableId).Rows[0][0].ToString()) != null)
     {
         ThanhToanBan thanhToan = new ThanhToanBan(selectedTable, this);
         thanhToan.ShowDialog();
         thanhToan.Focus();
     }
     else
     {
         Form_Alert.Alert("Chưa đặt món!", Form_Alert.enmType.Info);
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            CustomerDTO p = new CustomerDTO();

            try
            {
                if (txtName.Text == "" || txtPhone.Text == "" || txtUserName.Text == "" || txtPassWords.Text == "" || txtPassWordsConfirm.Text == "" || (radioButton1.Checked && radioButton2.Checked))
                {
                    throw new Exception("Bạn chưa nhập đủ thông tin");
                }
                if (MONAN.Ins.check_Dongia(txtPhone.Text) == false)
                {
                    throw new Exception("Số điện thoại không hợp lệ");
                }
                if (KHACHHANG.Ins.Exist_Phone(txtPhone.Text))
                {
                    throw new Exception("Mỗi số điện thoại chỉ đăng kí 1 lần.");
                }
                if (ACCOUNTKHACHHANG.Ins.Exists_UserName(txtUserName.Text))
                {
                    throw new Exception("Tên tài khoản đã tồn tại.");
                }
                if (txtPassWords.Text != txtPassWordsConfirm.Text)
                {
                    throw new Exception("Mật khẩu nhập lại không trùng khớp");
                }

                p.Makh     = txtID.Text;
                p.Hoten    = txtName.Text;
                p.Gioitinh = (radioButton1.Checked == true) ? "Nam" : "Nữ";
                p.LoaiKH   = "Bình thường";
                p.Sdt      = txtPhone.Text;
                p.Diem     = "0";
                bool rs  = KHACHHANG.Ins.Insert(p);
                bool rs1 = ACCOUNTKHACHHANG.Ins.Insert(txtID.Text, txtUserName.Text, Account.Ins.GetHashPassword(txtPassWords.Text));
                if (rs == true && rs1 == true)
                {
                    Form_Alert.Alert("Đăng kí thành công.", Form_Alert.enmType.Success);
                }
                else
                {
                    Form_Alert.Alert("Lỗi", Form_Alert.enmType.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            this.Close();
        }
        private void btnPlus_Click(object sender, EventArgs e)
        {
            if (txtBoxNumber.Text == "")
            {
                txtBoxNumber.Text = "" + foodItem.Number;
                Form_Alert.Alert("Không để số lượng trống!", Form_Alert.enmType.Warning);
                return;
            }
            int num = Convert.ToInt32(txtBoxNumber.Text);

            txtBoxNumber.Text = "" + (++num);
            foodItem.Number   = num;
            this.Tag          = foodItem;
            changeCartPrice(foodItem);
        }
        private void btnPay_Click(object sender, EventArgs e)
        {
            addHoaDonBan();
            Form_Alert.Alert("Thanh toán thành công!", Form_Alert.enmType.Success);
            BILL bill = new BILL(idBanAn);

            bill.printBill();
            BANAN.Ins.setTableStatus(this.selectedTable.tableId, "0");
            if (this.ParentForm != null)
            {
                this.ParentForm.selectedTable = null;
            }
            // khách
            ParentForm.CustomerInTalbe.Remove(selectedTable.tableId);
            ParentForm.selectedCustomer = null;
            ParentForm.btnTable.Text    = "Chọn bàn";
            ParentForm.btnCustomer.Text = "Chọn khách hàng";
            ParentForm.btnPrice.Text    = "0";
            this.Close();
        }
        private void btnCustomer_Click(object sender, EventArgs e)
        {
            if (selectedTable == null)
            {
                Form_Alert.Alert("Thêm bàn trước!", Form_Alert.enmType.Warning);
                return;
            }
            SelectedCus form;

            if (selectedCustomer == null)
            {
                form = new SelectedCus(null, this);
                form.ShowDialog();
            }
            else
            {
                form = new SelectedCus(selectedCustomer.Makh, this);
                form.ShowDialog();
            }
        }
        private void btnSelectTable_Click(object sender, EventArgs e)
        {
            string idBan = ParentForm.selectedTable.tableId;

            if (customer == null)
            {
                Form_Alert.Alert("Chưa chọn khách hàng!", Form_Alert.enmType.Warning);
                return;
            }
            else
            {
                ParentForm.CustomerInTalbe.Remove(idBan);
                ParentForm.CustomerInTalbe.Add(idBan, customer);
                ParentForm.selectedCustomer = customer;
                ParentForm.btnCustomer.Text = "Khách hàng: " + customer.Hoten;
                Form_Alert.Alert("Thêm khách thành công!", Form_Alert.enmType.Success);
            }

            this.Close();
        }
示例#15
0
        // Method to show an alert after the answering to a question
        private void AlertQuestion(AnswerLevel level)
        {
            Form_Alert alert = new Form_Alert();

            Form_Alert.TypeMessage type = Form_Alert.TypeMessage.ERROR;
            string message = "Oops! Faire plus d'effort.";

            switch (level)
            {
            case AnswerLevel.ALL:
                type    = Form_Alert.TypeMessage.SUCCESS;
                message = "Très bien! Vous êtes intelligent.";
                break;

            case AnswerLevel.MEDIUM:
                type    = Form_Alert.TypeMessage.WARNING;
                message = "Bien! Bon continuation.";
                break;
            }
            alert.ShowAlert(message, type);
        }
        private void btnCart_Click(object sender, EventArgs e)
        {
            if (selectedTable == null)
            {
                Form_Alert.Alert("Lỗi: Chưa thêm bàn!", Form_Alert.enmType.Error);
                return;
            }
            if (orderedFood.Count == 0)
            {
                Form_Alert.Alert("Lỗi: Chưa thêm món!", Form_Alert.enmType.Error);
                return;
            }
            if (selectedCustomer == null)
            {
                Form_Alert.Alert("Lỗi: Chưa thêm khách hàng!", Form_Alert.enmType.Error);
                return;
            }
            GioHang gioHang = new GioHang(this, orderedFood, idOrderedFood, selectedTable, staffId, selectedCustomer.Makh);

            gioHang.ShowDialog();
            gioHang.Focus();
        }
        private void btnMinus_Click(object sender, EventArgs e)
        {
            if (txtBoxNumber.Text == "")
            {
                txtBoxNumber.Text = "" + foodItem.Number;
                Form_Alert.Alert("Không để số lượng trống!", Form_Alert.enmType.Warning);
                return;
            }
            int num = Convert.ToInt32(txtBoxNumber.Text);

            if (num > 1)
            {
                txtBoxNumber.Text = "" + (--num);
                foodItem.Number   = num;
                this.Tag          = foodItem;
                changeCartPrice(foodItem);
            }
            else
            {
                GioHang gioHang = (this.ParentForm as GioHang);
                gioHang.removeFood(foodItem.Id);
                return;
            }
        }
示例#18
0
        public void Alert(string msg1, string msg2, Form_Alert.enmType type)
        {
            Form_Alert frm = new Form_Alert();

            frm.showAlert(msg1, msg2, type);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text == "")
                {
                    throw new Exception("Tên không được rỗng");
                }
                if (txtDiaChi.Text == "")
                {
                    throw new Exception("Địa chỉ không được rỗng");
                }
                if (txtPhone.Text == "")
                {
                    throw new Exception("Số điện thoại không được rỗng");
                }
                if (!MONAN.Ins.check_Dongia(txtPhone.Text))
                {
                    throw new Exception("Số điện thoại không hợp lệ");
                }
                if (comboBox1.Text == "")
                {
                    throw new Exception("Chức vụ không được rỗng");
                }
                if (radioButton1.Checked == false && radioButton2.Checked == false && radioButton3.Checked == false)
                {
                    throw new Exception("Giới tính chưa được chọn");
                }
                if (txtCMND.Text == "")
                {
                    throw new Exception("Chứng minh nhân dân không được rỗng");
                }

                staff.Hoten = txtName.Text;
                if (radioButton1.Checked)
                {
                    staff.Gtinh = "Nam";
                }
                if (radioButton2.Checked)
                {
                    staff.Gtinh = "Nữ";
                }
                if (radioButton3.Checked)
                {
                    staff.Gtinh = "Khác";
                }
                staff.Cmnd   = txtCMND.Text;
                staff.Dchi   = txtDiaChi.Text;
                staff.Sdt    = txtPhone.Text;
                staff.Ngsinh = dateTimePicker1.Value;
                staff.Vitri  = comboBox1.Text;
                if (PathImg == "")
                {
                    staff.ImgStr = ImgStrDefault;
                }
                else
                {
                    staff.ImgStr = Convert.ToBase64String(NhanVien.Ins.converImgToByte(PathImg));
                }

                bool rs = NhanVien.Ins.Update(staff.Id, staff.Hoten, staff.Gtinh, staff.Ngsinh, staff.Dchi, staff.Cmnd, "1", staff.Vitri, staff.ImgStr, staff.Sdt);
                if (rs == true)
                {
                    Form_Alert.Alert("Lưu thành công!", Form_Alert.enmType.Success);
                    this.Close();
                }
                else
                {
                    Form_Alert.Alert("Lưu thất bại!", Form_Alert.enmType.Error);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
示例#20
0
        public static void Alert(string msg, Form_Alert.enmType type)
        {
            Form_Alert frm = new Form_Alert();

            frm.showAlert(msg, type);
        }