Ejemplo n.º 1
0
        public static SplitPageData <DataJoin <MemberDrawOrder, Member> > GetPresentAuditList(DataSource ds, string query, int pageIndex, int size = 10)
        {
            long count;

            DbWhereQueue where = new DbWhereQueue();
            if (!string.IsNullOrEmpty(query))
            {
                where = W <Member>("Name", query, DbWhereType.Equal)
                        & W <Member>("Mobile", query, DbWhereType.Equal)
                        & W("Email", query, DbWhereType.Equal);
            }
            IList <DataJoin <MemberDrawOrder, Member> > list = Db <MemberDrawOrder>
                                                               .Query(ds)
                                                               .Select(S <MemberDrawOrder>("OrderId"),
                                                                       S <MemberDrawOrder>("AccountName"),
                                                                       S <MemberDrawOrder>("BankName"),
                                                                       S <MemberDrawOrder>("BankCard"),
                                                                       S <MemberDrawOrder>("BankZone"),
                                                                       S <MemberDrawOrder>("DrawMoney"),
                                                                       S <MemberDrawOrder>("OrderState"),
                                                                       S <MemberDrawOrder>("CreateTime"),
                                                                       S <MemberDrawOrder>("TransactionNumber"),
                                                                       S <MemberDrawOrder>("CredentialImage"),
                                                                       S <MemberDrawOrder>("RefusalReasons"),
                                                                       S <Member>("Name"),
                                                                       S <Member>("Mobile"))
                                                               .LeftJoin(O <MemberDrawOrder>("UserId"), O <Member>("Id"))
                                                               .Where(where)
                                                               .OrderBy(A <MemberDrawOrder>("OrderState"), D <MemberDrawOrder>("CreateTime"))
                                                               .ToList <DataJoin <MemberDrawOrder, Member> >(size, pageIndex, out count);

            return(new SplitPageData <DataJoin <MemberDrawOrder, Member> >(pageIndex, size, list, (int)count));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据用户以及省市区获取购物车列表
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="userId"></param>
        /// <param name="province"></param>
        /// <param name="city"></param>
        /// <param name="county"></param>
        /// <returns></returns>
        public static IList <dynamic> GetPageByUser(DataSource ds, long userId, int province, int city, int county)
        {
            IList <dynamic> list;

            DbWhereQueue where = W <ProductCart>("UserId", userId) & (W <Product>("State", ProductState.Sale) | W <Product>("State", ProductState.BeforeSaved));
            DbWhereQueue areawhere = new DbWhereQueue();

            areawhere &= W <ProductAreaMapping>("Province", province);
            areawhere &= W <ProductAreaMapping>("City", city);
            areawhere &= W <ProductAreaMapping>("County", county);
            DbWhereQueue areaSaleswhere = new DbWhereQueue();

            areaSaleswhere &= (W <ProductSalesArea>("Province", province) | W <ProductSalesArea>("Province", 0));
            areaSaleswhere &= (W <ProductSalesArea>("City", city) | W <ProductSalesArea>("City", 0));
            areaSaleswhere &= (W <ProductSalesArea>("County", county) | W <ProductSalesArea>("County", 0));

            list = Db <ProductCart> .Query(ds).Select(S <ProductCart>(), S_AS <ProductSalesArea>("County", "ProductCart_County"), S <Product>("Id"), S <Product>("SortNum"), S <Product>("Inventory"), S <Product>("SaleTime"), S <Product>("Title"), S <Product>("Image"), S <Product>("DiscountState"), S <Product>("DiscountBeginTime"), S <Product>("DiscountEndTime"), S <Product>("DiscountPrice"), S <Product>("Price"), S <Product>("Wholesale"), S <Product>("WholesalePrice"), S <Product>("WholesaleCount"), S <Product>("WholesaleDiscount"), S <Product>("ProductType"), S <Product>("State"), S <ProductAreaMapping>())
                   .InnerJoin(O <ProductCart>("ProductId"), O <Product>("Id"))
                   .LeftJoin(O <ProductCart>("ProductId"), O <ProductAreaMapping>("ProductId")).Select().Where(areawhere).Result()
                   .LeftJoin(O <ProductCart>("ProductId"), O <ProductSalesArea>("ProductId")).Select().Where(areaSaleswhere).Result()
                   .Where(where)
                   .OrderBy(D <ProductCart>("CreationDate"))
                   .ToList();

            List <dynamic> newlist = new List <dynamic>();

            foreach (dynamic item in list)
            {
                newlist.Add(LoadDynamic(ds, item));
            }
            return(newlist);
        }
Ejemplo n.º 3
0
        public static SplitPageData <DataJoin <MemberDrawOrder, MemberBankInfo> > GetListByUserId(DataSource ds, long userid, int pageIndex, int size, DateTime stDate, DateTime endDate, DrawOrderStatus state, int show = 8)
        {
            long count;

            DbWhereQueue where = W <MemberDrawOrder>("UserId", userid);
            if (DateTime.MinValue != stDate)
            {
                where = where & W <MemberDrawOrder>("CreateTime", stDate.ToString("yyyy-MM-dd HH:mm:ss"), DbWhereType.GreaterThanOrEqual);
            }
            if (DateTime.MinValue != endDate)
            {
                endDate = stDate == endDate?endDate.Add(new TimeSpan(23, 59, 59)) : endDate;

                where = where & W <MemberDrawOrder>("CreateTime", endDate.ToString("yyyy-MM-dd HH:mm:ss"), DbWhereType.LessThanOrEqual);
            }
            if (state != DrawOrderStatus.None)
            {
                where = where & W("OrderState", (byte)state);
            }

            IList <DataJoin <MemberDrawOrder, MemberBankInfo> > list = Db <MemberDrawOrder>
                                                                       .Query(ds)
                                                                       .Select(S <MemberDrawOrder>(), S <MemberBankInfo>("Icon"))
                                                                       .LeftJoin(O <MemberDrawOrder>("BankName"), O <MemberBankInfo>("BankName"))
                                                                       .Where(where)
                                                                       .OrderBy(D <MemberDrawOrder>("CreateTime"))
                                                                       .ToList <DataJoin <MemberDrawOrder, MemberBankInfo> >(size, pageIndex, out count);

            return(new SplitPageData <DataJoin <MemberDrawOrder, MemberBankInfo> >(pageIndex, size, list, count, show));
        }
Ejemplo n.º 4
0
        public static SplitPageData <Supplier> GetBySubjection(DataSource ds, long subjectionid, string state, long index, int size, int show = 8)
        {
            long count;

            DbWhereQueue where = new DbWhereQueue();
            where = W("Subjection", subjectionid);
            if (!string.IsNullOrEmpty(state))
            {
                where &= W("State", state);
            }
            IList <Supplier> List = Db <Supplier> .Query(ds).Select().Where(where).OrderBy(D("UserId")).ToList <Supplier>(size, index, out count);

            return(new SplitPageData <Supplier>(index, size, List, count, show));
        }
Ejemplo n.º 5
0
        public static SplitPageData <LogisticsCompany> GetList(DataSource ds, string keyword, int index, int size, int show = 8)
        {
            long count;
            IList <LogisticsCompany> list;

            DbWhereQueue where = null;
            if (keyword != "_")
            {
                where = W("Name", keyword, DbWhereType.Like);
            }
            else
            {
                where = W("Id", 0, DbWhereType.NotEqual);
            }
            list = Db <LogisticsCompany> .Query(ds).Select().Where(where).OrderBy(D("Id")).ToList <LogisticsCompany>(size, index, out count);

            return(new SplitPageData <LogisticsCompany>(index, size, list, count, show));
        }
Ejemplo n.º 6
0
        public static bool Exists(DataSource ds, long productId, long serieId, string value)
        {
            DbWhereQueue where = new DbWhereQueue();
            where = (W("SerieId", serieId) & W("Value", value));
            IList <ProductMapping> Mappings = GetAllByProduct(ds, productId);
            long serieCount = Db <ProductSerie> .Query(ds).Select().Where(W("ProductId").InSelect <ProductSerie>("ProductId").Where(W("Id", serieId)).Result()).Count();

            if (Mappings.Count == serieCount || (Mappings.Count == serieCount - 1 && (GetBySerieIdAndProductId(ds, serieId, productId) <= 0)))
            {
                foreach (ProductMapping mapping in Mappings)
                {
                    if (mapping.SerieId != serieId)
                    {
                        where &= (W("ProductId").InSelect <ProductMapping>("ProductId").Where(W("SerieId", mapping.SerieId) & W("Value", mapping.Value)).GroupBy("ProductId").Result());
                    }
                }
                where = (where) & W("ProductId", productId, DbWhereType.NotEqual);
            }
            else
            {
                return(false);
            }
            return(Db <ProductMapping> .Query(ds).Select().Where(W("ProductId").InSelect <ProductMapping>("ProductId").Where(where).GroupBy("ProductId").Result()).Count() > 0);
        }
Ejemplo n.º 7
0
 public static IList <ProductAttributeMapping> GetAllByCategoryId(DataSource ds, int categoryId, int categorylevel)
 {
     DbWhereQueue where = W("Id", 0, DbWhereType.GreaterThan);
     if (categoryId > 0)
     {
         if (categorylevel == 3)
         {
             where &= W("CategoryId", categoryId);
         }
         else if (categorylevel == 2)
         {
             where &= (W("CategoryId", categoryId) | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result());
         }
         else if (categorylevel == 1)
         {
             where &= (W("CategoryId", categoryId) | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result() | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result()).Result());
         }
     }
     return(Db <ProductAttributeMapping> .Query(ds).Select(S("AttributeId"), S("Value"))
            .Where(W("AttributeId").InSelect <ProductAttribute>(S("Id")).Where(where).Result()
                   )
            .GroupBy(G("AttributeId"), G("Value"))
            .ToList <ProductAttributeMapping>());
 }
Ejemplo n.º 8
0
        public static IList <dynamic> GetCategoryByApiProductList(DataSource ds, int categoryId, int categorylevel, FilterParameters2 parameters, int productType = 1)
        {
            DbWhereQueue where = null;
            ///关键词
            if (!string.IsNullOrEmpty(parameters.KeyWord))
            {
                foreach (string s in parameters.KeyWord.Split(' '))
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        if (where == null)
                        {
                            where = W("Title", s, DbWhereType.Like);
                        }
                        else
                        {
                            where |= W("Title", s, DbWhereType.Like);
                        }
                    }
                }
            }
            else
            {
                where = W <Product>("Title", parameters.KeyWord, DbWhereType.Like);
            }
            where &= (W("State", ProductState.Sale) | W("State", ProductState.BeforeSaved)) & W("ParentId", 0);
            //分类
            if (categoryId > 0)
            {
                if (categorylevel == 3)
                {
                    where &= W("CategoryId", categoryId);
                }
                else if (categorylevel == 2)
                {
                    where &= (W("CategoryId", categoryId) | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result());
                }
                else if (categorylevel == 1)
                {
                    where &= (W("CategoryId", categoryId) | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result() | W("CategoryId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId").InSelect <ProductCategory>(S("Id")).Where(W("ParentId", categoryId)).Result()).Result());
                }
            }

            ///产品属性
            if (!string.IsNullOrEmpty(parameters.Attribute))
            {
                if (parameters.Attribute.IndexOf('@') != -1)
                {
                    string[] Attributes = parameters.Attribute.Split('@');
                    foreach (string Attr_Item in Attributes)
                    {
                        if (!string.IsNullOrEmpty(Attr_Item))
                        {
                            if (Attr_Item.IndexOf('_') != -1)
                            {
                                string[] Attr_Value = Attr_Item.Split('_');
                                if (!string.IsNullOrEmpty(Attr_Value[0]) && !string.IsNullOrEmpty(Attr_Value[1]))
                                {
                                    where &= (W("Id").InSelect <ProductAttributeMapping>(S("ProductId")).Where(W("AttributeId", long.Parse(Attr_Value[0].ToString())) & W("Value", Attr_Value[1].ToString())).Result());
                                }
                            }
                        }
                    }
                }
            }
            //供应类型
            if (parameters.SupplierType != -1)
            {
                where &= W("SupplierType", parameters.SupplierType);
            }
            if (parameters.Brand > 0)
            {
                where &= W("BrandId", parameters.Brand);
            }
            //}
            if (parameters.StoreId > 0)
            {
                where &= W("SupplierId", parameters.StoreId);
                if (parameters.StoreId > 0)
                {
                    where &= W("SupplierId", parameters.StoreId);
                    if (parameters.StoreCategoryId > 0)
                    {
                        if (Db <StoreCategory> .Query(ds).Select(S("ParentId")).Where(W("Id", parameters.StoreCategoryId)).First <StoreCategory>().ParentId > 0)
                        {
                            where &= W("StoreCategoryId", parameters.StoreCategoryId);
                        }
                        else
                        {
                            where &= (W("StoreCategoryId", parameters.StoreCategoryId) | W("StoreCategoryId").InSelect <StoreCategory>(S("Id")).Where(W("ParentId", parameters.StoreCategoryId)).Result());
                        }
                    }
                }
            }
            where &= W("ProductType", productType);

            IList <dynamic> list = Db <ProductCategory> .Query(ds).Select(S <ProductCategory>("*"))
                                   .Where(W("Id").InSelect <Product>(S("CategoryId")).Where(where).Result())
                                   .ToList();

            return(list);
        }