public int DeleteById(int ID) { int nResult = 0; cProducts objDAL = new cProducts(); try { objDAL.LoadByPrimaryKey(ID); objDAL.MarkAsDeleted(); objDAL.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public int Insert() { int nResult = 0; cProducts objInfor = new cProducts(); try { objInfor.AddNew(); this.MappingData(objInfor); objInfor.Save(); nResult = objInfor.ProductID; } catch { nResult = 0; } return nResult; }
public DataSet GetTopOderNew() { var objDal = new cProducts(); DataSet tbResult = objDal.SearchTopOrderNew(); return tbResult; }
public DataTable GetProductByCategory(int categoryId) { var objDal = new cProducts(); DataTable tbResult = objDal.GetProductByCategoryId(categoryId); return tbResult; }
/** * get don hang voi ma don hang la 17: Don hang moi * */ public DataTable GetOderNew() { var objDal = new cProducts(); DataTable tbResult = objDal.SearchOrderNew(); return tbResult; }
public int UpdateStatus(int ID, int Status) { int nResult = 0; cProducts objDAL = new cProducts(); try { objDAL.LoadByPrimaryKey(ID); objDAL.Status = Status; objDAL.Save(); nResult = objDAL.ProductID ; } catch (Exception ex) { nResult = 0; } return nResult; }
private void MappingData(cProducts objInfor) { try { objInfor.ProductCategoryID = Data.ProductCategoryID; } catch { objInfor.ProductCategoryID = 0; } try { objInfor.ProductFileID = Data.ProductFileID; } catch { objInfor.ProductFileID = 0; } try { objInfor.ProductName = Data.ProductName; } catch { objInfor.ProductName = ""; } try { objInfor.Price = Data.Price; } catch { objInfor.Price = 0; } try { objInfor.InitContent = Data.InitContent; } catch { objInfor.InitContent = ""; } try { objInfor.MainContent = Data.MainContent; } catch { objInfor.MainContent = ""; } try { objInfor.Status = Data.Status; } catch { objInfor.Status = 0; } try { objInfor.Images = Data.Images; } catch { objInfor.Images = ""; } try { objInfor.Priority = Data.Priority; } catch { objInfor.Priority = 0; } try { objInfor.ViewCount = Data.ViewCount; } catch { objInfor.ViewCount = 0; } try { objInfor.InitContent2 = Data.InitContent2; } catch { objInfor.InitContent2 = ""; } }
public int UpdatePriority(int ProductID, int Priority) { int nResult = 0; cProducts objDAL = new cProducts(); try { objDAL.LoadByPrimaryKey(ProductID); objDAL.Priority = Priority; objDAL.Save(); nResult = objDAL.ProductID; } catch { nResult = 0; } return nResult; }
public int Update(int ID) { int nResult = 0; cProducts objInfor = new cProducts(); try { objInfor.LoadByPrimaryKey(ID); this.MappingData(objInfor); objInfor.Save(); nResult = ID; } catch { nResult = 0; } return nResult; }
public DataTable Search_byItemID(int ItemView, int ItemID, string ProductName, double PriceFrom, double PriceTo, int ProductCategoryID, int Status, int PageIndex, int PageSize, ref int PageCount) { DataTable tbResult = new DataTable(); cProducts objDAL = new cProducts(); tbResult = objDAL.Search_byItemID(ItemView, ItemID,ProductName, PriceFrom, PriceTo, ProductCategoryID, Status, PageIndex, PageSize, ref PageCount); return tbResult; }
public DataTable SearchAll() { DataTable tbResult = new DataTable(); cProducts objDAL = new cProducts(); tbResult = objDAL.SearchAll(); return tbResult; }
public void LoadById(int ID) { cProducts objDAL = new cProducts(); objDAL.LoadByPrimaryKey(ID); ConvertData(objDAL); }