Ejemplo n.º 1
0
        public virtual IList <ProductTypeExtendInfo> GetProductTypeExtends(int ProductType_ID)
        {
            IList <ProductTypeExtendInfo> entitys = null;
            ProductTypeExtendInfo         entity  = null;
            SqlDataReader RdrList = null;

            try
            {
                string SqlList;
                SqlList = "select * from ProductType_Extend where ProductType_Extend_ProductTypeID=" + ProductType_ID + " order by ProductType_Extend_Sort";
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.HasRows)
                {
                    entitys = new List <ProductTypeExtendInfo>();
                    while (RdrList.Read())
                    {
                        entity = new ProductTypeExtendInfo();
                        entity.ProductType_Extend_ID            = Tools.NullInt(RdrList["ProductType_Extend_ID"]);
                        entity.ProductType_Extend_ProductTypeID = Tools.NullInt(RdrList["ProductType_Extend_ProductTypeID"]);
                        entity.ProductType_Extend_Name          = Tools.NullStr(RdrList["ProductType_Extend_Name"]);
                        entity.ProductType_Extend_Display       = Tools.NullStr(RdrList["ProductType_Extend_Display"]);
                        entity.ProductType_Extend_IsSearch      = Tools.NullInt(RdrList["ProductType_Extend_IsSearch"]);
                        entity.ProductType_Extend_Options       = Tools.NullInt(RdrList["ProductType_Extend_Options"]);
                        entity.ProductType_Extend_Default       = Tools.NullStr(RdrList["ProductType_Extend_Default"]);
                        entity.ProductType_Extend_IsActive      = Tools.NullInt(RdrList["ProductType_Extend_IsActive"]);
                        entity.ProductType_Extend_Gather        = Tools.NullInt(RdrList["ProductType_Extend_Gather"]);
                        entity.ProductType_Extend_DisplayForm   = Tools.NullInt(RdrList["ProductType_Extend_DisplayForm"]);
                        entity.ProductType_Extend_Sort          = Tools.NullInt(RdrList["ProductType_Extend_Sort"]);
                        entity.ProductType_Extend_Site          = Tools.NullStr(RdrList["ProductType_Extend_Site"]);

                        entitys.Add(entity);
                        entity = null;
                    }
                }
                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
Ejemplo n.º 2
0
        public virtual bool EditProductTypeExtend(ProductTypeExtendInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT * FROM ProductType_Extend WHERE ProductType_Extend_ID = " + entity.ProductType_Extend_ID;
            DtAdd  = DBHelper.Query(SqlAdd);
            try
            {
                if (DtAdd.Rows.Count > 0)
                {
                    DrAdd = DtAdd.Rows[0];
                    DrAdd["ProductType_Extend_ID"]            = entity.ProductType_Extend_ID;
                    DrAdd["ProductType_Extend_ProductTypeID"] = entity.ProductType_Extend_ProductTypeID;
                    DrAdd["ProductType_Extend_Name"]          = entity.ProductType_Extend_Name;
                    DrAdd["ProductType_Extend_Display"]       = entity.ProductType_Extend_Display;
                    DrAdd["ProductType_Extend_IsSearch"]      = entity.ProductType_Extend_IsSearch;
                    DrAdd["ProductType_Extend_Options"]       = entity.ProductType_Extend_Options;
                    DrAdd["ProductType_Extend_Default"]       = entity.ProductType_Extend_Default;
                    DrAdd["ProductType_Extend_IsActive"]      = entity.ProductType_Extend_IsActive;
                    DrAdd["ProductType_Extend_Gather"]        = entity.ProductType_Extend_Gather;
                    DrAdd["ProductType_Extend_DisplayForm"]   = entity.ProductType_Extend_DisplayForm;
                    DrAdd["ProductType_Extend_Sort"]          = entity.ProductType_Extend_Sort;
                    DrAdd["ProductType_Extend_Site"]          = entity.ProductType_Extend_Site;

                    DBHelper.SaveChanges(SqlAdd, DtAdd);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
            return(true);
        }
Ejemplo n.º 3
0
        public virtual ProductTypeExtendInfo GetProductTypeExtendByID(int ProductType_Extend_ID)
        {
            ProductTypeExtendInfo entity  = null;
            SqlDataReader         RdrList = null;

            try
            {
                string SqlList;
                SqlList = "SELECT * FROM ProductType_Extend WHERE ProductType_Extend_ID = " + ProductType_Extend_ID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.Read())
                {
                    entity = new ProductTypeExtendInfo();

                    entity.ProductType_Extend_ID            = Tools.NullInt(RdrList["ProductType_Extend_ID"]);
                    entity.ProductType_Extend_ProductTypeID = Tools.NullInt(RdrList["ProductType_Extend_ProductTypeID"]);
                    entity.ProductType_Extend_Name          = Tools.NullStr(RdrList["ProductType_Extend_Name"]);
                    entity.ProductType_Extend_Display       = Tools.NullStr(RdrList["ProductType_Extend_Display"]);
                    entity.ProductType_Extend_IsSearch      = Tools.NullInt(RdrList["ProductType_Extend_IsSearch"]);
                    entity.ProductType_Extend_Options       = Tools.NullInt(RdrList["ProductType_Extend_Options"]);
                    entity.ProductType_Extend_Default       = Tools.NullStr(RdrList["ProductType_Extend_Default"]);
                    entity.ProductType_Extend_IsActive      = Tools.NullInt(RdrList["ProductType_Extend_IsActive"]);
                    entity.ProductType_Extend_Gather        = Tools.NullInt(RdrList["ProductType_Extend_Gather"]);
                    entity.ProductType_Extend_DisplayForm   = Tools.NullInt(RdrList["ProductType_Extend_DisplayForm"]);
                    entity.ProductType_Extend_Sort          = Tools.NullInt(RdrList["ProductType_Extend_Sort"]);
                    entity.ProductType_Extend_Site          = Tools.NullStr(RdrList["ProductType_Extend_Site"]);
                }

                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
Ejemplo n.º 4
0
        public virtual bool AddProductTypeExtend(ProductTypeExtendInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

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

            DrAdd["ProductType_Extend_ID"]            = entity.ProductType_Extend_ID;
            DrAdd["ProductType_Extend_ProductTypeID"] = entity.ProductType_Extend_ProductTypeID;
            DrAdd["ProductType_Extend_Name"]          = entity.ProductType_Extend_Name;
            DrAdd["ProductType_Extend_Display"]       = entity.ProductType_Extend_Display;
            DrAdd["ProductType_Extend_IsSearch"]      = entity.ProductType_Extend_IsSearch;
            DrAdd["ProductType_Extend_Options"]       = entity.ProductType_Extend_Options;
            DrAdd["ProductType_Extend_Default"]       = entity.ProductType_Extend_Default;
            DrAdd["ProductType_Extend_IsActive"]      = entity.ProductType_Extend_IsActive;
            DrAdd["ProductType_Extend_Gather"]        = entity.ProductType_Extend_Gather;
            DrAdd["ProductType_Extend_DisplayForm"]   = entity.ProductType_Extend_DisplayForm;
            DrAdd["ProductType_Extend_Sort"]          = entity.ProductType_Extend_Sort;
            DrAdd["ProductType_Extend_Site"]          = entity.ProductType_Extend_Site;

            DtAdd.Rows.Add(DrAdd);
            try
            {
                DBHelper.SaveChanges(SqlAdd, DtAdd);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
        }
Ejemplo n.º 5
0
 public virtual bool EditProductTypeExtend(ProductTypeExtendInfo entity)
 {
     return(MyDAL.EditProductTypeExtend(entity));
 }
Ejemplo n.º 6
0
    //添加商品类型扩展属性
    public void AddProductTypeExtend()
    {
        int    ProductType_Extend_ID            = tools.CheckInt(Request.Form["ProductType_Extend_ID"]);
        int    ProductType_Extend_ProductTypeID = tools.CheckInt(Request.Form["ProductType_ID"]);
        string ProductType_Extend_Name          = tools.CheckStr(Request.Form["ProductTypeExtend_Name"]);
        string ProductType_Extend_Display       = tools.CheckStr(Request.Form["ProductTypeExtend_Display"]);
        int    ProductType_Extend_IsSearch      = tools.CheckInt(Request.Form["ProductType_Extend_IsSearch"]);
        int    ProductType_Extend_Options       = tools.CheckInt(Request.Form["ProductTypeExtend_Options"]);
        string ProductType_Extend_Default       = tools.Left(tools.CheckStr(Request.Form["ProductTypeExtend_Default"]), 500);
        int    ProductType_Extend_IsActive      = tools.CheckInt(Request.Form["ProductTypeExtend_IsActive"]);
        int    ProductType_Extend_Gather        = tools.CheckInt(Request.Form["ProductType_Extend_Gather"]);
        int    ProductType_Extend_DisplayForm   = tools.CheckInt(Request.Form["ProductType_Extend_DisplayForm"]);
        int    ProductType_Extend_Sort          = tools.CheckInt(Request.Form["ProductTypeExtend_Sort"]);
        string ProductType_Extend_Site          = Public.GetCurrentSite();

        switch (ProductType_Extend_Display)
        {
        case "0":
            ProductType_Extend_Display = "select";
            break;

        case "1":
            ProductType_Extend_Display = "Text";
            break;

        case "2":
            ProductType_Extend_Display = "html";
            break;
        }

        if (ProductType_Extend_ProductTypeID == 0)
        {
            Public.Msg("error", "错误信息", "请选择产品类型!", false, "{back}");
        }
        if (ProductType_Extend_Name == "")
        {
            Public.Msg("error", "错误信息", "请输入属性名称!", false, "{back}");
        }

        ProductTypeExtendInfo entity = new ProductTypeExtendInfo();

        entity.ProductType_Extend_ID            = ProductType_Extend_ID;
        entity.ProductType_Extend_ProductTypeID = ProductType_Extend_ProductTypeID;
        entity.ProductType_Extend_Name          = ProductType_Extend_Name;
        entity.ProductType_Extend_Display       = ProductType_Extend_Display;
        entity.ProductType_Extend_IsSearch      = ProductType_Extend_IsSearch;
        entity.ProductType_Extend_Options       = ProductType_Extend_Options;
        entity.ProductType_Extend_Default       = ProductType_Extend_Default;
        entity.ProductType_Extend_IsActive      = ProductType_Extend_IsActive;
        entity.ProductType_Extend_Gather        = ProductType_Extend_Gather;
        entity.ProductType_Extend_DisplayForm   = ProductType_Extend_DisplayForm;
        entity.ProductType_Extend_Sort          = ProductType_Extend_Sort;
        entity.ProductType_Extend_Site          = ProductType_Extend_Site;

        if (MyBLL.AddProductTypeExtend(entity))
        {
            Public.Msg("positive", "操作成功", "操作成功", true, "ProductTypeExtend_Add.aspx?producttype_id=" + ProductType_Extend_ProductTypeID);
        }
        else
        {
            Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}");
        }
    }