private void btnThem_Click(object sender, EventArgs e) { if (loaiNL == null) { if (!RegexForm()) { return; } else { GetInfoResultLoaiNguyenLieu(); if (LoaiNguyenLieuBUS.ThemLoaiNguyenLieu(loaiNL)) { //MessageBox.Show("Thêm loại nguyên liệu mới thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None); LoadDSLoaiNguyenLieu(); RefeshForm(); AddStatus(1); } else { MessageBox.Show("Mã loại nguyên liệu không được phép trùng nhau", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); loaiNL = null; } } } }
void GetInfoResultLoaiNguyenLieu() { if (loaiNL == null) { loaiNL = new LoaiNguyenLieuDTO(); } loaiNL.MaLoaiNL = txtMaLoaiNL.Text; loaiNL.TenLoaiNL = txtTenLoaiNL.Text; loaiNL.TrangThai = chkTrangThai.Checked; }
// Khôi phục trạng thái loại nguyên liệu public static bool KhoiPhucTrangThaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { string query = "UPDATE [tblLoaiNguyenLieu] SET [TenLoaiNL] = @TenLoaiNL,[TrangThai] = @TrangThai WHERE MaLoaiNL = @MaLoaiNL"; SqlParameter[] pars = new SqlParameter[3]; pars[0] = new SqlParameter("@MaLoaiNL", loaiNL.MaLoaiNL); pars[1] = new SqlParameter("@TenLoaiNL", loaiNL.TenLoaiNL); pars[2] = new SqlParameter("@TrangThai", true); return(DataProvider.ExecuteUpdateQuery(query, pars) == 1); }
public static bool ThemLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { string query = "INSERT INTO [tblLoaiNguyenLieu]([MaLoaiNL],[TenLoaiNL],[TrangThai]) VALUES(@MaLoaiNL,@TenLoaiNL,@TrangThai)"; SqlParameter[] pars = new SqlParameter[3]; pars[0] = new SqlParameter("@MaLoaiNL", loaiNL.MaLoaiNL); pars[1] = new SqlParameter("@TenLoaiNL", loaiNL.TenLoaiNL); pars[2] = new SqlParameter("@TrangThai", true); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public void HienDSTheLoaiNL(string maLoaiNL) { List <rptNguyenLieuDTO> lsNL = rptNguyenLieuBUS.ReportLayDSMonAnTheoMaLoaiNL(maLoaiNL); rpvBaoCao.LocalReport.ReportEmbeddedResource = s + "rptDSTheLoaiNguyenLieu.rdlc"; LoaiNguyenLieuDTO loaiNL = rptNguyenLieuBUS.ReportLayMaLoaiNL(maLoaiNL); rpvBaoCao.LocalReport.SetParameters(new ReportParameter("paLoaiNL", loaiNL.TenLoaiNL)); rpvBaoCao.LocalReport.DataSources.Add(new ReportDataSource("DSNguyenLieu", lsNL)); rpvBaoCao.RefreshReport(); }
public static LoaiNguyenLieuDTO ReportLayMaLoaiNL(string maLoaiNL) { LoaiNguyenLieuDTO result = null; string query = "select MaLoaiNL,TenLoaiNL from tblLoaiNguyenLieu where MaLoaiNL = @MaLoaiNL"; SqlParameter[] pars = new SqlParameter[1]; pars[0] = new SqlParameter("@MaLoaiNL", maLoaiNL); DataTable dt = DataProvider.ExecuteSelectQuery(query, pars); foreach (DataRow dr in dt.Rows) { LoaiNguyenLieuDTO rptNL = new LoaiNguyenLieuDTO(); rptNL.MaLoaiNL = dr["MaLoaiNL"].ToString(); rptNL.TenLoaiNL = dr["TenLoaiNL"].ToString(); result = (rptNL); } return(result); }
public static bool KhoiPhucTrangThaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { return(LoaiNguyenLieuDAO.KhoiPhucTrangThaiNguyenLieu(loaiNL)); }
public static bool CapNhatLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { return(LoaiNguyenLieuDAO.CapNhatLoaiNguyenLieu(loaiNL)); }
public static bool ThemLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { return(LoaiNguyenLieuDAO.ThemLoaiNguyenLieu(loaiNL)); }
void LamMoi() { RefeshForm(); AddStatus(1); loaiNL = null; }