public DataTable CheckExistProductCode(string ProductCode)
 {
     DataTable tbResult = new DataTable();
     cProductCategory objDAL = new cProductCategory();
     tbResult = objDAL.CheckExistProductCode(ProductCode);
     return tbResult;
 }
 public int Insert()
 {
     int nResult = 0;
     cProductCategory objInfor = new cProductCategory();
     try
     {
         objInfor.AddNew();
         this.MappingData(objInfor);
         objInfor.Save();
         nResult = objInfor.ProductCategoryID ;
     }
     catch
     {
         nResult = 0;
     }
     return nResult;
 }
 public int DeleteById(int ID)
 {
     int nResult = 0;
     cProductCategory objDAL = new cProductCategory();
     try
     {
         objDAL.LoadByPrimaryKey(ID);
         objDAL.MarkAsDeleted();
         objDAL.Save();
         nResult = ID;
     }
     catch
     {
         nResult = 0;
     }
     return nResult;
 }
 public DataTable Search()
 {
     DataTable tbResult = new DataTable();
     cProductCategory objDAL = new cProductCategory();
     tbResult = objDAL.Search();
     return tbResult;
 }
 public void LoadById(int ID)
 {
     cProductCategory objDAL = new cProductCategory();
     objDAL.LoadByPrimaryKey(ID);
     ConvertData(objDAL);
 }
 private void MappingData(cProductCategory objInfor)
 {
     try { objInfor.ProductCategoryName = Data.ProductCategoryName; }
     catch { objInfor.ProductCategoryName = ""; }
     try { objInfor.Code = Data.Code; }
     catch { objInfor.Code = ""; }
 }
 private void ConvertData(cProductCategory objInfor)
 {
     try { Data.ProductCategoryName = objInfor.ProductCategoryName; }
     catch { Data.ProductCategoryName = ""; }
     try { Data.Code = objInfor.Code; }
     catch { Data.Code = ""; }
 }
 public int Update(int ID)
 {
     int nResult = 0;
     cProductCategory objInfor = new cProductCategory();
     try
     {
         objInfor.LoadByPrimaryKey(ID);
         this.MappingData(objInfor);
         objInfor.Save();
         nResult = ID;
     }
     catch
     {
         nResult = 0;
     }
     return nResult;
 }