Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 public DataSet GetTopOderNew()
 {
     var objDal = new cProducts();
     DataSet tbResult = objDal.SearchTopOrderNew();
     return tbResult;
 }
Beispiel #4
0
 public DataTable GetProductByCategory(int categoryId)
 {
     var objDal = new cProducts();
     DataTable tbResult = objDal.GetProductByCategoryId(categoryId);
     return tbResult;
 }
Beispiel #5
0
 /**
  * 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;
 }
Beispiel #6
0
        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;
        }
Beispiel #7
0
        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 = ""; }
        }
Beispiel #8
0
        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;
        }
Beispiel #9
0
 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;
 }
Beispiel #10
0
 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;
 }
Beispiel #11
0
 public DataTable SearchAll()
 {
     DataTable tbResult = new DataTable();
     cProducts objDAL = new cProducts();
     tbResult = objDAL.SearchAll();
     return tbResult;
 }
Beispiel #12
0
 public void LoadById(int ID)
 {
     cProducts objDAL = new cProducts();
     objDAL.LoadByPrimaryKey(ID);
     ConvertData(objDAL);
 }