コード例 #1
0
 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;
             }
         }
     }
 }
コード例 #2
0
 void GetInfoResultLoaiNguyenLieu()
 {
     if (loaiNL == null)
     {
         loaiNL = new LoaiNguyenLieuDTO();
     }
     loaiNL.MaLoaiNL  = txtMaLoaiNL.Text;
     loaiNL.TenLoaiNL = txtTenLoaiNL.Text;
     loaiNL.TrangThai = chkTrangThai.Checked;
 }
コード例 #3
0
        // 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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public static bool KhoiPhucTrangThaiNguyenLieu(LoaiNguyenLieuDTO loaiNL)
 {
     return(LoaiNguyenLieuDAO.KhoiPhucTrangThaiNguyenLieu(loaiNL));
 }
コード例 #8
0
 public static bool CapNhatLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL)
 {
     return(LoaiNguyenLieuDAO.CapNhatLoaiNguyenLieu(loaiNL));
 }
コード例 #9
0
 public static bool ThemLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL)
 {
     return(LoaiNguyenLieuDAO.ThemLoaiNguyenLieu(loaiNL));
 }
コード例 #10
0
 void LamMoi()
 {
     RefeshForm();
     AddStatus(1);
     loaiNL = null;
 }