Exemplo n.º 1
0
 /// <summary>
 /// 根据主键获取一个ClassesFound实体记录。
 /// 该方法提供给其他实体的业务逻辑层(Logic)方法调用
 /// </summary>
 /// <returns>ClassesFound实体</returns>
 /// <param name="columns">要返回的列</param>
 public ClassesFoundEntity GetClassesFound(int id, bool iscache = false)
 {
     if (iscache)
     {
         string             _cachekey = "ClassesFound_" + id.ToString();// SysCacheKey.ClassesFoundListKey;
         object             _objcache = MemCache.GetCache(_cachekey);
         ClassesFoundEntity _obj      = new ClassesFoundEntity();
         if (_objcache == null)
         {
             _obj = ClassesFoundDA.Instance.GetClassesFound(id);
             MemCache.AddCache(_cachekey, _obj);
         }
         else
         {
             _obj = (ClassesFoundEntity)_objcache;
         }
         return(_obj);
     }
     else if (iscache == false)
     {
         return(ClassesFoundDA.Instance.GetClassesFound(id));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 根据主键值更新记录的全部字段(注意:该方法不会对自增字段、timestamp类型字段以及主键字段更新!如果要更新主键字段,请使用Update方法)。
        /// 如果数据库有数据被更新了则返回True,否则返回False
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="classesFound">待更新的实体对象</param>
        public int UpdateClassesFound(ClassesFoundEntity entity)
        {
            string    sql = @" UPDATE dbo.[ClassesFound] SET
                       [Code]=@Code,[Name]=@Name,[FullName]=@FullName,[PYFirst]=@PYFirst,[PYShort]=@PYShort,[PYFull]=@PYFull,[AdId]=@AdId,[Sort]=@Sort,[IsActive]=@IsActive,[IsHot]=@IsHot,[CreateTime]=@CreateTime,[UpdateTime]=@UpdateTime,[ClassLevel]=@ClassLevel,[IsEnd]=@IsEnd,[HasProperties]=@HasProperties, [ParentId]=@ParentId, [ClassType]=@ClassType 
                       WHERE [Id]=@id";
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id);
            db.AddInParameter(cmd, "@Code", DbType.String, entity.Code);
            db.AddInParameter(cmd, "@Name", DbType.String, entity.Name);
            db.AddInParameter(cmd, "@FullName", DbType.String, entity.FullName);
            db.AddInParameter(cmd, "@PYFirst", DbType.String, entity.PYFirst);
            db.AddInParameter(cmd, "@PYShort", DbType.String, entity.PYShort);
            db.AddInParameter(cmd, "@PYFull", DbType.String, entity.PYFull);
            db.AddInParameter(cmd, "@AdId", DbType.Int32, entity.AdId);
            db.AddInParameter(cmd, "@Sort", DbType.Int32, entity.Sort);
            db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive);
            db.AddInParameter(cmd, "@IsHot", DbType.Int32, entity.IsHot);
            db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
            db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
            db.AddInParameter(cmd, "@ClassLevel", DbType.Int32, entity.ClassLevel);
            db.AddInParameter(cmd, "@IsEnd", DbType.Int32, entity.IsEnd);
            db.AddInParameter(cmd, "@ParentId", DbType.Int32, entity.ParentId);
            db.AddInParameter(cmd, "@HasProperties", DbType.Int32, entity.HasProperties);
            db.AddInParameter(cmd, "@PropertiesClassId", DbType.Int32, entity.PropertiesClassId);
            db.AddInParameter(cmd, "@HasProduct", DbType.Int32, entity.HasProduct);
            db.AddInParameter(cmd, "@ClassType", DbType.Int32, entity.ClassType);

            return(db.ExecuteNonQuery(cmd));
        }
Exemplo n.º 3
0
        public ActionResult Search()
        {
            int classid   = QueryString.IntSafeQ("cl");
            int brandid   = QueryString.IntSafeQ("bd");
            int siteid    = QueryString.IntSafeQ("s");
            int pageindex = QueryString.IntSafeQ("pi");
            int jishi     = QueryString.IntSafeQ("js", -1);

            if (jishi == -1)
            {
                jishi = (int)JiShiSongEnum.Normal;
            }
            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                ViewBag.SelectClassName = _classentity.Name;
                ViewBag.SelectClassId   = classid;
            }
            if (brandid > 0)
            {
                BrandEntity brand = BrandBLL.Instance.GetBrand(brandid, true);
                ViewBag.SelectBrandName = brand.Name;
                ViewBag.SelectBrandId   = brandid;
            }

            if (pageindex < 1)
            {
                pageindex = 1;
            }
            int    pagesize = CommonKey.PageSizeList;
            string querykey = QueryString.SafeQ("key");

            return(View());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 分类品牌管理
        /// </summary>
        /// <returns></returns>
        public ActionResult ClassBrandManage()
        {
            int _classid = QueryString.IntSafeQ("classid", 0);
            ClassesFoundEntity entity = ClassesFoundBLL.Instance.GetClassesFound(_classid, false);

            int _pageindex   = QueryString.IntSafeQ("pageindex", 1);
            int _pagesize    = CommonKey.PageSizeBrand;
            int _recordCount = 0;

            IList <ConditionUnit> wherelist = new List <ConditionUnit>();

            wherelist.Add(new ConditionUnit {
                FieldName = "ClassId", CompareValue = _classid.ToString()
            });

            IList <ClassBrandEntity> entitylist = ClassBrandBLL.Instance.GetClassBrandList(_pagesize, _pageindex, ref _recordCount, wherelist);

            ViewBag.entitylist = entitylist;
            string _url = "/Class/ClassBrandManage?classid=" + _classid;

            string PageStr = HTMLPage.SetOrderListPage(_recordCount, _pagesize, _pageindex, _url);

            ViewBag.PageStr = PageStr;
            ViewBag.entity  = entity;
            return(View());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <ClassesFoundEntity> GetClassesFoundAll()
        {
            string sql = @"SELECT    [Id],[Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[HasSpecific],[SpecificTitle],[ParentId],[StyleEnd],[HasProduct] from dbo.[ClassesFound] WITH(NOLOCK)	";
            IList <ClassesFoundEntity> entityList = new List <ClassesFoundEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ClassesFoundEntity entity = new ClassesFoundEntity();
                    entity.Id            = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code          = StringUtils.GetDbString(reader["Code"]);
                    entity.Name          = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst       = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort       = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull        = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId          = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort          = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive      = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot         = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime    = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime    = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel    = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd         = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.ParentId      = StringUtils.GetDbInt(reader["ParentId"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 判断当前节点是否已存在相同的
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int ExistNum(ClassesFoundEntity entity)
        {
            ///id=0,判断总数,ID>0判断除自己之外的总数
            string sql = @"Select count(1) from dbo.[ClassesFound] WITH(NOLOCK) ";

            string where = "where ";
            if (entity.Id == 0)
            {
                where = where + "  (Name=@Name) ";
            }
            else
            {
                where = where + " id<>@Id and  (Name=@Name) ";
            }
            sql = sql + where;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            if (entity.Id > 0)
            {
                db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id);
            }

            db.AddInParameter(cmd, "@Name", DbType.String, entity.Name);
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
Exemplo n.º 7
0
        public List <int> GetSubClassEndList(int classid, bool cache = false)
        {
            List <int> _listint = new List <int>();

            if (cache == false)
            {
                ClassesFoundEntity _entity = GetClassesFound(classid, cache);
                int redirectclassid        = _entity.RedirectClassId;
                if (redirectclassid == 0)
                {
                    redirectclassid = _entity.Id;
                }
                _listint.Add(redirectclassid);
                if (_entity.IsEnd == 0 && redirectclassid > 0)
                {
                    IList <ClassesFoundEntity> _entitylist2 = GetClassesAllByPId(redirectclassid, cache, -1);
                    if (_entitylist2 != null && _entitylist2.Count > 0)
                    {
                        foreach (ClassesFoundEntity _entity2 in _entitylist2)
                        {
                            List <int> listsub = GetSubClassEndList(_entity2.Id, cache);
                            _listint.AddRange(listsub);
                        }
                    }
                }
            }
            else
            {
                string _cachekey = "GetSubClassEndList_" + classid;
                object obj       = MemCache.GetCache(_cachekey);
                if (obj == null)
                {
                    ClassesFoundEntity _entity = GetClassesFound(classid, false);
                    int redirectclassid        = _entity.RedirectClassId;
                    if (redirectclassid == 0)
                    {
                        redirectclassid = _entity.Id;
                    }
                    _listint.Add(redirectclassid);
                    if (_entity.IsEnd == 0 && redirectclassid > 0)
                    {
                        IList <ClassesFoundEntity> _entitylist2 = GetClassesAllByPId(redirectclassid, false, -1);
                        if (_entitylist2 != null && _entitylist2.Count > 0)
                        {
                            foreach (ClassesFoundEntity _entity2 in _entitylist2)
                            {
                                List <int> listsub = GetSubClassEndList(_entity2.Id);
                                _listint.AddRange(listsub);
                            }
                        }
                    }
                }
                else
                {
                    _listint = (List <int>)obj;
                }
            }

            return(_listint);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 特价商品列表
        /// </summary>
        /// <returns></returns>

        private IList <ClassesFoundEntity> ListRavStr(ClassesFoundEntity _classentity)
        {
            IList <ClassesFoundEntity> list = new List <ClassesFoundEntity>();

            list.Add(_classentity);
            if (_classentity != null)
            {
                if (_classentity.ParentId > 0)
                {
                    ClassesFoundEntity _classentity2 = ClassesFoundBLL.Instance.GetClassesFound(_classentity.ParentId, false);
                    if (_classentity.Name != _classentity2.Name)
                    {
                        list.Add(_classentity2);
                    }
                    if (_classentity2.ParentId > 0)
                    {
                        ClassesFoundEntity _classentity3 = ClassesFoundBLL.Instance.GetClassesFound(_classentity2.ParentId, false);
                        if (_classentity2.Name != _classentity3.Name)
                        {
                            list.Add(_classentity3);
                        }
                        if (_classentity3.ParentId > 0)
                        {
                            ClassesFoundEntity _classentity4 = ClassesFoundBLL.Instance.GetClassesFound(_classentity3.ParentId, false);
                            if (_classentity3.Name != _classentity4.Name)
                            {
                                list.Add(_classentity4);
                            }
                        }
                    }
                }
            }
            return(list);
        }
Exemplo n.º 9
0
        //     /// <summary>
        //     /// 插入一条记录到表ClassesFound,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        //     /// </summary>
        //     /// <param name="db">数据库操作对象</param>
        //     /// <param name="classesFound">待插入的实体对象</param>
        //     public int AddClassesFound(ClassesFoundEntity entity)
        //     {
        //         string sql = @"insert into ClassesFound( [Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[HasSpecific],[SpecificTitle],[ParentId],[StyleEnd],[HasProduct])VALUES
        //            ( @Code,@Name,@PYFirst,@PYShort,@PYFull,@AdId,@Sort,@IsActive,@IsHot,@CreateTime,@UpdateTime,@ClassLevel,@IsEnd,@HasProperties,@HasSpecific,@SpecificTitle,@ParentId,@StyleEnd,@HasProduct);
        //SELECT SCOPE_IDENTITY();";
        //         DbCommand cmd = db.GetSqlStringCommand(sql);

        //         db.AddInParameter(cmd, "@Code", DbType.String, entity.Code);
        //         db.AddInParameter(cmd, "@Name", DbType.String, entity.Name);
        //         db.AddInParameter(cmd, "@PYFirst", DbType.String, entity.PYFirst);
        //         db.AddInParameter(cmd, "@PYShort", DbType.String, entity.PYShort);
        //         db.AddInParameter(cmd, "@PYFull", DbType.String, entity.PYFull);
        //         db.AddInParameter(cmd, "@AdId", DbType.Int32, entity.AdId);
        //         db.AddInParameter(cmd, "@Sort", DbType.Int32, entity.Sort);
        //         db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive);
        //         db.AddInParameter(cmd, "@IsHot", DbType.Int32, entity.IsHot);
        //         db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
        //         db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
        //         db.AddInParameter(cmd, "@ClassLevel", DbType.Int32, entity.ClassLevel);
        //         db.AddInParameter(cmd, "@IsEnd", DbType.Int32, entity.IsEnd);
        //         db.AddInParameter(cmd, "@HasProperties", DbType.Int32, entity.HasProperties);
        //         db.AddInParameter(cmd, "@ParentId", DbType.Int32, entity.ParentId);
        //         object identity = db.ExecuteScalar(cmd);
        //         if (identity == null || identity == DBNull.Value) return 0;
        //         return Convert.ToInt32(identity);
        //     }

        /// <summary>
        /// 插入一条记录到表ClassesFound,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="classesFound">待插入的实体对象</param>
        public int AddClassesFound(ClassesFoundEntity entity)
        {
            string    sql = @"insert into ClassesFound( [Code],[Name],[FullName],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[ParentId],[HasProperties],[PropertiesClassId],[HasProduct],[SiteId],ClassType)VALUES
			            ( @Code,@Name,@FullName,@PYFirst,@PYShort,@PYFull,@AdId,@Sort,@IsActive,@IsHot,@CreateTime,@UpdateTime,@ClassLevel,@IsEnd,@ParentId,@HasProperties,@PropertiesClassId,@HasProduct,@SiteId,@ClassType);
			SELECT SCOPE_IDENTITY();"            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Code", DbType.String, entity.Code);
            db.AddInParameter(cmd, "@Name", DbType.String, entity.Name);
            db.AddInParameter(cmd, "@FullName", DbType.String, entity.FullName);
            db.AddInParameter(cmd, "@PYFirst", DbType.String, entity.PYFirst);
            db.AddInParameter(cmd, "@PYShort", DbType.String, entity.PYShort);
            db.AddInParameter(cmd, "@PYFull", DbType.String, entity.PYFull);
            db.AddInParameter(cmd, "@AdId", DbType.Int32, entity.AdId);
            db.AddInParameter(cmd, "@Sort", DbType.Int32, entity.Sort);
            db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive);
            db.AddInParameter(cmd, "@IsHot", DbType.Int32, entity.IsHot);
            db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
            db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
            db.AddInParameter(cmd, "@ClassLevel", DbType.Int32, entity.ClassLevel);
            db.AddInParameter(cmd, "@IsEnd", DbType.Int32, entity.IsEnd);
            db.AddInParameter(cmd, "@ParentId", DbType.Int32, entity.ParentId);
            db.AddInParameter(cmd, "@HasProperties", DbType.Int32, entity.HasProperties);
            db.AddInParameter(cmd, "@PropertiesClassId", DbType.Int32, entity.PropertiesClassId);
            db.AddInParameter(cmd, "@HasProduct", DbType.Int32, entity.HasProduct);
            db.AddInParameter(cmd, "@SiteId", DbType.Int32, entity.SiteId);
            db.AddInParameter(cmd, "@ClassType", DbType.Int32, entity.ClassType);
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
Exemplo n.º 10
0
        public IList <ClassesFoundEntity> GetClassesAllByBrandId(int siteid, int brandid)
        {
            string where = " where  a.BrandId=@BrandId ";
            if (siteid > 0)
            {
                where += " and b.SiteId=@SiteId ";
            }
            string sql = @" SELECT b.[Id],[Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],b.[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[ParentId],PropertiesClassId,HasProduct,ClassType
                            from ClassBrand a  WITH(NOLOCK)	 inner join  dbo.[ClassesFound] b WITH(NOLOCK) ON a.ClassId=b.Id  "     + where;
            IList <ClassesFoundEntity> entityList = new List <ClassesFoundEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            if (brandid != -1)
            {
                db.AddInParameter(cmd, "@BrandId", DbType.Int32, brandid);
            }
            if (siteid > 0)
            {
                db.AddInParameter(cmd, "@SiteId", DbType.Int32, siteid);
            }
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ClassesFoundEntity entity = new ClassesFoundEntity();
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code              = StringUtils.GetDbString(reader["Code"]);
                    entity.Name              = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst           = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort           = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull            = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId              = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort              = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive          = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot             = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime        = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime        = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel        = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd             = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties     = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.PropertiesClassId = StringUtils.GetDbInt(reader["PropertiesClassId"]);
                    entity.HasProduct        = StringUtils.GetDbInt(reader["HasProduct"]);
                    entity.ParentId          = StringUtils.GetDbInt(reader["ParentId"]);
                    entity.ClassType         = StringUtils.GetDbInt(reader["ClassType"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 分类信息修改
        /// </summary>
        /// <returns></returns>
        public int ClassInfoUpdate()
        {
            int _id = FormString.IntSafeQ("id");

            int    _adid               = FormString.IntSafeQ("adid");
            int    _ishot              = FormString.IntSafeQ("ishot");
            int    _isactive           = FormString.IntSafeQ("isactive");
            int    _sort               = FormString.IntSafeQ("sort");
            int    _hasproduct         = FormString.IntSafeQ("hasproduct");
            int    _productnum         = FormString.IntSafeQ("productnum");
            int    _hasproperty        = FormString.IntSafeQ("hasproperty");
            int    _haspropertyclassid = FormString.IntSafeQ("haspropertyclassid");
            string _code               = FormString.SafeQ("code");
            string _name               = FormString.SafeQ("name");
            int    _classtype          = FormString.IntSafeQ("classtype");
            string _fullname           = FormString.SafeQ("fullname");
            string _pyshort            = FormString.SafeQ("pyshort");
            string _pyfull             = FormString.SafeQ("pyfull");

            ClassesFoundEntity entity = ClassesFoundBLL.Instance.GetClassesFound(_id, false);

            entity.AdId              = _adid;
            entity.IsHot             = _ishot;
            entity.IsActive          = _isactive;
            entity.Sort              = _sort;
            entity.HasProduct        = _hasproduct;
            entity.ClassType         = _productnum;
            entity.HasProperties     = _hasproperty;
            entity.PropertiesClassId = _haspropertyclassid;
            entity.Code              = _code;
            entity.Name              = _name;
            entity.FullName          = _fullname;
            entity.ClassType         = _classtype;
            entity.PYShort           = _pyshort;
            entity.PYFull            = _pyfull;

            entity.UpdateTime = DateTime.Now;

            int _result = ClassesFoundBLL.Instance.UpdateClassesFound(entity);

            return(_result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 插入一条记录到表ClassesFound,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。
        /// 该方法提供给界面等UI层调用
        /// </summary>
        /// <param name="classesFound">要添加的ClassesFound数据实体对象</param>
        public int AddClassesFound(ClassesFoundEntity classesFound)
        {
            if (classesFound.Id > 0)
            {
                return(UpdateClassesFound(classesFound));
            }
            else if (string.IsNullOrEmpty(classesFound.Name))
            {
                return((int)CommonStatus.ADD_Fail_Empty);
            }

            else if (ClassesFoundBLL.Instance.IsExist(classesFound))
            {
                return((int)CommonStatus.ADD_Fail_Exist);
            }
            else
            {
                return(ClassesFoundDA.Instance.AddClassesFound(classesFound));
            }
        }
Exemplo n.º 13
0
        public IList <BrandEntity> GetBrandByKey(int classid, int pid, string key)
        {
            string classidstr = "";

            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);

                IList <int> classintlist = new List <int>();
                if (_classentity.RedirectClassId > 0)
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(_classentity.RedirectClassId);
                }
                else
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(classid);
                }
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            string _cachekey         = "GetBrandByKey_" + classid.ToString() + "_" + pid.ToString() + "_" + key;
            object _objcache         = MemCache.GetCache(_cachekey);//依据键获取值
            IList <BrandEntity> _obj = new List <BrandEntity>();

            if (_objcache == null)
            {
                _obj = BrandDA.Instance.GetBrandByKey(classidstr, pid, key);
                MemCache.AddCache(_cachekey, _obj);
            }
            else
            {
                _obj = (IList <BrandEntity>)_objcache;
            }
            return(_obj);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 分类编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult ClassEdit()
        {
            string             _op       = QueryString.SafeQ("op");
            int                _id       = QueryString.IntSafeQ("id");
            int                _parentid = QueryString.IntSafeQ("parentid");
            int                _siteid   = QueryString.IntSafeQ("siteid");
            ClassesFoundEntity entity    = new ClassesFoundEntity();

            if (_op == "add")
            {
                entity.ParentId = _parentid;
                entity.SiteId   = _siteid;
            }
            else
            {
                entity = ClassesFoundBLL.Instance.GetClassesFound(_id, false);
            }
            ViewBag.op     = _op;
            ViewBag.entity = entity;
            return(View());
        }
Exemplo n.º 15
0
        /// <summary>
        /// 根据主键值读取记录。如果数据库不存在这条数据将返回null
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public ClassesFoundEntity GetClassesFound(int id)
        {
            string    sql = @"SELECT  [Id],[Code],[FullName],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[HasProduct],PropertiesClassId, [ParentId],
RedirectClassId,ClassType,SiteId  FROM dbo.[ClassesFound] WITH(NOLOCK)	 WHERE [Id]=@Id";
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Id", DbType.Int32, id);
            ClassesFoundEntity entity = new ClassesFoundEntity();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code              = StringUtils.GetDbString(reader["Code"]);
                    entity.FullName          = StringUtils.GetDbString(reader["FullName"]);
                    entity.Name              = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst           = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort           = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull            = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId              = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort              = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive          = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot             = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime        = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime        = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel        = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd             = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties     = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.HasProduct        = StringUtils.GetDbInt(reader["HasProduct"]);
                    entity.PropertiesClassId = StringUtils.GetDbInt(reader["PropertiesClassId"]);

                    entity.ClassType       = StringUtils.GetDbInt(reader["ClassType"]);
                    entity.ParentId        = StringUtils.GetDbInt(reader["ParentId"]);
                    entity.RedirectClassId = StringUtils.GetDbInt(reader["RedirectClassId"]);
                    entity.SiteId          = StringUtils.GetDbInt(reader["SiteId"]);
                }
            }
            return(entity);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 产品编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductEdit()
        {
            //判断是否是修改
            int productid = QueryString.IntSafeQ("productid");
            int siteid    = QueryString.IntSafeQ("siteid");

            if (siteid == 0 && productid == 0)
            {
                return(Redirect(SuperMarketWebUrl.GetSysSelectSiteIdUrl()));
            }
            int             classid          = 0;
            int             brandid          = 0;
            VWProductEntity _vwproductentity = new VWProductEntity();

            if (productid > 0)
            {
                _vwproductentity                  = ProductBLL.Instance.GetProductVW(productid);
                _vwproductentity.ProductPics      = ProductStylePicsBLL.Instance.GetListPicsByProductId(productid); //获取样式图片列表
                _vwproductentity.ProductPropertys = ProductPropertyBLL.Instance.GetListByProductId(productid);      //获取样式属性列表
                ProductBLL.Instance.Assignment(ref _vwproductentity, productid);
                classid = _vwproductentity.ClassId;
                brandid = _vwproductentity.BrandId;
                siteid  = _vwproductentity.SiteId;
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);
                BrandEntity        _brandntity  = BrandBLL.Instance.GetBrand(brandid, false);
            }
            else
            {
                classid = QueryString.IntSafeQ("classid");
                brandid = QueryString.IntSafeQ("brandid");
            }


            ViewBag.SiteId  = siteid;
            ViewBag.Product = _vwproductentity;
            ViewBag.MemId   = memid;
            return(View());
        }
        /// <summary>
        /// 分类编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult ClassEdit()
        {
            int _pid = QueryString.IntSafeQ("pid");
            int _id  = QueryString.IntSafeQ("id");
            ClassesFoundEntity entity  = new ClassesFoundEntity();
            ClassesFoundEntity pentity = new ClassesFoundEntity();

            if (_id > 0)
            {
                entity = ClassesFoundBLL.Instance.GetClassesFound(_id, false);
            }
            if (entity.ParentId > 0)
            {
                pentity = ClassesFoundBLL.Instance.GetClassesFound(entity.ParentId, false);
            }
            else if (_pid > 0)
            {
                pentity = ClassesFoundBLL.Instance.GetClassesFound(_pid, false);
            }
            ViewBag.Entity       = entity;
            ViewBag.ParentEntity = entity;
            return(View());
        }
Exemplo n.º 18
0
        /// <summary>
        /// 分类信息删除
        /// </summary>
        /// <returns></returns>
        public int ClassDelete()
        {
            int _id = FormString.IntSafeQ("id");
            ClassesFoundEntity entity = ClassesFoundBLL.Instance.GetClassesFound(_id, false);
            int _result = 0;

            if (entity.ClassLevel == 3)                                          //叶子节点直接删除
            {
                _result = ClassesFoundBLL.Instance.DeleteClassesFoundByKey(_id); //删除三级节点
            }
            else if (entity.ClassLevel == 2)                                     //非叶子节点级联删除
            {
                _result = ClassesFoundBLL.Instance.DeleteClassesFoundByKey(_id); //删除二级节点
                if (_result > 0)
                {
                    _result = ClassesFoundBLL.Instance.DeleteClassesFoundByParentId(_id);//删除三级节点
                }
            }
            else if (entity.ClassLevel == 1)                                     //非叶子节点级联删除
            {
                _result = ClassesFoundBLL.Instance.DeleteClassesFoundByKey(_id); //删除一级节点
                if (_result > 0)
                {
                    IList <ClassesFoundEntity> entitylist = ClassesFoundBLL.Instance.GetClassesAllByPId(_id, false, -1);
                    if (entitylist != null && entitylist.Count > 0)
                    {
                        foreach (ClassesFoundEntity item in entitylist)
                        {
                            _result = ClassesFoundBLL.Instance.DeleteClassesFoundByKey(item.Id);      //删除二级节点
                            _result = ClassesFoundBLL.Instance.DeleteClassesFoundByParentId(item.Id); //删除三级节点
                        }
                    }
                }
            }
            return(_result);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 常规商品列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            string title   = "易店心,";
            string _key    = QueryString.SafeQ("key");
            int    classid = QueryString.IntSafeQ("cid");
            int    brandid = QueryString.IntSafeQ("bd");
            int    order_i = QueryString.IntSafeQ("px");//排序类型
            //if (classid == 0) { return Redirect("/");  }
            int siteid = QueryString.IntSafeQ("s");

            if (siteid <= 0)
            {
                siteid = (int)SiteIdEnum.BathRoom;
            }
            ViewBag.SiteId = siteid;
            ///获取已选择的分类属性
            string propertiesstr = QueryString.SafeQ("pp");
            //if (classid == 0) RedirectToAction("Home", "Index");
            ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);

            if (_classentity != null && _classentity.Id > 0)
            {
                title += "类别:" + _classentity.Name + ",";
            }
            ViewBag.ClassId         = classid;
            ViewBag.SelectClassName = _classentity.Name;
            ViewBag.SiteId          = _classentity.SiteId;
            ViewBag.OrderBy         = order_i;
            ViewBag.ClassEntity     = _classentity;
            ViewBag.BrandId         = brandid;
            int rediclassid = classid;//实际指向分类

            if (rediclassid == -1)
            {
                rediclassid = 0;
            }
            if (_classentity.RedirectClassId > 0)
            {
                rediclassid = _classentity.RedirectClassId;
            }
            siteid = _classentity.SiteId;
            //if(siteid == 0&& rediclassid>0)
            //{
            //    ClassesFoundEntity _classredirectentity = ClassesFoundBLL.Instance.GetClassesFound(rediclassid, false);
            //}
            if (brandid > 0 && classid == 0)
            {
                //获取子集分类
                IList <ClassesFoundEntity> classes = ClassesFoundBLL.Instance.GetClassesAllByBrandId(siteid, brandid, false);
                ViewBag.ClassList = classes;
            }
            else
            {
                //分类导航显示
                if (_classentity.IsEnd == 0)
                {
                    //获取子集分类
                    IList <ClassesFoundEntity> classes = ClassesFoundBLL.Instance.GetClassesAllByPId(rediclassid, false, siteid);
                    ViewBag.ClassList = classes;
                }
            }
            if (classid > 0)
            {
                //ViewBag.RavClassList = ListRavStr(_classentity);
                if (brandid == 0)
                {
                    //获取分类对应品牌
                    IList <BrandEntity> brands = ClassBrandBLL.Instance.GetBrandByClass(rediclassid);
                    ViewBag.BrandList = brands;
                }
                ////获取分类属性
                //IList<ClassPropertiesEntity> _ClassPropertieslist = ClassPropertiesBLL.Instance.GetAllPropertyByClassId(classid);
                //ViewBag.PropertiesList = _ClassPropertieslist;
            }
            if (brandid > 0)
            {
                BrandEntity brand = BrandBLL.Instance.GetBrand(brandid, false);
                ViewBag.SelectBrandName = brand.Name;
                ViewBag.BrandSelect     = brand;
                title += "品牌:" + brand.Name + ",";
            }
            //ViewBag.PropertiesStr = propertiesstr;

            int pageindex = QueryString.IntSafeQ("pageindex");
            int pagesize  = CommonKey.PageSizeList;
            int record    = 0;

            if (pageindex == 0)
            {
                pageindex = 1;
            }
            string classidstr = "";

            if (classid > 0)
            {
                IList <int> classintlist = new List <int>();
                if (_classentity.RedirectClassId > 0)
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(_classentity.RedirectClassId);
                }
                else
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(classid);
                }
                if (classintlist != null && classintlist.Count > 100)
                {
                    classintlist = classintlist.Take(100).ToList <int>();
                }
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else if (_classentity.RedirectClassId > 0)
                {
                    classidstr = StringUtils.GetDbString(_classentity.RedirectClassId);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            else
            {
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndListBySite(siteid);
                if (classintlist != null && classintlist.Count > 100)
                {
                    classintlist = classintlist.Take(100).ToList <int>();
                }

                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else if (_classentity.RedirectClassId > 0)
                {
                    classidstr = StringUtils.GetDbString(_classentity.RedirectClassId);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            IList <VWProductEntity> _productlist = new List <VWProductEntity>();// ProductBLL.Instance.GetProductListProc(pagesize, pageindex, ref record, classidstr, brandid, propertiesstr, order_i,     _key  );

            _productlist = ProductBLL.Instance.GetProductListProc(pagesize, pageindex, ref record, classidstr, brandid, propertiesstr, order_i, _key);

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId     = member.MemId;
                ViewBag.MemStatus = member.Status;
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _entity.TradePrice, _entity.Price, _entity.IsBP, _entity.DealerPrice);
                }
            }
            else
            {
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = 0;
                }
            }
            ViewBag.Title       = title;
            ViewBag.ProductList = _productlist;
            ViewBag.TotalNum    = record;
            //ViewBag.ListShowMethod = (int)ListShowMethodEnum.Normal;
            string url = "/Product/list.html?px=" + order_i + "&cid=" + classid + "&bd=" + brandid + "&pp=" + propertiesstr + "&s=" + siteid + "&ct=0&key=" + _key;

            ViewBag.SiteId = siteid;
            string pagehtml = HTMLPage.SetOrderListPage(record, pagesize, pageindex, url);

            ViewBag.PageHtml = pagehtml;
            int maxpage = record / pagesize;

            if (record % pagesize > 0)
            {
                maxpage = maxpage + 1;
            }
            ViewBag.MaxPageIndex = maxpage;
            return(View());
        }
Exemplo n.º 20
0
 /// <summary>
 /// 更新一条ClassesFound记录。
 /// 该方法提供给界面等UI层调用
 /// </summary>
 /// <param name="classesFound">待更新的实体对象</param>
 /// <param name="columns">要更新的列名,不提供任何列名时默认将更新主键之外的所有列</param>
 public int UpdateClassesFound(ClassesFoundEntity classesFound)
 {
     return(ClassesFoundDA.Instance.UpdateClassesFound(classesFound));
 }
Exemplo n.º 21
0
        /// <summary>
        /// 获取品牌,并按照首字母建立层级结构
        /// </summary>
        /// <param name="classid"></param>
        /// <returns></returns>
        public IList <VWTreeBrandEntity> GetTreeBrandAll(int classid, bool iscache = false)
        {
            IList <VWTreeBrandEntity> resultlist = new List <VWTreeBrandEntity>();

            string _cachekey = "GetTreeBrandAll" + classid;

            if (iscache)
            {
                object obj = MemCache.GetCache(_cachekey);
                if (obj == null)
                {
                    int rediclassid = classid;
                    ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);
                    if (_classentity.RedirectClassId > 0)
                    {
                        rediclassid = _classentity.RedirectClassId;
                    }
                    IList <int> classintlist = new List <int>();
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(rediclassid);
                    string classidstr = "";
                    if (classintlist != null && classintlist.Count > 0)
                    {
                        classidstr = string.Join("_", classintlist);
                    }
                    else
                    {
                        classidstr = StringUtils.GetDbString(classid);
                    }

                    IList <VWTreeBrandEntity> list = null;
                    list = BrandDA.Instance.GetBrandAllByClassStr(classidstr);
                    if (list != null && list.Count > 0)
                    {
                        //string[] firstletter = new Array();
                        ArrayList firstletter = new ArrayList();
                        foreach (VWTreeBrandEntity entity in list)
                        {
                            if (!firstletter.Contains(entity.PYFirst))
                            {
                                firstletter.Add(entity.PYFirst);
                            }
                            firstletter.Sort();
                        }
                        foreach (string letter in firstletter)
                        {
                            VWTreeBrandEntity entity = new VWTreeBrandEntity();
                            entity.PYFirst = letter;
                            resultlist.Add(entity);
                        }
                        foreach (VWTreeBrandEntity entity in list)
                        {
                            foreach (VWTreeBrandEntity entity2 in resultlist)
                            {
                                if (entity.PYFirst == entity2.PYFirst)
                                {
                                    if (entity2.Children == null)
                                    {
                                        entity2.Children = new List <VWTreeBrandEntity>();
                                    }
                                    entity2.Children.Add(entity);
                                    break;
                                }
                            }
                        }
                    }
                    MemCache.AddCache(_cachekey, resultlist);
                }
                else
                {
                    resultlist = (IList <VWTreeBrandEntity>)obj;
                }
            }
            else
            {
                int rediclassid = classid;
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);
                if (_classentity.RedirectClassId > 0)
                {
                    rediclassid = _classentity.RedirectClassId;
                }
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(rediclassid);
                string classidstr = "";
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }

                IList <VWTreeBrandEntity> list = null;
                list = BrandDA.Instance.GetBrandAllByClassStr(classidstr);
                if (list != null && list.Count > 0)
                {
                    //string[] firstletter = new Array();
                    ArrayList firstletter = new ArrayList();
                    foreach (VWTreeBrandEntity entity in list)
                    {
                        if (!firstletter.Contains(entity.PYFirst))
                        {
                            firstletter.Add(entity.PYFirst);
                        }
                        firstletter.Sort();
                    }
                    foreach (string letter in firstletter)
                    {
                        VWTreeBrandEntity entity = new VWTreeBrandEntity();
                        entity.PYFirst = letter;
                        resultlist.Add(entity);
                    }
                    foreach (VWTreeBrandEntity entity in list)
                    {
                        foreach (VWTreeBrandEntity entity2 in resultlist)
                        {
                            if (entity.PYFirst == entity2.PYFirst)
                            {
                                if (entity2.Children == null)
                                {
                                    entity2.Children = new List <VWTreeBrandEntity>();
                                }
                                entity2.Children.Add(entity);
                                break;
                            }
                        }
                    }
                }
            }
            return(resultlist);
        }
Exemplo n.º 22
0
        public ActionResult Search()
        {
            int classid   = QueryString.IntSafeQ("cl");
            int brandid   = QueryString.IntSafeQ("bd");
            int siteid    = QueryString.IntSafeQ("s");
            int pageindex = QueryString.IntSafeQ("pi");
            int jishi     = QueryString.IntSafeQ("js", -1);

            if (jishi == -1)
            {
                jishi = (int)JiShiSongEnum.Normal;
            }
            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                ViewBag.SelectClassName = _classentity.Name;
                ViewBag.SelectClassId   = classid;
            }
            if (brandid > 0)
            {
                BrandEntity brand = BrandBLL.Instance.GetBrand(brandid, true);
                ViewBag.SelectBrandName = brand.Name;
                ViewBag.SelectBrandId   = brandid;
            }

            if (pageindex < 1)
            {
                pageindex = 1;
            }
            int    pagesize = CommonKey.PageSizeList;
            string querykey = QueryString.SafeQ("key");
            //SearchIndex search = new SearchIndex();
            //GyLuceneEntity luceneentity = search.LuceneSearch(querykey, siteid, brandid, classid,jishi, pagesize, pageindex);
            IList <VWProductEntity> _productlist = new List <VWProductEntity>();
            //List<ProductLuceneEntity> list = luceneentity.ProductList;
            IList <ClassesFoundEntity> listclass = new List <ClassesFoundEntity>();
            //if (luceneentity.ClassList != null && luceneentity.ClassList.Count > 0)
            //{
            //    foreach (int cid in luceneentity.ClassList)
            //    {
            //        ClassesFoundEntity entity = ClassesFoundBLL.Instance.GetClassesFound(cid, true);
            //        listclass.Add(entity);
            //    }
            //}
            IList <BrandEntity> listbrand = new List <BrandEntity>();

            //if (luceneentity.BrandList != null && luceneentity.BrandList.Count > 0)
            //{
            //    foreach (int cid in luceneentity.BrandList)
            //    {
            //        BrandEntity entity = BrandBLL.Instance.GetBrand(cid, true);
            //        listbrand.Add(entity);
            //    }
            //}
            if (brandid > 0)
            {
                BrandEntity brandentity = BrandBLL.Instance.GetBrand(brandid, true);
                ViewBag.BrandSelect = brandentity;
            }
            if (classid > 0)
            {
                ClassesFoundEntity classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                ViewBag.ClassSelect = classentity;
            }
            int listmethod = (int)SuperMarket.Model.ListShowMethodEnum.Default;

            //if (list != null && list.Count > 0)
            //{
            //    bool haslogin = false;
            //    MemberLoginEntity member = CookieBLL.GetLoginCookie();
            //    if (member != null && member.MemId > 0)
            //    {
            //        ViewBag.MemId = member.MemId;
            //        ViewBag.MemStatus = member.Status;
            //        haslogin = true;
            //    }
            //    foreach (ProductLuceneEntity _productentity in list)
            //    {
            //        VWProductEntity productentity = ProductBLL.Instance.GetProVWByDetailId(_productentity.ProductDetailId);
            //        if (productentity.ListShowMethod == (int)SuperMarket.Model.ListShowMethodEnum.Normal)
            //        {
            //            listmethod = productentity.ListShowMethod;
            //        }
            //        if (haslogin)
            //        {
            //            productentity.ActualPrice = Calculate.GetPrice(member.Status,member.IsStore, member.StoreType, member.MemGrade, productentity.TradePrice, productentity.Price, productentity.IsBP, productentity.DealerPrice);

            //        }
            //        else
            //        {
            //            productentity.ActualPrice = 0;
            //        }
            //        _productlist.Add(productentity);
            //    }
            //    //else
            //    //{
            //    //    foreach (ProductLuceneEntity product in list)
            //    //    {
            //    //        if (product.ListShowMethod == (int)SuperMarket.Model.ListShowMethodEnum.Normal)
            //    //        {
            //    //            listmethod = product.ListShowMethod;
            //    //            break;
            //    //        }
            //    //    }
            //    //}

            //}
            //int record = luceneentity.Count;
            //string url = "/Product/Search.html?s=" + siteid + "&cl=" + classid + "&bd=" + brandid + "&key=" + querykey;
            //string pagehtml = HTMLPage.SetOrderListPage(record, pagesize, pageindex, url);
            //ViewBag.MaxPageIndex = record;
            //ViewBag.PageHtml = pagehtml;
            ViewBag.ListShowMethod = listmethod;
            ViewBag.BrandId        = brandid;
            ViewBag.ClassId        = classid;
            ViewBag.SiteId         = siteid;
            ViewBag.SearchKey      = querykey;
            ViewBag.ProductList    = _productlist;
            ViewBag.ClassList      = listclass;
            ViewBag.BrandList      = listbrand;
            ViewBag.JiShiSong      = jishi;
            return(View());
        }
Exemplo n.º 23
0
        public IList <ClassesFoundEntity> GetClassesAllByPId(int pid, int level, int siteid)
        {
            string where = " where 1=1 and IsActive=1";

            if (pid > 0)
            {
                where += " and ParentId=@ParentId";
            }
            else
            {
                if (pid == 0)
                {
                    where += " and ParentId=0";
                }
                if (siteid != -1)
                {
                    where += " and SiteId=@SiteId";
                }
            }
            string sql = @"SELECT    [Id],[Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[ParentId],PropertiesClassId,HasProduct,ClassType ,RedirectClassId  from dbo.[ClassesFound] WITH(NOLOCK)	"+ where + " Order By Sort desc";
            IList <ClassesFoundEntity> entityList = new List <ClassesFoundEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            if (pid > 0)
            {
                db.AddInParameter(cmd, "@ParentId", DbType.Int32, pid);
            }
            else
            {
                if (pid <= 0 && siteid != -1)
                {
                    db.AddInParameter(cmd, "@SiteId", DbType.Int32, siteid);
                }
            }
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ClassesFoundEntity entity = new ClassesFoundEntity();
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code              = StringUtils.GetDbString(reader["Code"]);
                    entity.Name              = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst           = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort           = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull            = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId              = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort              = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive          = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot             = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime        = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime        = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel        = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd             = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties     = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.PropertiesClassId = StringUtils.GetDbInt(reader["PropertiesClassId"]);
                    entity.HasProduct        = StringUtils.GetDbInt(reader["HasProduct"]);
                    entity.ParentId          = StringUtils.GetDbInt(reader["ParentId"]);
                    entity.ClassType         = StringUtils.GetDbInt(reader["ClassType"]);
                    entity.RedirectClassId   = StringUtils.GetDbInt(reader["RedirectClassId"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <ClassesFoundEntity> GetClassesFoundList(int pagesize, int pageindex, ref int recordCount, int level, string name, int parentid, int isactive, int classtype, int classmenutype, int siteid)
        {
            string where = "WHERE  1=1";
            if (siteid > 0)
            {
                where += " and   SiteId=@SiteId ";
            }
            if (level > 0)
            {
                where += " And ClassLevel=@ClassLevel";
            }
            if (isactive > -1)
            {
                where += " And IsActive=@IsActive";
            }
            if (parentid > -1)
            {
                where += " And ParentId=@ParentId";
            }
            if (name != string.Empty)
            {
                where += " And Name like @Name";
            }
            if (classtype != -1)
            {
                where += " And ClassType = @ClassType";
            }
            if (classmenutype != -1)
            {
                where += " And ClassMenuType = @ClassMenuType";
            }
            string sql = @"SELECT   [Id],[Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties] ,[ParentId],ClassType 
						FROM
						(SELECT ROW_NUMBER() OVER (ORDER BY Id desc) AS ROWNUMBER,
						 [Id],[Code],[Name],[PYFirst],[PYShort],[PYFull],[AdId],[Sort],[IsActive],[IsHot],[CreateTime],[UpdateTime],[ClassLevel],[IsEnd],[HasProperties],[ParentId],ClassType  from dbo.[ClassesFound] WITH(NOLOCK)	
						"                         + where + @" ) as temp 
						where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize"                        ;

            string sql2 = @"Select count(1) from dbo.[ClassesFound] with (nolock) " + where;
            IList <ClassesFoundEntity> entityList = new List <ClassesFoundEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageindex);
            db.AddInParameter(cmd, "@PageSize", DbType.Int32, pagesize);
            if (siteid > 0)
            {
                db.AddInParameter(cmd, "@SiteId", DbType.Int32, siteid);
            }
            if (level > 0)
            {
                db.AddInParameter(cmd, "@ClassLevel", DbType.Int32, level);
            }
            if (isactive > -1)
            {
                db.AddInParameter(cmd, "@IsActive", DbType.Int32, isactive);
            }
            if (parentid > -1)
            {
                db.AddInParameter(cmd, "@ParentId", DbType.Int32, parentid);
            }
            if (name != string.Empty)
            {
                db.AddInParameter(cmd, "@Name", DbType.String, "%" + name + "%");
            }
            if (classtype != -1)
            {
                db.AddInParameter(cmd, "@ClassType", DbType.Int32, classtype);
            }
            if (classmenutype != -1)
            {
                db.AddInParameter(cmd, "@ClassMenuType", DbType.Int32, classmenutype);
            }
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ClassesFoundEntity entity = new ClassesFoundEntity();
                    entity.Id            = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code          = StringUtils.GetDbString(reader["Code"]);
                    entity.Name          = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst       = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort       = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull        = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId          = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort          = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive      = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot         = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime    = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime    = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel    = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd         = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.ParentId      = StringUtils.GetDbInt(reader["ParentId"]);
                    entity.ClassType     = StringUtils.GetDbInt(reader["ClassType"]);
                    entityList.Add(entity);
                }
            }
            cmd = db.GetSqlStringCommand(sql2);
            if (siteid > 0)
            {
                db.AddInParameter(cmd, "@SiteId", DbType.Int32, siteid);
            }
            if (level > 0)
            {
                db.AddInParameter(cmd, "@ClassLevel", DbType.Int32, level);
            }
            if (isactive > -1)
            {
                db.AddInParameter(cmd, "@IsActive", DbType.Int32, isactive);
            }
            if (parentid > -1)
            {
                db.AddInParameter(cmd, "@ParentId", DbType.Int32, parentid);
            }
            if (name != string.Empty)
            {
                db.AddInParameter(cmd, "@Name", DbType.String, "%" + name + "%");
            }
            if (classtype != -1)
            {
                db.AddInParameter(cmd, "@ClassType", DbType.Int32, classtype);
            }
            if (classmenutype != -1)
            {
                db.AddInParameter(cmd, "@ClassMenuType", DbType.Int32, classmenutype);
            }
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    recordCount = StringUtils.GetDbInt(reader[0]);
                }
                else
                {
                    recordCount = 0;
                }
            }
            return(entityList);
        }
Exemplo n.º 25
0
        public ClassesFoundEntity GetClassesFoundByName(string name, int classtype, int ClassMenuType, int isend)
        {
            string    sql = @"
   
 IF ( SELECT    COUNT(1)
      FROM      dbo.[ClassesFound] WITH ( NOLOCK )
      WHERE     [Name] = @Name
                AND IsActive = 1
                AND RedirectClassId = 0 
                AND IsEnd = @IsEnd
                AND ClassType = @ClassType
                AND ClassMenuType = @ClassMenuType
    ) = 1 
    BEGIN    
        SELECT  [Id] ,
                [Code] ,
                [FullName] ,
                [Name] ,
                [PYFirst] ,
                [PYShort] ,
                [PYFull] ,
                [AdId] ,
                [Sort] ,
                [IsActive] ,
                [IsHot] ,
                [CreateTime] ,
                [UpdateTime] ,
                [ClassLevel] ,
                [IsEnd] ,
                [HasProperties] ,
                [HasProduct] ,
                PropertiesClassId ,
                [ParentId] ,
                ClassType ,
                RedirectClassId
        FROM    dbo.[ClassesFound] WITH ( NOLOCK )
        WHERE   [Name] = @Name
                AND IsActive = 1
                AND RedirectClassId = 0
                AND IsEnd = @IsEnd
                AND ClassType = @ClassType
                AND ClassMenuType = @ClassMenuType
    END
 ELSE 
    BEGIN  
        SELECT  [Id] ,
                [Code] ,
                [FullName] ,
                [Name] ,
                [PYFirst] ,
                [PYShort] ,
                [PYFull] ,
                [AdId] ,
                [Sort] ,
                [IsActive] ,
                [IsHot] ,
                [CreateTime] ,
                [UpdateTime] ,
                [ClassLevel] ,
                [IsEnd] ,
                [HasProperties] ,
                [HasProduct] ,
                PropertiesClassId ,
                [ParentId] ,
                ClassType ,
                RedirectClassId
        FROM    dbo.[ClassesFound] WITH ( NOLOCK )
        WHERE   [FullName] = @Name
                AND IsActive = 1
                AND RedirectClassId = 0
                AND IsEnd = @IsEnd
                AND ClassType = @ClassType
                AND ClassMenuType = @ClassMenuType
    END
        ";
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Name", DbType.String, name);
            db.AddInParameter(cmd, "@ClassType", DbType.String, classtype);
            db.AddInParameter(cmd, "@IsEnd", DbType.Int16, isend);

            db.AddInParameter(cmd, "@ClassMenuType", DbType.String, ClassMenuType);
            ClassesFoundEntity entity = new ClassesFoundEntity();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    entity.Id                = StringUtils.GetDbInt(reader["Id"]);
                    entity.Code              = StringUtils.GetDbString(reader["Code"]);
                    entity.FullName          = StringUtils.GetDbString(reader["FullName"]);
                    entity.Name              = StringUtils.GetDbString(reader["Name"]);
                    entity.PYFirst           = StringUtils.GetDbString(reader["PYFirst"]);
                    entity.PYShort           = StringUtils.GetDbString(reader["PYShort"]);
                    entity.PYFull            = StringUtils.GetDbString(reader["PYFull"]);
                    entity.AdId              = StringUtils.GetDbInt(reader["AdId"]);
                    entity.Sort              = StringUtils.GetDbInt(reader["Sort"]);
                    entity.IsActive          = StringUtils.GetDbInt(reader["IsActive"]);
                    entity.IsHot             = StringUtils.GetDbInt(reader["IsHot"]);
                    entity.CreateTime        = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.UpdateTime        = StringUtils.GetDbDateTime(reader["UpdateTime"]);
                    entity.ClassLevel        = StringUtils.GetDbInt(reader["ClassLevel"]);
                    entity.IsEnd             = StringUtils.GetDbInt(reader["IsEnd"]);
                    entity.HasProperties     = StringUtils.GetDbInt(reader["HasProperties"]);
                    entity.HasProduct        = StringUtils.GetDbInt(reader["HasProduct"]);
                    entity.PropertiesClassId = StringUtils.GetDbInt(reader["PropertiesClassId"]);
                    entity.ParentId          = StringUtils.GetDbInt(reader["ParentId"]);
                    entity.ClassType         = StringUtils.GetDbInt(reader["ClassType"]);
                    entity.RedirectClassId   = StringUtils.GetDbInt(reader["RedirectClassId"]);
                }
            }
            return(entity);
        }
Exemplo n.º 26
0
        public string GetJsonList()
        {
            ListObj result      = new ListObj();
            int     classid     = QueryString.IntSafeQ("cl");
            int     brandid     = QueryString.IntSafeQ("bd");
            int     cartype     = QueryString.IntSafeQ("ct");
            int     producttype = QueryString.IntSafeQ("pt");
            int     jishi       = QueryString.IntSafeQ("js");

            if (jishi == 0)
            {
                jishi = (int)JiShiSongEnum.Normal;
            }
            if (producttype == 0)
            {
                producttype = (int)ProductType.Normal;
            }
            int siteid = QueryString.IntSafeQ("s");

            if (siteid <= 0)
            {
                siteid = (int)SiteEnum.Default;
            }
            int pageindex  = QueryString.IntSafeQ("pageindex");
            int pagesize   = CommonKey.PageSizeList;
            int record     = 0;
            int order_i    = 0;//默认排序
            int _classtype = -1;

            _classtype        = QueryString.IntSafeQ("clt");
            ViewBag.ClassType = _classtype;
            if (pageindex == 0)
            {
                pageindex = 1;
            }
            ViewBag.SelectClassId = classid;
            ViewBag.SelectBrandId = brandid;
            ViewBag.CarType       = cartype;
            int    _classmenutype = (int)ClassMenuTypeEnum.Normal; //分类列表选择类型
            int    rediclassid    = classid;
            string classidstr     = "";                            //分类子集

            //获取选择的车型
            if (cartype > 0)
            {
                CarTypeModelEntity cartypemodel = CarTypeModelBLL.Instance.GetCarTypeModel(cartype);
                ViewBag.SelectCarTypeName = cartypemodel.ModelName;
            }

            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                if (_classentity.RedirectClassId > 0)
                {
                    rediclassid = _classentity.RedirectClassId;
                }
                ViewBag.SelectClassName = _classentity.Name;
                IList <int> classintlist = new List <int>();
                if (_classentity.RedirectClassId > 0)
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(_classentity.RedirectClassId);
                }
                else
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(classid);
                }
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else if (_classentity.RedirectClassId > 0)
                {
                    classidstr = StringUtils.GetDbString(_classentity.RedirectClassId);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            else
            {
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndListBySite(siteid);

                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
            }


            IList <VWProductEntity> _productlist = new List <VWProductEntity>();// ProductBLL.Instance.GetProductListProcCYC(pagesize, pageindex, ref record, classidstr, brandid, "", order_i, producttype,  cartype ,jishi);

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId     = member.MemId;
                ViewBag.MemStatus = member.Status;
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _entity.TradePrice, _entity.Price, _entity.IsBP, _entity.DealerPrice);
                }
            }
            else
            {
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = 0;
                }
            }
            result.Total = record;
            result.List  = _productlist;

            string liststr = JsonJC.ObjectToJson(result);

            return(liststr);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 网站首页
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            int classid        = QueryString.IntSafeQ("cl");
            int brandid        = QueryString.IntSafeQ("bd");
            int cartypemodelid = QueryString.IntSafeQ("ct");//车型
            int siteid         = QueryString.IntSafeQ("s");

            if (siteid == 0)
            {
                siteid = (int)SiteIdEnum.BathRoom;
            }

            int producttype = QueryString.IntSafeQ("pt");

            if (producttype == 0)
            {
                producttype = (int)ProductType.Normal;
            }
            int pageindex      = QueryString.IntSafeQ("pageindex");
            int _classmenutype = (int)ClassMenuTypeEnum.Normal;//分类列表选择类型
            int _pagesize      = CommonKey.PageSizeList;
            int _recordCount   = 0;
            int order_i        = 0;//默认排序
            int _classtype     = -1;

            _classtype        = QueryString.IntSafeQ("clt");
            ViewBag.ClassType = _classtype;
            if (pageindex == 0)
            {
                pageindex = 1;
            }
            ViewBag.SelectClassId  = classid;
            ViewBag.SelectBrandId  = brandid;
            ViewBag.CarTypeModelId = cartypemodelid;
            ViewBag.ProductType    = producttype;
            int    rediclassid = classid;
            string classidstr  = "";//分类子集

            //获取选择的品牌
            if (brandid > 0)
            {
                BrandEntity brand = BrandBLL.Instance.GetBrand(brandid, true);
                ViewBag.SelectBrandName = brand.Name;
            }
            //获取选择的车型
            if (cartypemodelid > 0)
            {
                CarTypeModelEntity cartypemodel = CarTypeModelBLL.Instance.GetCarTypeModel(cartypemodelid);
                ViewBag.SelectCarTypeName = cartypemodel.ModelName;
            }
            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                siteid = _classentity.SiteId;
                if (_classentity.RedirectClassId > 0)
                {
                    rediclassid = _classentity.RedirectClassId;
                }
                ViewBag.SelectClassName = _classentity.Name;
                //获取分类子集
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(rediclassid);

                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(rediclassid);
                }
            }
            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, true);
                if (_classentity.RedirectClassId > 0)
                {
                    rediclassid = _classentity.RedirectClassId;
                }
                ViewBag.SelectClassName = _classentity.Name;
                IList <int> classintlist = new List <int>();
                if (_classentity.RedirectClassId > 0)
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(_classentity.RedirectClassId);
                }
                else
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(classid);
                }
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else if (_classentity.RedirectClassId > 0)
                {
                    classidstr = StringUtils.GetDbString(_classentity.RedirectClassId);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            else
            {
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndListBySite(siteid);

                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
            }
            IList <VWProductEntity> _productlist = new List <VWProductEntity>();// ProductBLL.Instance.GetProductListProcCYC(_pagesize, pageindex, ref _recordCount, classidstr, brandid, "", order_i, producttype,  cartypemodelid,jishi);

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId     = member.MemId;
                ViewBag.MemStatus = member.Status;
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _entity.TradePrice, _entity.Price, _entity.IsBP, _entity.DealerPrice);
                }
            }
            else
            {
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = 0;
                }
            }

            ViewBag.ProductList = _productlist;
            ViewBag.SiteId      = siteid;
            int maxpage = _recordCount / _pagesize;

            if (_recordCount % _pagesize > 0)
            {
                maxpage = maxpage + 1;
            }
            ViewBag.MaxPageIndex   = maxpage;
            ViewBag.ClassmMenuType = _classmenutype;
            return(View());
        }
Exemplo n.º 28
0
        /// <summary>
        /// 分类信息添加
        /// </summary>
        /// <returns></returns>
        public int ClassInfoAdd()
        {
            int    _pid                = FormString.IntSafeQ("pid");
            int    _adid               = FormString.IntSafeQ("adid");
            int    _isend              = FormString.IntSafeQ("isend");
            int    _isactive           = FormString.IntSafeQ("isactive");
            int    _sort               = FormString.IntSafeQ("sort");
            int    _hasproduct         = FormString.IntSafeQ("hasproduct");
            int    _classtype          = FormString.IntSafeQ("classtype");
            int    _hasproperty        = FormString.IntSafeQ("hasproperty");
            int    _haspropertyclassid = FormString.IntSafeQ("haspropertyclassid");
            int    _siteid             = FormString.IntSafeQ("siteid");
            string _code               = FormString.SafeQ("code");
            string _name               = FormString.SafeQ("name");
            string _fullname           = FormString.SafeQ("fullname");
            string _pyshort            = FormString.SafeQ("pyshort");
            string _pyfull             = FormString.SafeQ("pyfull");

            ClassesFoundEntity entity = new ClassesFoundEntity();

            entity.AdId              = _adid;
            entity.IsEnd             = _isend;
            entity.IsActive          = _isactive;
            entity.Sort              = _sort;
            entity.HasProduct        = _hasproduct;
            entity.ClassType         = _classtype;
            entity.HasProperties     = _hasproperty;
            entity.PropertiesClassId = _haspropertyclassid;
            entity.Code              = _code;
            entity.Name              = _name;
            entity.FullName          = _fullname;
            entity.PYShort           = _pyshort;
            entity.PYFull            = _pyfull;
            entity.SiteId            = _siteid;

            entity.UpdateTime = entity.CreateTime = DateTime.Now;

            if (_pid == 0)
            {
                entity.ClassLevel = 1;
                entity.ParentId   = 0;
                entity.IsEnd      = 0;
            }
            else if (_pid > 0)
            {
                ClassesFoundEntity temp = ClassesFoundBLL.Instance.GetClassesFound(_pid, false);
                entity.ClassLevel = temp.ClassLevel + 1;
                entity.ParentId   = temp.Id;
                //if (entity.ClassLevel == 4)
                //{
                //    entity.IsEnd = 1;
                //}
                //else
                //{
                //    entity.IsEnd = 0;
                //}
            }

            int _result = ClassesFoundBLL.Instance.AddClassesFound(entity);

            return(_result);
        }
Exemplo n.º 29
0
        public ActionResult Detail()
        {
            string title            = "易店心,";
            int    _productdetailid = QueryString.IntSafeQ("pd");
            int    _producttype     = (int)ProductType.Normal;

            if (_productdetailid == 0)
            {
                _productdetailid = StringUtils.GetDbInt(RouteData.Values["pd"]);
                if (_productdetailid == 0)
                {
                    return(Redirect("/"));
                }
            }
            VWProductEntity _vwentity = new VWProductEntity();

            _vwentity = ProductBLL.Instance.GetProVWByDetailId(_productdetailid);
            int _productid = _vwentity.ProductId;

            _producttype = _vwentity.ProductType;

            //if(_vwentity.ProductType== (int)ProductType.SpecialPrice)
            //{
            //    return RedirectToAction(  "SProductDetail", new { pd = _productdetailid });
            //}
            title        += _vwentity.AdTitle;
            ViewBag.Title = title;
            IList <ProductStylePicsEntity> productpiclist = null;

            ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(_vwentity.ClassId, false);
            BrandEntity        _brandrntity = BrandBLL.Instance.GetBrand(_vwentity.BrandId, false);

            ViewBag.RavClassList  = ListRavStr(_classentity);
            ViewBag.Brand         = _brandrntity;
            productpiclist        = ProductStylePicsBLL.Instance.GetListPicsByProductId(_productid);
            _vwentity.ProductPics = productpiclist;

            IList <ProductPropertyEntity> productpropertylist = ProductPropertyBLL.Instance.GetListByProductId(_productid);

            _vwentity.ProductPropertys = productpropertylist;

            if (!string.IsNullOrEmpty(_vwentity.Spec1))
            {
                ViewBag.Spec1Name = _vwentity.Spec1;
                IList <VWProductEntity> plist = ProductBLL.Instance.GetListSpecsByStyleId(_vwentity.SiteId, _vwentity.ProductType, _vwentity.CGMemId);
                //ViewBag.SpecList = plist;
                var listfilter = (from c in plist
                                  select new { c.Spec1, c.Spec2, c.PicUrlLittle, c.ProductId, c.ProductDetailId });
                string liststr = JsonJC.ObjectToJson(listfilter);
                ViewBag.SpecListJson = liststr;
                IList <string> OBJSpec1 = (from c in plist
                                           where !string.IsNullOrEmpty(c.Spec1)
                                           select c.Spec1).Distinct().OrderBy(p => p).ToList();
                ViewBag.Spec1List = OBJSpec1;

                if (!string.IsNullOrEmpty(_vwentity.Spec2))
                {
                    ViewBag.Spec2Name = _vwentity.Spec2;
                    IList <string> OBJSpec2 = (from c in plist
                                               where !string.IsNullOrEmpty(c.Spec2)
                                               select c.Spec2).Distinct().OrderBy(p => p).ToList <string>();
                    ViewBag.Spec2List = OBJSpec2;
                }
            }

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId         = member.MemId;
                ViewBag.MemStatus     = member.Status;
                ViewBag.Member        = member;
                _vwentity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _vwentity.TradePrice, _vwentity.Price, _vwentity.IsBP, _vwentity.DealerPrice);
            }
            ViewBag.VWProductEntity = _vwentity;
            return(View());
        }
Exemplo n.º 30
0
        public string GetJsonList()
        {
            ListObj result  = new ListObj();
            string  _key    = QueryString.SafeQ("key");
            int     classid = QueryString.IntSafeQ("cid");
            int     brandid = QueryString.IntSafeQ("bd");
            int     siteid  = QueryString.IntSafeQ("s");

            if (siteid <= 0)
            {
                siteid = (int)SiteIdEnum.BathRoom;
            }
            int pageindex = QueryString.IntSafeQ("pageindex");
            int pagesize  = CommonKey.PageSizeList;
            int record    = 0;
            int order_i   = 0;//默认排序

            if (pageindex == 0)
            {
                pageindex = 1;
            }
            ViewBag.SelectClassId = classid;
            ViewBag.SelectBrandId = brandid;
            int    rediclassid = classid;
            string classidstr  = "";//分类子集



            if (classid > 0)
            {
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);
                if (_classentity.RedirectClassId > 0)
                {
                    rediclassid = _classentity.RedirectClassId;
                }
                IList <int> classintlist = new List <int>();
                if (_classentity.RedirectClassId > 0)
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(_classentity.RedirectClassId);
                }
                else
                {
                    classintlist = ClassesFoundBLL.Instance.GetSubClassEndList(classid);
                }
                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
                else if (_classentity.RedirectClassId > 0)
                {
                    classidstr = StringUtils.GetDbString(_classentity.RedirectClassId);
                }
                else
                {
                    classidstr = StringUtils.GetDbString(classid);
                }
            }
            else
            {
                IList <int> classintlist = new List <int>();
                classintlist = ClassesFoundBLL.Instance.GetSubClassEndListBySite(siteid);

                if (classintlist != null && classintlist.Count > 0)
                {
                    classidstr = string.Join("_", classintlist);
                }
            }


            IList <VWProductEntity> _productlist = new List <VWProductEntity>();// ProductBLL.Instance.GetProductListProcCYC(pagesize, pageindex, ref record, classidstr, brandid, "", order_i, producttype,  cartype ,jishi);

            _productlist = ProductBLL.Instance.GetProductListProc(pagesize, pageindex, ref record, classidstr, brandid, "", order_i, _key);

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId     = member.MemId;
                ViewBag.MemStatus = member.Status;
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _entity.TradePrice, _entity.Price, _entity.IsBP, _entity.DealerPrice);
                }
            }
            else
            {
                foreach (VWProductEntity _entity in _productlist)
                {
                    _entity.ActualPrice = 0;
                }
            }
            result.Total = record;
            result.List  = _productlist;

            string liststr = JsonJC.ObjectToJson(result);

            return(liststr);
        }