public int Insert() { int nResult = 0; cCompany objInfor = new cCompany(); try { objInfor.AddNew(); this.MappingData(objInfor); objInfor.Save(); nResult = objInfor.CompanyID; } catch { nResult = 0; } return nResult; }
public int DeleteById(int ID) { int nResult = 0; cCompany objDAL = new cCompany(); try { objDAL.LoadByPrimaryKey(ID); objDAL.MarkAsDeleted(); objDAL.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public int Update(int ID) { int nResult = 0; cCompany objInfor = new cCompany(); try { objInfor.LoadByPrimaryKey(ID); this.MappingData(objInfor); objInfor.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public DataTable Search() { DataTable tbResult = new DataTable(); cCompany objDAL = new cCompany(); tbResult = objDAL.Search(); return tbResult; }
public void LoadById(int ID) { cCompany objDAL = new cCompany(); objDAL.LoadByPrimaryKey(ID); ConvertData(objDAL); }
private void MappingData(cCompany objInfor) { try { objInfor.CompanyName = Data.CompanyName; } catch { objInfor.CompanyName = ""; } try { objInfor.Address = Data.Address; } catch { objInfor.Address = ""; } try { objInfor.Hotline = Data.Hotline; } catch { objInfor.Hotline = ""; } try { objInfor.Tel = Data.Tel; } catch { objInfor.Tel = ""; } try { objInfor.Email = Data.Email; } catch { objInfor.Email = ""; } try { objInfor.Website = Data.Website; } catch { objInfor.Website = ""; } try { objInfor.Copyright = Data.Copyright; } catch { objInfor.Copyright = ""; } try { objInfor.GoogleMap = Data.GoogleMap; } catch { objInfor.GoogleMap = ""; } try { objInfor.YahooAccount1 = Data.YahooAccount1; } catch { objInfor.YahooAccount1 = ""; } try { objInfor.YahooAccount2 = Data.YahooAccount2; } catch { objInfor.YahooAccount2 = ""; } try { objInfor.YahooAccount3 = Data.YahooAccount3; } catch { objInfor.YahooAccount3 = ""; } try { objInfor.YahooAccount4 = Data.YahooAccount4; } catch { objInfor.YahooAccount4 = ""; } try { objInfor.YahooDescription1 = Data.YahooDescription1; } catch { objInfor.YahooDescription1 = ""; } try { objInfor.YahooDescription2 = Data.YahooDescription2; } catch { objInfor.YahooDescription2 = ""; } try { objInfor.YahooDescription3 = Data.YahooDescription3; } catch { objInfor.YahooDescription3 = ""; } try { objInfor.YahooDescription4 = Data.YahooDescription4; } catch { objInfor.YahooDescription4 = ""; } try { objInfor.SkypeAccount1 = Data.SkypeAccount1; } catch { objInfor.SkypeAccount1 = ""; } try { objInfor.SkypeAccount2 = Data.SkypeAccount2; } catch { objInfor.SkypeAccount2 = ""; } try { objInfor.SkypeAccount3 = Data.SkypeAccount3; } catch { objInfor.SkypeAccount3 = ""; } try { objInfor.SkypeAccount4 = Data.SkypeAccount4; } catch { objInfor.SkypeAccount4 = ""; } try { objInfor.SkypeDescription1 = Data.SkypeDescription1; } catch { objInfor.SkypeDescription1 = ""; } try { objInfor.SkypeDescription2 = Data.SkypeDescription2; } catch { objInfor.SkypeDescription2 = ""; } try { objInfor.SkypeDescription3 = Data.SkypeDescription3; } catch { objInfor.SkypeDescription3 = ""; } try { objInfor.SkypeDescription4 = Data.SkypeDescription4; } catch { objInfor.EmailFwd1 = ""; } try { objInfor.EmailFwd1 = Data.EmailFwd1; } catch { objInfor.EmailFwd1 = ""; } try { objInfor.EmailFwd2 = Data.EmailFwd2; } catch { objInfor.EmailFwd2 = ""; } }