Esempio n. 1
0
        public List <OPC_Sale> GetListByNos(List <string> salesOrderNos, SaleOrderFilter filter)
        {
            var query = Filler(filter);

            query = PredicateBuilder.And(query, v => salesOrderNos.Contains(v.SaleOrderNo));
            return(Func(db => EFHelper.Get(db, query).ToList()));
        }
Esempio n. 2
0
        /// <summary>
        /// Order 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Order, bool> > OrderFilter(RmaQueryRequest filter)
        {
            var query = PredicateBuilder.True <Order>();

            if (filter != null)
            {
                if (filter.OrderProductType != null)
                {
                    query = PredicateBuilder.And(query, v => v.OrderProductType == filter.OrderProductType);
                }

                //购买时间
                if (filter.BuyStartDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate >= filter.BuyStartDate.Value);
                }

                if (filter.BuyEndDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate < filter.BuyEndDate.Value);
                }

                if (!String.IsNullOrEmpty(filter.PayType))
                {
                    query = PredicateBuilder.And(query, v => v.PaymentMethodCode == filter.PayType);
                }
            }

            return(query);
        }
Esempio n. 3
0
        /// <summary>
        /// 订单 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Order, bool> > OrderFiller(OrderQueryRequest filter)
        {
            var query = PredicateBuilder.True <Order>();

            if (filter != null)
            {
                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.Status == filter.Status.Value);
                }

                if (!String.IsNullOrWhiteSpace(filter.OrderNo))
                {
                    query = PredicateBuilder.And(query, v => v.OrderNo == filter.OrderNo);

                    return(query);
                }

                if (!String.IsNullOrWhiteSpace(filter.ExpressDeliveryCode))
                {
                    query = PredicateBuilder.And(query, v => v.ShippingNo == filter.ExpressDeliveryCode);

                    return(query);
                }

                if (!String.IsNullOrWhiteSpace(filter.ShippingNo))
                {
                    query = PredicateBuilder.And(query, v => v.ShippingNo == filter.ShippingNo);

                    return(query);
                }

                if (!String.IsNullOrWhiteSpace(filter.OrderSource))
                {
                    query = PredicateBuilder.And(query, v => v.OrderSource == filter.OrderSource);
                }

                if (!String.IsNullOrWhiteSpace(filter.ShippingContactPhone))
                {
                    query = PredicateBuilder.And(query, v => v.ShippingContactPhone == filter.ShippingContactPhone);
                }

                if (filter.ExpressDeliveryCompany != null)
                {
                    query = PredicateBuilder.And(query, v => v.ShippingVia == filter.ExpressDeliveryCompany);
                }

                if (filter.StartCreateDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate >= filter.StartCreateDate);
                }

                if (filter.EndCreateDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate < filter.EndCreateDate);
                }
            }

            return(query);
        }
Esempio n. 4
0
        /// <summary>
        /// OrderTransactionFiller
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <OrderTransaction, bool> > OrderTransactionFiller(SearchStatRequest filter)
        {
            var query = PredicateBuilder.True <OrderTransaction>();

            if (filter == null)
            {
                return(query);
            }

            if (!String.IsNullOrWhiteSpace(filter.OrderChannelNo))
            {
                query = PredicateBuilder.And(query, v => v.TransNo == filter.OrderChannelNo);
            }


            var c = filter as SearchCashierRequest;

            if (c != null)
            {
                //TODO: 确认下 客户端传来的是 code 还是name
                if (!String.IsNullOrWhiteSpace(c.PayType))
                {
                    query = PredicateBuilder.And(query, v => v.PaymentCode == c.PayType);
                }
            }

            return(query);
        }
Esempio n. 5
0
        /// <summary>
        /// Order
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Order, bool> > OrderFiller(SearchStatRequest filter)
        {
            var query = PredicateBuilder.True <Order>();

            if (filter == null)
            {
                return(query);
            }

            //订单号与时间互斥
            if (!String.IsNullOrWhiteSpace(filter.OrderNo))
            {
                query = PredicateBuilder.And(query, v => v.OrderNo == filter.OrderNo);
                return(query);
            }


            if (filter.StartDate != null)
            {
                query = PredicateBuilder.And(query, v => v.CreateDate >= filter.StartDate);
            }

            if (filter.EndDate != null)
            {
                query = PredicateBuilder.And(query, v => v.CreateDate < filter.EndDate);
            }

            return(query);
        }
Esempio n. 6
0
        private static Expression <Func <Section, bool> > Filter4Section(BrandFilter filter)
        {
            var query = PredicateBuilder.True <Section>();

            if (filter != null)
            {
                if (filter.CounterId != null)
                {
                    //return v => v.SectionId == filter.CounterId;
                    query = PredicateBuilder.And(query, v => v.Id == filter.CounterId);
                }

                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.Status == filter.Status.Value);
                }
                else
                {
                    query = PredicateBuilder.And(query, v => v.Status > 0);
                }
            }

            return(query);
            //return v => true;
        }
        private static Expression <Func <Department, bool> > Filter(DepartmentQueryRequest filter)
        {
            var query = PredicateBuilder.True <Department>();

            if (filter != null)
            {
                if (!String.IsNullOrWhiteSpace(filter.NamePrefix))
                {
                    query = PredicateBuilder.And(query, v => v.Name.StartsWith(filter.NamePrefix));
                }

                if (!String.IsNullOrWhiteSpace(filter.Name))
                {
                    query = PredicateBuilder.And(query,
                                                 v => v.Name.Equals(filter.Name));
                }

                if (filter.StoreId != null)
                {
                    query = PredicateBuilder.And(query, v => v.StoreId == filter.StoreId.Value);
                }

                if (filter.StoreId == null && filter.DataRoleStores != null)
                {
                    query = PredicateBuilder.And(query, v => filter.DataRoleStores.Contains(v.StoreId));
                }
            }

            return(query);
        }
Esempio n. 8
0
        private static Expression <Func <OPC_AuthUser, bool> > OPC_AuthUserFiller(bool?incloudSystem, List <string> authdatastartsWith, string name = null, string logonName = null)
        {
            var query = PredicateBuilder.True <OPC_AuthUser>();

            if (authdatastartsWith != null && authdatastartsWith.Count > 0)
            {
                foreach (var str in authdatastartsWith)
                {
                    var str1 = str;
                    query = PredicateBuilder.And(query, v => v.DataAuthId.StartsWith(str1));
                }
            }

            if (incloudSystem != null)
            {
                query = PredicateBuilder.And(query, v => v.IsSystem == incloudSystem);
            }

            if (!String.IsNullOrEmpty(name))
            {
                query = PredicateBuilder.And(query, v => v.Name.Contains(name));
            }

            if (!String.IsNullOrEmpty(logonName))
            {
                query = PredicateBuilder.And(query, v => v.LogonName.Contains(logonName));
            }

            return(query);
        }
Esempio n. 9
0
        private static Expression <Func <Brand, bool> > Filter(BrandFilter filter)
        {
            var query = PredicateBuilder.True <Brand>();

            if (filter != null)
            {
                if (!String.IsNullOrWhiteSpace(filter.NamePrefix))
                {
                    query = PredicateBuilder.And(query, v => v.Name.StartsWith(filter.NamePrefix) || v.EnglishName.StartsWith(filter.NamePrefix));
                }

                if (!String.IsNullOrWhiteSpace(filter.Name))
                {
                    query = PredicateBuilder.And(query,
                                                 v => v.Name.Equals(filter.Name) || v.EnglishName.Equals(filter.Name));
                }

                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.Status == filter.Status.Value);
                }
                else
                {
                    query = PredicateBuilder.And(query, v => v.Status > 0);
                }
            }

            return(query);
        }
Esempio n. 10
0
        /// <summary>
        /// 礼品卡表 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <IMS_AssociateIncomeRequest, bool> > CashAssociateCommissionStatisticsReportFilter(CashAssociateCommissionStatisticsReportRequest filter)
        {
            var query = PredicateBuilder.True <IMS_AssociateIncomeRequest>();

            if (!String.IsNullOrEmpty(filter.BankName))
            {
                query = PredicateBuilder.And(query, v => v.BankName == filter.BankName);
                return(query);
            }

            if (!String.IsNullOrEmpty(filter.BankCode))
            {
                query = PredicateBuilder.And(query, v => v.BankCode == filter.BankCode);
                return(query);
            }

            if (filter.PickUpStartDate != null)
            {
                query = PredicateBuilder.And(query, v => v.CreateDate >= filter.PickUpStartDate);
            }

            if (filter.PickUpEndDate != null)
            {
                query = PredicateBuilder.And(query, v => v.CreateDate < filter.PickUpEndDate);
            }

            return(query);
        }
Esempio n. 11
0
        /// <summary>
        /// 礼品卡表 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <IMS_GiftCardOrder, bool> > GiftCardOrderFilter(GiftCardSalesStatisticsReportRequest filter)
        {
            var query = PredicateBuilder.True <IMS_GiftCardOrder>();

            if (!String.IsNullOrEmpty(filter.GiftCardNo))
            {
                query = PredicateBuilder.And(query, v => v.No == filter.GiftCardNo);
                return(query);
            }

            if (!String.IsNullOrEmpty(filter.TransNo))
            {
            }
            else
            {
                if (filter.BuyStartDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate >= filter.BuyStartDate);
                }

                if (filter.BuyEndDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate < filter.BuyEndDate);
                }
            }

            return(query);
        }
Esempio n. 12
0
        private static Expression <Func <OPC_AuthRoleUser, bool> > OPC_AuthRoleUsersFiller(int?roleid)
        {
            var query = PredicateBuilder.True <OPC_AuthRoleUser>();

            if (roleid != null)
            {
                query = PredicateBuilder.And(query, v => v.OPC_AuthRoleId == roleid);
            }

            return(query);
        }
Esempio n. 13
0
        /// <summary>
        /// 渠道订单 筛选
        /// </summary>
        /// <param name="transNo"></param>
        /// <returns></returns>
        private static Expression <Func <OrderTransaction, bool> > OrderTransactionFilter(string transNo)
        {
            var query = PredicateBuilder.True <OrderTransaction>();

            if (!String.IsNullOrEmpty(transNo))
            {
                query = PredicateBuilder.And(query, v => v.TransNo == transNo);
                return(query);
            }

            return(query);
        }
Esempio n. 14
0
        /// <summary>
        /// 支付方式筛选
        /// </summary>
        /// <param name="paymentCode"></param>
        /// <returns></returns>
        private static Expression <Func <PaymentMethod, bool> > PaymentFilter(string paymentCode)
        {
            var query = PredicateBuilder.True <PaymentMethod>();

            if (!String.IsNullOrEmpty(paymentCode))
            {
                query = PredicateBuilder.And(query, v => v.Code == paymentCode);
                return(query);
            }

            return(query);
        }
Esempio n. 15
0
        /// <summary>
        /// 专柜表 筛选
        /// </summary>
        /// <param name="sectoinCode"></param>
        /// <returns></returns>
        private static Expression <Func <Section, bool> > SectionFilter(string sectoinCode)
        {
            var query = PredicateBuilder.True <Section>();

            if (!String.IsNullOrEmpty(sectoinCode))
            {
                query = PredicateBuilder.And(query, v => v.SectionCode == sectoinCode);
            }



            return(query);
        }
Esempio n. 16
0
        private static Expression <Func <OPC_ShippingSale, bool> > Filter(ShippingOrderFilter filter)
        {
            var query = PredicateBuilder.True <OPC_ShippingSale>();

            if (filter != null)
            {
                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.ShippingStatus == (int)filter.Status);
                }

                if (filter.StoreIds != null)
                {
                    query = PredicateBuilder.And(query, v => filter.StoreIds.Contains(v.StoreId ?? -1));
                }

                //订单号互斥 时间
                if (filter.OrderNo != null)
                {
                    query = PredicateBuilder.And(query, v => v.OrderNo == filter.OrderNo);
                    return(query);
                }

                if (!String.IsNullOrWhiteSpace(filter.ExpressNo))
                {
                    query = PredicateBuilder.And(query, v => v.ShippingCode == filter.ExpressNo);

                    return(query);
                }



                //发货时间 目前数据库中没这个字段
                if (filter.ShipStartDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate >= filter.ShipStartDate);
                }

                if (filter.ShipEndDate != null)
                {
                    query = PredicateBuilder.And(query, v => v.CreateDate < filter.ShipEndDate);
                }

                if (!String.IsNullOrWhiteSpace(filter.CustomersPhoneNumber))
                {
                    query = PredicateBuilder.And(query, v => v.ShippingContactPhone == filter.CustomersPhoneNumber);
                }
            }

            return(query);
        }
Esempio n. 17
0
        /// <summary>
        /// oRDER 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Order, bool> > Order4Filler(SaleOrderFilter filter)
        {
            var query = PredicateBuilder.True <Order>();

            if (filter != null)
            {
                if (filter.OrderProductType != null)
                {
                    query = PredicateBuilder.And(query, v => v.OrderProductType == filter.OrderProductType.Value);
                }
            }

            return(query);
        }
Esempio n. 18
0
        /// <summary>
        /// section_brand filter
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <IMS_SectionBrand, bool> > Filter4SectionBrand(SectionFilter filter)
        {
            var query = PredicateBuilder.True <IMS_SectionBrand>();

            if (filter != null)
            {
                if (filter.BrandId != null)
                {
                    query = PredicateBuilder.And(query, v => v.BrandId == filter.BrandId);
                }
            }

            return(query);
        }
Esempio n. 19
0
        /// <summary>
        /// 销售单 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <OPC_Sale, bool> > SalesOrderFilter(RmaQueryRequest filter)
        {
            var query = PredicateBuilder.True <OPC_Sale>();

            if (filter != null)
            {
                if (!String.IsNullOrEmpty(filter.SalesOrderNo))
                {
                    query = PredicateBuilder.And(query, v => v.SaleOrderNo == filter.SalesOrderNo);
                }
            }

            return(query);
        }
Esempio n. 20
0
        private static Expression <Func <OrderTransaction, bool> > OrderTransactionFiller(OrderQueryRequest filter)
        {
            var query = PredicateBuilder.True <OrderTransaction>();

            if (filter != null)
            {
                if (!String.IsNullOrWhiteSpace(filter.PaymentType))
                {
                    //TODO: 确认下 客户端传来的是 code 还是 name
                    query = PredicateBuilder.And(query, v => v.PaymentCode == filter.PaymentType);
                }
            }

            return(query);
        }
Esempio n. 21
0
        private static Expression <Func <IMS_SectionBrand, bool> > Filter4SectionBrand(BrandFilter filter)
        {
            var query = PredicateBuilder.True <IMS_SectionBrand>();

            if (filter != null)
            {
                if (filter.CounterId != null)
                {
                    //return v => v.SectionId == filter.CounterId;
                    query = PredicateBuilder.And(query, v => v.SectionId == filter.CounterId);
                }
            }

            return(query);
            //return v => true;
        }
        /// <summary>
        /// 专柜表 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Section, bool> > SectionFilter(AssociateQueryRequest filter)
        {
            var query = PredicateBuilder.True <Section>();

            if (!String.IsNullOrEmpty(filter.SectionCode))
            {
                query = PredicateBuilder.And(query, v => v.SectionCode == filter.SectionCode);
            }

            if (filter.Departmentid != null)
            {
                query = PredicateBuilder.And(query, v => v.DepartmentId == filter.Departmentid.Value);
            }

            return(query);
        }
Esempio n. 23
0
        /// <summary>
        /// store 筛选
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="datarolestores"></param>
        /// <returns></returns>
        private static Expression <Func <Store, bool> > StoreFilter(int?storeId, ICollection <int> datarolestores)
        {
            var query = PredicateBuilder.True <Store>();

            if (storeId != null)
            {
                query = PredicateBuilder.And(query, v => v.Id == storeId.Value);
            }

            if (storeId == null && datarolestores != null)
            {
                query = PredicateBuilder.And(query, v => datarolestores.Contains(v.Id));
            }

            return(query);
        }
Esempio n. 24
0
        /// <summary>
        /// 用户 筛选
        /// </summary>
        /// <param name="nickname">昵称</param>
        /// <param name="contract">联系方式</param>
        /// <returns></returns>
        private static Expression <Func <User, bool> > UserFilter(string nickname, string contract)
        {
            var query = PredicateBuilder.True <User>();

            if (!String.IsNullOrEmpty(nickname))
            {
                query = PredicateBuilder.And(query, v => v.Nickname == nickname);
            }

            if (!String.IsNullOrEmpty(contract))
            {
                query = PredicateBuilder.And(query, v => v.Mobile == contract);
            }

            return(query);
        }
Esempio n. 25
0
        /// <summary>
        /// SaleDetailFiller
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <OPC_SaleDetail, bool> > SaleDetailFiller(SearchStatRequest filter)
        {
            var query = PredicateBuilder.True <OPC_SaleDetail>();

            if (filter == null)
            {
                return(query);
            }

            if (!String.IsNullOrWhiteSpace(filter.SalesOrderNo))
            {
                query = PredicateBuilder.And(query, v => v.SaleOrderNo == filter.SalesOrderNo);
            }


            return(query);
        }
Esempio n. 26
0
        /// <summary>
        /// STORE 筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Store, bool> > Store4Filler(SaleOrderFilter filter)
        {
            var query = PredicateBuilder.True <Store>();

            if (filter != null)
            {
                if (filter.StoreId != null)
                {
                    query = PredicateBuilder.And(query, v => v.Id == filter.StoreId.Value);
                }

                if (filter.StoreId == null && filter.DataRoleStores != null && filter.DataRoleStores.Count > 0)
                {
                    query = PredicateBuilder.And(query, v => filter.DataRoleStores.Contains(v.Id));
                }
            }

            return(query);
        }
Esempio n. 27
0
        /// <summary>
        /// section filter
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Section, bool> > Filter(SectionFilter filter)
        {
            var query = PredicateBuilder.True <Section>();

            if (filter != null)
            {
                if (!String.IsNullOrWhiteSpace(filter.NamePrefix))
                {
                    query = PredicateBuilder.And(query, v => v.Name.StartsWith(filter.NamePrefix));
                }

                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.Status == filter.Status);
                }
                else
                {
                    query = PredicateBuilder.And(query, v => v.Status >= 0);
                }

                if (!String.IsNullOrWhiteSpace(filter.Name))
                {
                    query = PredicateBuilder.And(query, v => v.Name == filter.Name);
                }

                if (filter.StoreId != null)
                {
                    query = PredicateBuilder.And(query, v => v.StoreId == filter.StoreId);
                }

                if (filter.DataRoleStores != null && filter.StoreId == null)
                {
                    query = PredicateBuilder.And(query, v => filter.DataRoleStores.Contains(v.StoreId.HasValue ? v.StoreId.Value : -1));
                }

                if (!String.IsNullOrWhiteSpace(filter.SectionCode))
                {
                    query = PredicateBuilder.And(query, v => v.SectionCode == filter.SectionCode);
                }
            }

            return(query);
        }
Esempio n. 28
0
        private static Expression <Func <OPC_OrgInfo, bool> > OPC_OrgInfoFiller(List <string> startsWith, EnumOrgType?type)
        {
            var query = PredicateBuilder.True <OPC_OrgInfo>();

            if (type != null)
            {
                query = PredicateBuilder.And(query, v => v.OrgType == type.AsId());
            }

            if (startsWith != null && startsWith.Count > 0)
            {
                foreach (var str in startsWith)
                {
                    var str1 = str;
                    query = PredicateBuilder.And(query, v => v.OrgID.StartsWith(str1));
                }
            }

            return(query);
        }
        /// <summary>
        /// 用户表筛选
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <User, bool> > UserFilter(AssociateQueryRequest filter)
        {
            var query = PredicateBuilder.True <User>();

            if (!String.IsNullOrEmpty(filter.OperatorName))
            {
                query = PredicateBuilder.And(query, v => v.Nickname == filter.OperatorName);
            }

            if (!String.IsNullOrEmpty(filter.MobileNo))
            {
                query = PredicateBuilder.And(query, v => v.Mobile == filter.MobileNo);
            }

            if (!String.IsNullOrEmpty(filter.EMail))
            {
                query = PredicateBuilder.And(query, v => v.EMail == filter.EMail);
            }

            return(query);
        }
Esempio n. 30
0
        /// <summary>
        /// StoreFiller 包含了权限判断
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        private static Expression <Func <Store, bool> > StoreFiller(SearchStatRequest filter)
        {
            var query = PredicateBuilder.True <Store>();

            if (filter == null)
            {
                return(query);
            }

            if (filter.StoreId != null)
            {
                query = PredicateBuilder.And(query, v => v.Id == filter.StoreId);
            }

            if (filter.DataRoleStores != null && filter.StoreId == null)
            {
                query = PredicateBuilder.And(query, v => filter.DataRoleStores.Contains(v.Id));
            }

            return(query);
        }