public int Insert() { int nResult = 0; cNewsCategory objInfor = new cNewsCategory(); try { objInfor.AddNew(); this.MappingData(objInfor); objInfor.Save(); nResult = objInfor.NewsCategoryID; } catch { nResult = 0; } return nResult; }
public int DeleteById(int ID) { int nResult = 0; cNewsCategory objDAL = new cNewsCategory(); try { objDAL.LoadByPrimaryKey(ID); objDAL.MarkAsDeleted(); objDAL.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public int Update(int ID) { int nResult = 0; cNewsCategory objInfor = new cNewsCategory(); try { objInfor.LoadByPrimaryKey(ID); this.MappingData(objInfor); objInfor.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public DataTable SearchAll() { DataTable tbResult = new DataTable(); cNewsCategory objDAL = new cNewsCategory(); tbResult = objDAL.SearchAll(); return tbResult; }
public void LoadById(int ID) { cNewsCategory objDAL = new cNewsCategory(); objDAL.LoadByPrimaryKey(ID); ConvertData(objDAL); }
private void MappingData(cNewsCategory objInfor) { objInfor.Description = Data.Description; }
private void ConvertData(cNewsCategory objInfor) { try { Data.Description = objInfor.Description; } catch { Data.Description = ""; } }