示例#1
0
        /// <summary>
        /// 查询商家所有在售商品按照销售量排序 -新增
        /// </summary>
        /// <param name="id">商家ID</param>
        /// <returns></returns>
        public System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.CommodityDTO> GetAllCommodityBySellerIDBySalesvolume(System.Guid id, int pageSize, int pageIndex, string commodityName, string commodityCategory, string sSalesvolume, string eSalesvolume, string sPrice, string ePrice, out int rowCount)
        {
            var query = Commodity.ObjectSet().Where(n => n.IsDel.Equals(false) && n.AppId.Equals(id) && n.State == 0 && n.CommodityType == 0);

            #region 条件查询
            if (!string.IsNullOrEmpty(commodityName))
            {
                query = query.Where(n => n.Name.Contains(commodityName));
            }
            if (!string.IsNullOrEmpty(sSalesvolume))
            {
                int s = int.Parse(sSalesvolume);
                query = query.Where(n => n.Salesvolume >= s);
            }
            if (!string.IsNullOrEmpty(eSalesvolume))
            {
                int e = int.Parse(eSalesvolume);
                query = query.Where(n => n.Salesvolume <= e);
            }
            if (!string.IsNullOrEmpty(sPrice))
            {
                decimal s = 0;
                if (!decimal.TryParse(sPrice, out s))//长度越界
                {
                    rowCount = 0;
                    return(new System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.CommodityDTO>());
                }
                query = query.Where(n => n.Price >= s);
            }
            if (!string.IsNullOrEmpty(ePrice))
            {
                decimal e = 0;
                if (!decimal.TryParse(ePrice, out e))//长度越界
                {
                    rowCount = 0;
                    return(new System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.CommodityDTO>());
                }
                query = query.Where(n => n.Price <= e);
            }
            if (!string.IsNullOrEmpty(commodityCategory))
            {
                string[]    commodityCategoryID = commodityCategory.Split(',');
                List <Guid> idlist = new List <Guid>();
                foreach (string commodityCategoryid in commodityCategoryID)
                {
                    if (!string.IsNullOrEmpty(commodityCategoryid))
                    {
                        idlist.Add(new Guid(commodityCategoryid));
                    }
                }
                query = from n in query
                        join m in CommodityCategory.ObjectSet() on n.Id equals m.CommodityId
                        where idlist.Contains(m.CategoryId)
                        select n;
            }
            #endregion
            rowCount = query.Count();
            var list = query.OrderByDescending(n => n.SubTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();

            return(new Commodity().ToEntityDataList(list));
        }
示例#2
0
        public string GetCommodityNameByCode(string code)
        {
            string name = Commodity.ObjectSet().Where(n => n.No_Code == code && n.CommodityType == 0).Select(n => n.Name).FirstOrDefault();

            return(name);
        }
示例#3
0
        /// <summary>
        /// 查询商家所有在售商品 - 有修改
        /// </summary>
        /// <param name="id">商家ID</param>
        /// <returns></returns>
        public System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.CommodityDTO> GetAllCommodityBySellerID(System.Guid id, int pageSize, int pageIndex)
        {
            var commodityDTO = Commodity.ObjectSet().Where(n => n.IsDel.Equals(false) && n.AppId.Equals(id) && n.State == 0 && n.CommodityType == 0).OrderByDescending(n => n.SubTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();

            return(new Commodity().ToEntityDataList(commodityDTO));
        }
示例#4
0
        public Guid GetCommodityidByCode(Guid appid, string code)
        {
            Guid id = Commodity.ObjectSet().Where(n => n.No_Code == code && n.AppId == appid && n.CommodityType == 0).Select(n => n.Id).FirstOrDefault();

            return(id);
        }