private void LamMoiMon(bool state = true)
 {
     txtMaMon.Text            = MonBUS.LayMaMonMoiNhat() + 1 + "";
     txtTenMon.Text           = txtGiaTienMon.Text = string.Empty;
     cmbLoaiMon.SelectedIndex = 0;
     picHinhMon.Image         = Properties.Resources.default_product;
     btnThemMon.Enabled       = state;
     btnXoaMon.Enabled        = !state;
     btnSuaMon.Enabled        = !state;
     btnKhoiPhucMon.Enabled   = !state;
     openFileDialog1.FileName = "";
 }
        private void btnThemMon_Click(object sender, EventArgs e)
        {
            if (txtTenMon.Text == "")
            {
                MessageBox.Show("Vui lòng nhập đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            MonDTO mon = new MonDTO();

            mon.TenMon  = txtTenMon.Text;
            mon.LoaiMon = Convert.ToInt32(cmbLoaiMon.SelectedValue);
            if (openFileDialog1.FileName != "")
            {
                string tenFile   = DateTime.Now.ToFileTime() + "_" + (MonBUS.LayMaMonMoiNhat() + 1).ToString();
                string extension = Path.GetExtension(openFileDialog1.SafeFileName);
                mon.Hinh = tenFile + extension;
                File.Copy(openFileDialog1.FileName, "img\\products\\" + tenFile + extension, true);
            }
            if (txtGiaTienMon.Text != "")
            {
                mon.GiaTien = Convert.ToDouble(txtGiaTienMon.Text);
            }
            else
            {
                mon.GiaTien = 0;
            }
            mon.TrangThai = true;

            if (MonBUS.ThemMon(mon))
            {
                MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LamMoiMon();
                QLM_LoadDanhSachMon(GetTimKiemMon(), Convert.ToInt32(cmbTimKiemTheoLoaiMon.SelectedValue));
                dgvMon.ClearSelection();
            }
            else
            {
                MessageBox.Show("Thêm thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                mon = null;
            }
        }