private void bt_Luu_Click(object sender, EventArgs e) { bt_Luu.Enabled = false; bt_Huy.Enabled = false; txt_TenNV.Enabled = false; txt_SoDienThoai.Enabled = false; txt_QueQuan.Enabled = false; txt_DiaChi.Enabled = false; cb_LoaiNhanVien.Enabled = false; dt_NgaySinh.Enabled = false; //Kiem tra du lieu nhap vao if (txt_TenNV.Text.CompareTo("") == 0 || txt_SoDienThoai.Text.CompareTo("") == 0 || txt_QueQuan.Text.CompareTo("") == 0 || txt_DiaChi.Text.CompareTo("") == 0) { MessageBox.Show("Hãy Nhập Đầy Đủ Thông Tin"); } else { //Them vao co so du lieu string MaNV = ConnectToDB.SinhMaNhanVien(); NhanVienXL NhanVien = new NhanVienXL(MaNV, txt_TenNV.Text, dt_NgaySinh.Text, txt_QueQuan.Text, cb_LoaiNhanVien.SelectedValue.ToString(), txt_DiaChi.Text, txt_SoDienThoai.Text); bool kq = NhanVien.ThemNhanVien(); if (kq == true) { MessageBox.Show("Thêm thành công"); } } }
private void TraCuu_MonAn_Load(object sender, EventArgs e) { DataTable dt = ConnectToDB.TruyVan_TraVe_DataTable("select * from Tb_MonAn"); cb_MonAn.Items.Add("Chon"); cb_MonAn.DataSource = dt; cb_MonAn.DisplayMember = "TenMonAn"; cb_MonAn.ValueMember = "MaMonAn"; }
private void bt_Luu_Click(object sender, EventArgs e) { string maKH = ConnectToDB.SinhMaKhachHang(); if (txt_TenKH.Text.CompareTo("") == 0) { MessageBox.Show("Xin nhập thông tin khách hàng!"); bt_Luu.Enabled = true; bt_huy.Enabled = true; } else { KhachHangXL KhHang = new KhachHangXL(maKH, txt_TenKH.Text, txt_DC.Text, txt_SDT.Text); bool kq = KhHang.ThemKhachHang(); if (kq == true) { txt_TenKH.Enabled = false; txt_DC.Enabled = false; txt_SDT.Enabled = false; bt_Luu.Enabled = false; bt_huy.Enabled = false; } } for (int i = 0; i < Grid_DatMon.Rows.Count - 1; i++) { if (Grid_DatMon.Rows[i].Cells[0] == null || Grid_DatMon.Rows[i].Cells[1].Value == null) { MessageBox.Show("Thiếu thông tin đặt hàng"); bt_Luu.Enabled = true; bt_huy.Enabled = true; } else { string mMA = Grid_DatMon.Rows[i].Cells[0].Value.ToString(); MonAnXL GMA = new MonAnXL(); int GiaMA = Convert.ToInt32(GMA.GiaMonAn(mMA)); float giaMA = Convert.ToInt32(Grid_DatMon.Rows[i].Cells[1].Value) * GiaMA; Grid_DatMon.Rows[i].Cells[2].Value = giaMA; //MessageBox.Show(Convert.ToString(giaMA)); DatComXL DatCom = new DatComXL(maKH, dtime_NgayDat.Text, dtime_NgayNhan.Text, mMA, Convert.ToInt32(Grid_DatMon.Rows[i].Cells[1].Value), giaMA); bool kq = DatCom.ThemVaoDonDH(); if (kq == true) { MessageBox.Show("Đặt Món Ăn Thành Công!"); dtime_NgayDat.Enabled = false; dtime_NgayNhan.Enabled = false; Grid_DatMon.Enabled = false; } } } }
private void bt_Luu_Click(object sender, EventArgs e) { bt_Luu.Enabled = false; bt_Huy.Enabled = false; Grid_MonAn.Enabled = false; //kiem tra du lieu nhap vao for (int i = 0; i < Grid_MonAn.RowCount - 1; i++) { if (Grid_MonAn.Rows[i].Cells[0] == null || Grid_MonAn.Rows[i].Cells[1].Value == null) { MessageBox.Show("Xin nhập đầy đủ thông tin!"); } else { string maMA = ConnectToDB.SinhMaMonAn(); MonAnXL monAn = new MonAnXL(maMA, Convert.ToString(Grid_MonAn.Rows[i].Cells[0].Value), Convert.ToSingle(Grid_MonAn.Rows[i].Cells[1].Value)); bool kq = monAn.ThemMonAn(); if (kq == true) { MessageBox.Show("Thêm thành công!"); } } } }