示例#1
0
        public List <IndexFloor> GetIndexFloor(string userId, string entId)
        {
            ///获取用户信息
            UserInfoDal     dal  = new UserInfoDal();
            List <UserInfo> user = dal.GetUserInfo(userId, entId);

            string jgjb = "", KhType = "";
            bool   landing    = false;
            bool   staleDated = false;

            if (user.Count > 0)
            {
                entId      = user[0].EntId;
                jgjb       = user[0].Pricelevel;
                KhType     = user[0].KhType;
                landing    = true;
                staleDated = user[0].StaleDated;
            }

            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@type", "floorImg"),
                new SqlParameter("@jgjb", jgjb),
                new SqlParameter("@khlb", KhType),
                new SqlParameter("@EntId", entId),
                new SqlParameter("@userId", userId),
            };
            SqlRun            sql  = new SqlRun(SqlRun.sqlstr);
            var               ds   = sql.RunProDataSet("Proc_GoodsList", param);
            List <IndexFloor> list = new List <IndexFloor>();

            if (ds.Tables.Count > 0)
            {
                list = FillFloor(ds.Tables[0], ds.Tables[1], entId, landing, staleDated, jgjb, userId);
            }
            return(list);
        }
示例#2
0
        /// <summary>
        /// 搜索页获取商品列表
        /// </summary>
        /// <param name="ywyId">业务员Id</param>
        /// <param name="userId">客户Id</param>
        /// <param name="searchValue">搜索条件</param>
        /// <param name="letter">厂家首字母</param>
        /// <param name="tags">排序类型</param>
        /// <param name="isKc">是否有货</param>
        /// <param name="CategoryId">商品分类Id</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">没页行数</param>
        /// <returns></returns>
        public ValetOrderModel <GoodsInfo> GetGoodsList(string ywyId, string userId, string searchValue, string letter, string tags, string isKc, string CategoryId, int pageIndex, int pageSize, string entid)
        {
            ValetOrderModel <GoodsInfo> mode = new ValetOrderModel <GoodsInfo>();

            mode.PageIndex = pageIndex;
            mode.PageSize  = pageSize;
            ////加载用户信息
            string jgjb = "", clientlimit = "", KhType = "";

            try
            {
                //获取用户信息
                UserInfoDal     dal  = new UserInfoDal();
                List <UserInfo> user = new List <UserInfo>();
                user = dal.GetUserInfo(userId, entid);
                if (user.Count <= 0)
                {
                    mode.Success = "002";
                    mode.Message = "客户信息获取失败";
                    return(mode);
                }
                entid       = user[0].EntId;
                jgjb        = user[0].Pricelevel;
                clientlimit = user[0].ClientLimit;
                KhType      = user[0].KhType;
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "ValetOrder/GetGoodsList", ex.Message.ToString());
                mode.Success = "002";
                mode.Message = "客户信息获取失败," + ex.Message.ToString();
                return(mode);
            }
            try
            {
                ///加载查询条件
                StringBuilder StrWhere = new StringBuilder();
                if (searchValue.IndexOf(" ") >= 0)
                {
                    string   goodsValue, factoryValue;
                    string[] searchString = searchValue.Split(' ');
                    goodsValue   = searchString[0];
                    factoryValue = searchString[1];
                    StrWhere.Append(" and b.mnemonic_code like '%" + goodsValue + "%' and b.Origin_mnemonic_code like '%" + factoryValue + "%' ");
                }
                else
                {
                    StrWhere.Append(" and(b.goodscode like '%" + searchValue + "%' or b.sub_title like '%" + searchValue + "%' or b.mnemonic_code like '%" + searchValue + "%'");
                    StrWhere.Append(" or b.drug_factory like '%" + searchValue + "%' or b.Origin_mnemonic_code like '%" + searchValue + "%') ");
                }
                //是否有货筛选
                if (isKc == "Y")
                {
                    StrWhere.Append(" and c.stock_quantity>0 ");
                }
                //商品价格大于0筛选
                StrWhere.Append(" and d.price>0.0");
                ///厂家首字母筛选
                if (letter != "")
                {
                    StrWhere.Append(" and left(b.Origin_mnemonic_code,1)='" + letter + "'");
                }
                StringBuilder order = new StringBuilder();
                order.Append(" ");
                //商品排序
                switch (tags)
                {
                case "click_u":    //点击量升序
                    order.Append(" order by a.click asc,b.goodscode asc");
                    break;

                case "click_d":    //点击量降序
                    order.Append(" order by a.click desc,b.goodscode desc");
                    break;

                case "sales_u":    //销量升序
                    order.Append(" order by a.sales asc,b.goodscode asc");
                    break;

                case "sales_d":    //销量降序
                    order.Append(" order by a.sales desc,b.goodscode desc");
                    break;

                case "price_u":    //价格升序
                    order.Append(" order by d.price asc,b.goodscode asc");
                    break;

                case "price_d":    //价格降序
                    order.Append(" order by d.price desc,b.goodscode desc");
                    break;

                case "cxbs":    //促销排序
                    order.Append(" order by fabh desc,b.goodscode asc");
                    break;

                case "cjpx":    //厂家排序
                    order.Append(" order by drug_factory asc");
                    break;

                case "sppx":    //商品排序
                    order.Append(" order by sub_title asc");
                    break;

                default:
                    order.Append(" order by b.goodscode asc");
                    break;
                }
                //////统计客户搜索类容
                if (searchValue != "")
                {
                    bool flag = StatisticalDal.GoodsStatistical("GoodsSearch", searchValue, entid);
                }
                ///获取商品列表
                SqlParameter[] param = new SqlParameter[] {
                    new SqlParameter("@Type", "GetList"),
                    new SqlParameter("@UserId", userId),
                    new SqlParameter("@Entid", entid),
                    new SqlParameter("@PageSize", pageSize),
                    new SqlParameter("@PageIndex", pageIndex),
                    new SqlParameter("@StrWhere", StrWhere.ToString()),
                    new SqlParameter("@Order", order.ToString()),
                    new SqlParameter("@CategoryId", CategoryId),
                    new SqlParameter("@Login_Id", ywyId),
                    new SqlParameter("@Jgjb", jgjb),
                    new SqlParameter("@khlb", KhType)
                };
                SqlRun  sql = new SqlRun(SqlRun.sqlstr);
                DataSet ds  = sql.RunProDataSet("Proc_GoodsList", param);
                mode.Success = "001";
                if (ds.Tables.Count > 0)
                {
                    DataTable dt = new DataTable();
                    if (ds.Tables.Count >= 3)
                    {
                        dt = ds.Tables[1];
                    }
                    else
                    {
                        dt = ds.Tables[0];
                    }
                    if (dt.Rows.Count > 0)
                    {
                        mode.Data    = SetGoodsList(dt);
                        mode.Success = "000";
                        mode.Message = "商品加载成功";
                    }
                }
                return(mode);
            }
            catch (Exception ex)
            {
                mode.Success = "002";
                mode.Message = "商品信息加载失败," + ex.Message.ToString();
                return(mode);
            }
        }