public int Insert() { int nResult = 0; cBasket objInfor = new cBasket(); try { objInfor.AddNew(); this.MappingData(objInfor); objInfor.Save(); nResult = objInfor.BasketID; } catch { nResult = 0; } return nResult; }
public int DeleteById(int ID) { int nResult = 0; cBasket objDAL = new cBasket(); try { objDAL.LoadByPrimaryKey(ID); objDAL.MarkAsDeleted(); objDAL.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public int Update(int ID) { int nResult = 0; cBasket objInfor = new cBasket(); try { objInfor.LoadByPrimaryKey(ID); this.MappingData(objInfor); objInfor.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public DataTable SearchAll() { DataTable tbResult = new DataTable(); cBasket objDAL = new cBasket(); tbResult = objDAL.SearchAll(); return tbResult; }
public void LoadById(int ID) { cBasket objDAL = new cBasket(); objDAL.LoadByPrimaryKey(ID); ConvertData(objDAL); }
private void MappingData(cBasket objInfor) { try { objInfor.BasketName = Data.BasketName; } catch { objInfor.BasketName = ""; } try { objInfor.CustomerName = Data.CustomerName; } catch { objInfor.CustomerName = ""; } try { objInfor.BasketContent = Data.BasketContent; } catch { objInfor.BasketContent = ""; } try { objInfor.CustomerAddress = Data.CustomerAddress; } catch { objInfor.CustomerAddress = ""; } try { objInfor.CustomerTel = Data.CustomerTel; } catch { objInfor.CustomerTel = ""; } try { objInfor.CustomerEmail = Data.CustomerEmail; } catch { objInfor.CustomerEmail = ""; } try { objInfor.Status = Data.Status; } catch { objInfor.Status = 0; } try { objInfor.DateCreated = Data.DateCreated; } catch { objInfor.DateCreated = ""; } }
private void ConvertData(cBasket objInfor) { try { Data.BasketName = objInfor.BasketName; } catch { Data.BasketName = ""; } try { Data.CustomerName = objInfor.CustomerName; } catch { Data.CustomerName = ""; } try { Data.BasketContent = objInfor.BasketContent; } catch { Data.BasketContent = ""; } try { Data.CustomerAddress = objInfor.CustomerAddress; } catch { Data.CustomerAddress = ""; } try { Data.CustomerTel = objInfor.CustomerTel; } catch { Data.CustomerTel = ""; } try { Data.CustomerEmail = objInfor.CustomerEmail; } catch { Data.CustomerEmail = ""; } try { Data.Status = objInfor.Status; } catch { Data.Status = 0; } try { Data.DateCreated = objInfor.DateCreated; } catch { Data.DateCreated = ""; } }
public int UpdateStatus(int ID, int Status) { int nResult = 0; cBasket objDAL = new cBasket(); try { objDAL.LoadByPrimaryKey(ID); objDAL.Status = Status; objDAL.Save(); nResult = objDAL.BasketID; } catch { nResult = 0; } return nResult; }