Exemplo n.º 1
0
 public static void XuatExcel(DataTable _dt, string _Ten)
 {
     SanPhamDataAccess.XuatExcel(_dt, _Ten);
 }
Exemplo n.º 2
0
 //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));
 }
Exemplo n.º 3
0
 //Sửa thông tin sản phẩm
 public static bool SuaSanPham(SanPhamPublic _sp)
 {
     return(SanPhamDataAccess.SuaSanPham(_sp));
 }
Exemplo n.º 4
0
 //Import data to Datatable
 public static DataTable ImportToDatatable(string _path)
 {
     return(SanPhamDataAccess.ImportToDatatable(_path));
 }
Exemplo n.º 5
0
 //Lấy đơn vị tính cbo
 public static List <DonViTinhPublic> LayDVT()
 {
     return(SanPhamDataAccess.LayDVT());
 }
Exemplo n.º 6
0
 //Lấy nhà cung cấp
 public static List <NhaCungCapPublic> LayNCC()
 {
     return(SanPhamDataAccess.LayNCC());
 }
Exemplo n.º 7
0
 //Xóa sản phẩm
 public static bool XoaSanPham(string _MaSP)
 {
     return(SanPhamDataAccess.XoaSanPham(_MaSP));
 }
Exemplo n.º 8
0
 //Lấy nhóm sản phẩm 2
 public static List <NhomSanPhamPublic> LayNSP2()
 {
     return(SanPhamDataAccess.LayNSP2());
 }
Exemplo n.º 9
0
 //Thêm mới sản phẩm
 public static bool ThemSanPham(SanPhamPublic _sp)
 {
     return(SanPhamDataAccess.ThemSanPham(_sp));
 }
Exemplo n.º 10
0
 //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
        }