Esempio n. 1
0
        private void btnThemLoaiSP_Click(object sender, EventArgs e)
        {
            if (this.txtMaLoai.Text == string.Empty || this.txtTenLoaiSP.Text == string.Empty)
            {
                MessageBox.Show("Bạn chưa điền đầy đủ thông tin !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            LOAISANPHAM loaisp = new LOAISANPHAM {
                MALOAI = this.txtMaLoai.Text, TENLOAI = this.txtTenLoaiSP.Text, TRANGTHAI = true
            };

            if (LoaiSanPhamBUS.ThemLoaiSanPham(loaisp))
            {
                MessageBox.Show("Thêm loại sản phẩm thành công !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadDataDSLoaiSP();
                AutoCompleteMaLoai();
                LoadComboBoxData();
                ResetTabQLLoaiSP();
                string lsth = "[" + DateTime.Now.ToString("dd/MM/yyyy-h:m:s") + "] " + this.manv + " đã thêm mới loại sản phẩm " + loaisp.MALOAI;
                LichSuHeThongBUS.ThemLSHT(new LICHSUHETHONG
                {
                    NGAYTAO       = DateTime.Now.Date,
                    NV_THAOTAC    = this.manv,
                    VITRI_THAOTAC = this.vitrithaotacLoaiSP,
                    GHICHU        = lsth
                });
            }
            else
            {
                MessageBox.Show("Thêm loại sản phẩm thất bại!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }