public static void XuatExcel(DataTable _dt, string _Ten) { SanPhamDataAccess.XuatExcel(_dt, _Ten); }
//Sửa giá bán lẻ theo nhóm sản phẩm public static bool SuaGiaTheoNhom(string _MaNSP, string _GiaBan) { return(SanPhamDataAccess.SuaGiaTheoNhom(_MaNSP, _GiaBan)); }
//Sửa thông tin sản phẩm public static bool SuaSanPham(SanPhamPublic _sp) { return(SanPhamDataAccess.SuaSanPham(_sp)); }
//Import data to Datatable public static DataTable ImportToDatatable(string _path) { return(SanPhamDataAccess.ImportToDatatable(_path)); }
//Lấy đơn vị tính cbo public static List <DonViTinhPublic> LayDVT() { return(SanPhamDataAccess.LayDVT()); }
//Lấy nhà cung cấp public static List <NhaCungCapPublic> LayNCC() { return(SanPhamDataAccess.LayNCC()); }
//Xóa sản phẩm public static bool XoaSanPham(string _MaSP) { return(SanPhamDataAccess.XoaSanPham(_MaSP)); }
//Lấy nhóm sản phẩm 2 public static List <NhomSanPhamPublic> LayNSP2() { return(SanPhamDataAccess.LayNSP2()); }
//Thêm mới sản phẩm public static bool ThemSanPham(SanPhamPublic _sp) { return(SanPhamDataAccess.ThemSanPham(_sp)); }
//Danh sách sản phẩm public static DataSet DsSanPham() { return(SanPhamDataAccess.DsSanPham()); }
//Nút lưu private void btnLuu_Click(object sender, RoutedEventArgs e) { #region 1.Kiểm tra thông tin nhập vào if (string.IsNullOrEmpty(txtMaSP.Text)) { MessageBox.Show("Mã sản phẩm không được để trống"); txtMaSP.Focus(); return; } else { if (SanPhamDataAccess.CheckExist(txtMaSP.Text.Trim())) { MessageBox.Show("Mã sản phẩm đã tồn tại"); txtMaSP.Focus(); txtMaSP.SelectAll(); return; } } if (!KiemTraGiaNhap()) { return; } if (!KiemTraGiaBanLe()) { return; } if (!KiemTraGiaBanSi()) { return; } if (!KiemTraChietKhau()) { return; } #endregion #region 2. Lấy thông tin _sp.MaSP_SP = txtMaSP.Text.Trim(); _sp.TenSP_SP = txtTenSP.Text.Trim().ToUpper(); _sp.NSP_SP.MaNSP_NSP = cboNhomSP.SelectedValue.ToString(); _sp.NCC_SP.MaNCC_NCC = cboNCC.SelectedValue.ToString(); _sp.DVT_SP.MaDVT_DVT = cboDonVi.SelectedValue.ToString(); _sp.GiaNhap_SP = txtGiaNhap.Text.Trim(); _sp.GiaBanLe_SP = txtGiaBanLe.Text.Trim(); _sp.GiaBanSi_SP = txtGiaBanSi.Text.Trim(); _sp.CKPhanTram_SP = Convert.ToInt32(txtChietKhau.Text.Trim()); rtxtGhiChu.SelectAll(); _sp.GhiChu_SP = rtxtGhiChu.Selection.Text.Trim(); #endregion #region 3. Gọi phương thức thêm mới sản phẩm EventHandler _eh = _ThemSanPham; if (_eh != null) { _eh(this, e); } this.Close(); #endregion }