void btnDelete_Click(object sender, EventArgs e) { if (vl.Required(txtTenLSP.Text) && vl.Required(txtSoLuong.Text)) { string id = (string)lstLSP.SelectedRows[0].Cells[0].Value; DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Xóa?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.OK) { if (ctl.checkExist(id) == false) { if (ctl.deleteLSP(id)) { MessageBox.Show("Xóa Loại sản phẩm thành công!"); controlFunction("enableAll"); GUI_LoaiSanPham_Load(null, null); } else { MessageBox.Show("Hiện tại có Sản phẩm thuộc loại sản phẩm này trong hệ thống!"); } } else { MessageBox.Show("Loại sản phẩm cần xóa không tồn tại trong hệ thống!"); } } } else { MessageBox.Show("Vui lòng chọn Loại sản phẩm cần xóa!"); } }
void btnDelete_Click(object sender, EventArgs e) { if (vl.Required(txtTenNCC.Text) && vl.Required(txtDiaChi.Text) && vl.Required(txtSDT.Text)) { string id = (string)lstNCC.SelectedRows[0].Cells[0].Value; DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Xóa?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.OK) { if (ctl.checkExist(id) == false) { if (ctl.deleteNCC(id)) { MessageBox.Show("Xóa Nhà cung cấp thành công!"); GUI_NhaCungCap_Load(null, null); } else { MessageBox.Show("Hiện có sản phẩm thuộc nhà cung cấp này trong hệ thông!"); } } else { MessageBox.Show("Nhà cung cấp cần xóa không tồn tại trong hệ thống!"); } } } else { MessageBox.Show("Vui lòng chọn Nhà cung cấp cần Xóa!"); } }
void btnDelete_Click(object sender, EventArgs e) { if (vl.Required(cboTenSP.Text) && vl.Required(txtGia.Text)) { string id = lstLSG.SelectedRows[0].Cells[0].Value.ToString(); DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Xóa?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.OK) { if (ctl.deleteLSG(id, txtGia.Text, txtNgayHieuLuc.Value.ToString())) { MessageBox.Show("Xóa Lịch sử giá sản phẩm thành công!"); GUI_LichSuGia_Load(null, null); } } } else { MessageBox.Show("Vui lòng chọn Lịch sử giá sản phầm cần Xóa!"); } }
void btnDelete_Click(object sender, EventArgs e) { if (vl.Required(txtTenSP.Text) && vl.Required(cboLSP.Text) && vl.Required(cbNCC.Text) && vl.Required(txtHinhAnh.Text)) { string id = (string)lstSP.SelectedRows[0].Cells[0].Value; DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Xóa?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.OK) { if (ctl.checkExist(id) == false) { if (ctl.deleteSP(id)) { MessageBox.Show("Xóa Sản phẩm thành công!"); GUI_SanPham_Load(null, null); } else { MessageBox.Show("Sản phẩm này hiện đang được bán trong hệ thống!"); } } else { MessageBox.Show("Sản phẩm này không tồn tại trong hệ thống!"); } } } else { MessageBox.Show("Vui lòng chọn Sản phẩm cần Xóa!"); } }
void btnSave_Click(object sender, EventArgs e) { //Add if (flag == 1) { string sTmp = ""; bool flg = true; if (!vl.Required(txtTen.Text)) { sTmp = sTmp + "Vui lòng nhập Họ tên!\n"; flg = false; } if (!vl.Required(txtDiaChi.Text)) { sTmp = sTmp + "Vui lòng nhập Địa chỉ!\n"; flg = false; } if (!vl.Required(txtSDT.Text)) { sTmp = sTmp + "Vui lòng nhập Số điện thoại!\n"; flg = false; } else if (!vl.checkNumber(txtSDT.Text)) { sTmp = sTmp + "Vui lòng nhập lại đúng Số điện thoại!\n"; flg = false; } if (!vl.Required(txtTDN.Text)) { sTmp = sTmp + "Vui lòng nhập Tên đăng nhập!\n"; flg = false; } if (!vl.Required(txtMK.Text)) { sTmp = sTmp + "Vui lòng nhập Mật khẩu!\n"; flg = false; } else if (!vl.PassWordType(txtMK)) { sTmp = sTmp + "Mật khẩu phải từ 6-15 ký tự và không chứa kí tự đặc biệt!\n"; flg = false; } if (!vl.Required(txtCMND.Text)) { sTmp = sTmp + "Vui lòng nhập Số CMND!\n"; flg = false; } else if (!vl.checkNumber(txtCMND.Text)) { sTmp = sTmp + "Vui lòng nhập lại đúng Số CMND!\n"; flg = false; } if (flg) { if (ctl.checkExit(txtTDN.Text)) { if (ctl.addTK(txtTen.Text, txtDiaChi.Text, txtSDT.Text, txtCMND.Text, txtTDN.Text, txtMK.Text, cboQuyen.Text)) { MessageBox.Show("Thêm mới tài khoản thành công!"); GUI_QLTK_Load(null, null); controlFunction("enableAll"); } else { MessageBox.Show("Thêm mới sản phẩm không thành công!"); } } else { MessageBox.Show("Tên đăng nhập đã tồn tại!"); } } else { MessageBox.Show(sTmp); } } //Edit else if (flag == 2) { string sTmp = ""; bool flg = true; if (!vl.Required(txtTen.Text)) { sTmp = sTmp + "Vui lòng nhập Họ tên!\n"; flg = false; } if (!vl.Required(txtDiaChi.Text)) { sTmp = sTmp + "Vui lòng nhập Địa chỉ!\n"; flg = false; } if (!vl.Required(txtSDT.Text)) { sTmp = sTmp + "Vui lòng nhập Số điện thoại!\n"; flg = false; } else if (!vl.checkNumber(txtSDT.Text)) { sTmp = sTmp + "Vui lòng nhập lại đúng Số điện thoại!\n"; flg = false; } if (!vl.Required(txtTDN.Text)) { sTmp = sTmp + "Vui lòng nhập Tên đăng nhập!\n"; flg = false; } if (!vl.Required(txtCMND.Text)) { sTmp = sTmp + "Vui lòng nhập Số CMND!\n"; flg = false; } else if (!vl.checkNumber(txtCMND.Text)) { sTmp = sTmp + "Vui lòng nhập lại đúng Số CMND!\n"; flg = false; } if (flg) { if (ctl.checkExit(txtTDN.Text)) { update(); } else if (txtTDN.Text.Equals(lstTK.SelectedRows[0].Cells[5].Value.ToString())) { update(); } else { MessageBox.Show("Tên đăng nhập đã tồn tại!"); } } else { MessageBox.Show(sTmp); } } }
private void btnCancel_Click(object sender, EventArgs e) { string sTmp = ""; bool flg = true; if (!vl.Required(txtUser.Text)) { sTmp = sTmp + "Vui lòng điền tên đăng nhập!\n"; flg = false; } if (!vl.Required(txtPass.Text)) { sTmp = sTmp + "Vui lòng điền mật khẩu!\n"; flg = false; } if (flg) { try { TK = db.TAIKHOANs.Single(st => st.TENDANGNHAP.Equals(txtUser.Text) && st.MATKHAU.Equals(txtPass.Text)); if (TK.QUYEN.Equals("Giám đốc")) { GUI_Thongke tk = new GUI_Thongke(TK); this.Hide(); tk.ShowDialog(); this.Close(); } else if (TK.QUYEN.Equals("Nhân viên bán hàng")) { QLHD.GUI_POS sp = new QLHD.GUI_POS(TK, "Login"); this.Hide(); sp.ShowDialog(); this.Close(); } else if (TK.QUYEN.Equals("Quản lý chi nhánh")) { QLNH.GUI_DX sp = new QLNH.GUI_DX(TK); this.Hide(); sp.ShowDialog(); this.Close(); } else if (TK.QUYEN.Equals("Nhân viên kiểm kho")) { QLNH.GUI_NHTS sp = new QLNH.GUI_NHTS(TK); this.Hide(); sp.ShowDialog(); this.Close(); } else if (TK.QUYEN.Equals("Thư ký")) { Dexuat.GUI_DX sp = new Dexuat.GUI_DX(TK); this.Hide(); sp.ShowDialog(); this.Close(); } } catch { MessageBox.Show("Tên đăng nhập hoặc mật khẩu không chính xác!"); txtPass.Text = ""; } } else { MessageBox.Show(sTmp); } }
void btnDelete_Click(object sender, EventArgs e) { if (vl.Required(cboSP.Text) && vl.Required(txtNoiDung.Text) && vl.Required(txtGiaKM.Text) && vl.Required(txtHinhAnh.Text)) { string id = (string)lstTTKM.SelectedRows[0].Cells[0].Value; DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Xóa?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.OK) { if (ctl.checkExist(id) == false) { if (ctl.deleteTTKM(id)) { MessageBox.Show("Xóa thông tin khuyến mãi thành công!"); GUI_TTKM_Load(null, null); } } else { MessageBox.Show("Thông tin khuyến mãi cần xóa không tồn tại trong hệ thống!"); } } } else { MessageBox.Show("Vui lòng chọn Thông tin khuyến mãi cần Xóa!"); } }