Beispiel #1
0
        public virtual bool EditSupplierProductCategory(SupplierProductCategoryInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT * FROM Supplier_Product_Category WHERE Supplier_Product_Cate_ID = " + entity.Supplier_Product_Cate_ID;
            DtAdd  = DBHelper.Query(SqlAdd);
            try
            {
                if (DtAdd.Rows.Count > 0)
                {
                    DrAdd = DtAdd.Rows[0];
                    DrAdd["Supplier_Product_Cate_ID"]        = entity.Supplier_Product_Cate_ID;
                    DrAdd["Supplier_Product_Cate_CateID"]    = entity.Supplier_Product_Cate_CateID;
                    DrAdd["Supplier_Product_Cate_ProductID"] = entity.Supplier_Product_Cate_ProductID;

                    DBHelper.SaveChanges(SqlAdd, DtAdd);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
            return(true);
        }
Beispiel #2
0
        public virtual bool AddSupplierProductCategory(SupplierProductCategoryInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT TOP 0 * FROM Supplier_Product_Category";
            DtAdd  = DBHelper.Query(SqlAdd);
            DrAdd  = DtAdd.NewRow();

            DrAdd["Supplier_Product_Cate_ID"]        = entity.Supplier_Product_Cate_ID;
            DrAdd["Supplier_Product_Cate_CateID"]    = entity.Supplier_Product_Cate_CateID;
            DrAdd["Supplier_Product_Cate_ProductID"] = entity.Supplier_Product_Cate_ProductID;

            DtAdd.Rows.Add(DrAdd);
            try
            {
                DBHelper.SaveChanges(SqlAdd, DtAdd);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 根据店铺产品分组编号获取相关产品
        /// </summary>
        /// <param name="Product_ID">店铺产品分组编号</param>
        /// <returns>产品/产品分组关系</returns>
        public virtual IList <SupplierProductCategoryInfo> GetSupplierProductCategorysByCateID(int Cate_ID)
        {
            IList <SupplierProductCategoryInfo> entitys = null;
            SupplierProductCategoryInfo         entity  = null;
            string        SqlList;
            SqlDataReader RdrList = null;

            try
            {
                SqlList = "SELECT * FROM Supplier_Product_Category WHERE Supplier_Product_Cate_CateID = " + Cate_ID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.HasRows)
                {
                    entitys = new List <SupplierProductCategoryInfo>();
                    while (RdrList.Read())
                    {
                        entity = new SupplierProductCategoryInfo();
                        entity.Supplier_Product_Cate_ID        = Tools.NullInt(RdrList["Supplier_Product_Cate_ID"]);
                        entity.Supplier_Product_Cate_CateID    = Tools.NullInt(RdrList["Supplier_Product_Cate_CateID"]);
                        entity.Supplier_Product_Cate_ProductID = Tools.NullInt(RdrList["Supplier_Product_Cate_ProductID"]);

                        entitys.Add(entity);
                        entity = null;
                    }
                }
                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
Beispiel #4
0
 public virtual bool EditSupplierProductCategory(SupplierProductCategoryInfo entity)
 {
     return(MyDAL.EditSupplierProductCategory(entity));
 }