コード例 #1
0
        public IQueryable//<YuShang.ERP.Entities.Orders.OrderContract>
        BuildQueryWithEntityControl(IOwinContext owinContext,
                                    ExtendedIdentityDbContext db, IQueryable tempDbQuery,
                                    //IQueryable<YuShang.ERP.Entities.Orders.OrderContract> tempDbQuery,
                                    EntityControlType entityControlType, string userName)
        {
            IList <string> roles           = null;
            bool           highLevelPeople = PrivilegeManager.Instance.IsHighLevelPrivilege(
                owinContext, userName, entityControlType, out roles);

            if (highLevelPeople == false && roles != null && roles.Count > 0)
            {//需要加入条件,控制访问者只能看到其下级的数据
                if (entityControlType == EntityControlType.OrderContract)
                {
                    BasicOrderContractEntityPrivilegeStrategy strategy
                        = this.GetOrderContractEntityTypeStrategy();

                    return(strategy.AddEntityControlCondition(db, entityControlType,
                                                              tempDbQuery as IQueryable <OrderContract>, userName, roles));
                }
                else if (entityControlType == EntityControlType.SaleContract)
                {
                    BasicSaleContractEntityPrivilegeStrategy strategy
                        = this.GetSaleContractEntityTypeStrategy();

                    return(strategy.AddEntityControlCondition(db, entityControlType,
                                                              tempDbQuery as IQueryable <SaleContract>, userName, roles));
                }
            }

            return(tempDbQuery);
        }
コード例 #2
0
        public IQueryable <ProductItem> GetIndexListProductItemByHKLogistics(
            ExtendedIdentityDbContext dbContext, IQueryable <ProductItem> sourceQuery,
            string logisticsCompanyName, DateTime?ReceiveTimeFrom, DateTime?ReceiveTimeTo,
            string userName)
        {
            IQueryable <ProductItem> query = sourceQuery;

            //dbContext.ProductItems.AsNoTracking();

            if (!string.IsNullOrWhiteSpace(logisticsCompanyName))
            {
                string temp = logisticsCompanyName.Trim();
                query = query.Where(p => p.OrderContract.HongKongLogistics != null &&
                                    p.OrderContract.HongKongLogistics.HKLogisCompany.
                                    CompanyName.ToLowerInvariant().Contains(temp));
            }

            if (ReceiveTimeFrom.HasValue && ReceiveTimeTo.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value >= ReceiveTimeTo.Value &&
                                    q.ReceiveTime.Value <= ReceiveTimeTo.Value);
            }
            else if (ReceiveTimeFrom.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value >= ReceiveTimeFrom.Value);
            }
            else if (ReceiveTimeTo.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value <= ReceiveTimeTo.Value);
            }
            else
            {
                //不需要加条件
            }

            #region old
            //query = CombineTimeSpan(dbContext, ReceiveTimeFrom, ReceiveTimeTo, query);

            //List<int> ids = new List<int>();

            //FilterByHKLogisComName(dbContext, logisticsCompanyName, ids);

            //var orderContractIds = ids.Distinct();
            //if (orderContractIds != null && orderContractIds.Count() > 0)
            //{//查出来ID,那就需要加入这个条件
            //    query = query.Where(
            //        ord => orderContractIds.Contains(ord.OrderContractId));
            //}
            #endregion

            //TODO: Filter OrderContract by userName
            if (!string.IsNullOrWhiteSpace(userName))
            {//TODO: add query condition to query
            }

            return(query);
        }
コード例 #3
0
        public ProductItemViewModel GetIndexListProductItemsNonStock(
            IOwinContext owinContext, ExtendedIdentityDbContext db,
            ContractListCondition condition, ProductItemStatus?productItemStatus)
        {
            //Debug: 先不管那么多,只返回最简单的
            if (owinContext == null)
            {
                throw new ArgumentNullException("owinContext");
            }
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            if (condition == null || condition.IsEnable == false)
            {
                var defCondition = ContractListCondition.GetDefault();
                defCondition.OrderField = ContractOrderField.CONTRACT_KEY_ASC;
                defCondition.UserName   = owinContext.Authentication.User.Identity.Name;
                return(this.GetIndexListProductItemsNonStock(db, owinContext,
                                                             defCondition, productItemStatus));
            }

            return(this.GetIndexListProductItemsNonStock(db, owinContext,
                                                         condition, productItemStatus));

            //return new ProductItemViewModel() { IsEnable = false };
        }
コード例 #4
0
        private ContractInfo FindOrderContractBy(ExtendedIdentityDbContext db,
                                                 IOwinContext context, string contractKey, ContractListCondition condition)
        {
            DbQuery <OrderContract> contractQuery = db.OrderContracts.Include("OrderProducts.Product");

            //ContractListInclude include = ContractListInclude.None;
            if ((ContractListInclude.WithHarborAgent & condition.ListInclude)
                == ContractListInclude.WithHarborAgent)
            {
                contractQuery = contractQuery.Include("HarborAgent.DeclarationCompany");
            }
            if ((ContractListInclude.WithHongkongLogistics & condition.ListInclude)
                == ContractListInclude.WithHongkongLogistics)
            {
                contractQuery = contractQuery.Include("HongKongLogistics.HongKongLogisticsItems.ProductItem.Product");
                contractQuery = contractQuery.Include("HongKongLogistics.HKLogisCompany");
            }
            if ((ContractListInclude.WithMainlandLogistics & condition.ListInclude)
                == ContractListInclude.WithMainlandLogistics)
            {
                contractQuery = contractQuery.Include("MainlandLogistics.MainlandLogisticsItems.ProductItem.Product");
                contractQuery = contractQuery.Include("MainlandLogistics.MLLogisCompany");
            }

            return(FindOrderContractBy(db, context, contractKey, condition, contractQuery));
        }
コード例 #5
0
 public IQueryable <YuShang.ERP.Entities.Sale.SaleContract> GetIndexListSaleContract(
     ExtendedIdentityDbContext dbContext, int?orderType, DateTime?DateFrom, DateTime?DateTo,
     string filterValue, string userName, out int count)
 {
     return(m_saleContractImpl.GetIndexListSaleContract(dbContext, orderType,
                                                        DateFrom, DateTo, filterValue, userName, out count));
 }
コード例 #6
0
 public IQueryable <OrderContract> GetIndexListOrderContract(IOwinContext owinContext,
                                                             ExtendedIdentityDbContext dbContext, DateTime?ETA, string filterValue,
                                                             string userName, out int count)
 {
     return(m_orderContractImpl.GetIndexListOrderContract(owinContext,
                                                          dbContext, ETA, filterValue, userName, out count));
 }
コード例 #7
0
        public ContractInfo FindBy(ExtendedIdentityDbContext db, IOwinContext context,
                                   string contractKey, ContractViewModelType contractType, ContractListCondition condition)
        {
            if (db == null || context == null)
            {
                throw new ArgumentNullException();
            }

            if (contractType != ContractViewModelType.OrderContract)
            {
                if (condition == null || condition.IsEnable.GetValueOrDefault() == false)
                {
                    var first = db.SaleContracts.FirstOrDefault(
                        m => m.SaleContractKey == contractKey);
                    if (first != null)
                    {
                        return(new ContractInfo(first));
                    }
                }
                else
                {
                    return(this.FindSaleContractBy(db, context, contractKey, condition));
                }
            }
            else
            {
                if (condition == null || condition.IsEnable.GetValueOrDefault() == false)
                {
                    return(this.FindOrderContractBy(db, context, contractKey, null, null));
                }
                return(this.FindOrderContractBy(db, context, contractKey, condition));
            }

            return(null);
        }
コード例 #8
0
 public ApplicationUserManager(
     IUserStore <YuShang.ERP.Entities.Privileges.SysUser, int> store,
     ExtendedIdentityDbContext db)
     : base(store)
 {
     this.DbContext = db;
 }
コード例 #9
0
 /// <summary>
 /// 获取订单列表,根据IOrderContractPrivilegeFilter过滤。
 /// 只返回IQueryable对象,外面业务层决定分页逻辑
 /// </summary>
 /// <param name="db"></param>
 /// <param name="filter"></param>
 /// <param name="ProductsTotal">商品数量小计</param>
 /// <param name="PaymentTotal">采购额小计</param>
 /// <returns></returns>
 public IQueryable <OrderContract> GetIndexListOrderContract(IOwinContext context,
                                                             ExtendedIdentityDbContext db, IOrderContractPrivilegeFilter filter,
                                                             out double ProductsTotal, out double PaymentTotal)
 {
     return(m_orderContractImpl.GetIndexListOrderContract(context,
                                                          db, filter, out ProductsTotal, out PaymentTotal));
 }
コード例 #10
0
 private IEnumerable <YuShang.ERP.Entities.ResMgr.Supplier> GetSuppliersCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.Suppliers.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false)
                .OrderBy(m => m.SupplierName).ToList());
     }
 }
コード例 #11
0
 private IEnumerable <StoreHouse> GetStoreHousesCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.StoreHouses.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false)
                .OrderBy(m => m.StoreHouseName).ToList());
     }
 }
コード例 #12
0
 private IEnumerable <SaleClient> GetSaleClientsCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.SaleClients.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false)
                .OrderBy(m => m.CompanyName).ToList());
     }
 }
コード例 #13
0
 private IEnumerable <MainlandLogisticsCompany> GetMainlandLogisticsCompaniesCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.MainlandLogistics.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false || m.MainlandLogisticsCompanyId == 0)
                .OrderBy(m => m.MainlandLogisticsCompanyId).ThenBy(m => m.CompanyName).ToList());
     }
 }
コード例 #14
0
 private IEnumerable <Harbor> GetHarborsCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.Harbors.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false)
                .OrderBy(m => m.HarborNameENG).ToList());
     }
 }
コード例 #15
0
 private IEnumerable <Product> GetProductsCore()
 {
     using (ExtendedIdentityDbContext dxContext = ExtendedIdentityDbContext.Create())
     {
         return(dxContext.Products.AsNoTracking().AsParallel()
                .Where(m => m.IsDeleted == false)
                .OrderBy(m => m.ProductName).ToList());
     }
 }
コード例 #16
0
 public IQueryable <ProductItem> GetIndexListProductItemByReceiveFilter(
     ExtendedIdentityDbContext dbContext, IQueryable <ProductItem> sourceQuery,
     string receiveFilterValue, DateTime?OrderCreateTimeFrom, DateTime?OrderCreateTimeTo,
     string userName)
 {
     return(m_orderContractImpl.GetIndexListProductItemByReceiveFilter(dbContext,
                                                                       sourceQuery, receiveFilterValue, OrderCreateTimeFrom,
                                                                       OrderCreateTimeTo, userName));
 }
コード例 #17
0
        protected PrivilegeManager()
        {
            m_dbContext = ExtendedIdentityDbContext.Create();

            //this.m_userManager = new PrivilegeFramework.ApplicationUserManager(
            //    new UserStore<YuShang.ERP.Entities.Privileges.SysUser, SysRole,
            //        int, SysUserLogin, SysUserRole, SysUserClaim>(
            //        m_dbContext), m_dbContext);
        }
コード例 #18
0
 public IdentityManager(PrivilegeFramework.ExtendedIdentityDbContext db)
 {
     this._db          = db;
     this._userManager =
         new ApplicationUserManager(
             new UserStore <YuShang.ERP.Entities.Privileges.SysUser, SysRole,
                            int, SysUserLogin, SysUserRole, SysUserClaim>(
                 this._db), this._db);
     this._roleManager = new ApplicationRoleManager(this._db);
 }
コード例 #19
0
        public string AddOrUpdateSaleClaimCompensation(IOwinContext owinContext,
                                                       ExtendedIdentityDbContext db, SaleClaimCompensation model, SaleCompensationInfoItem viewModel)
        {
            try
            {
                if (model == null)
                {//新建索赔
                    model = db.SaleClaimCompensations.Create();
                    if (viewModel.SaleProductItemId.HasValue)
                    {
                        var saleItem = db.SaleProductItems.Find(viewModel.SaleProductItemId.Value);

                        if (saleItem != null)
                        {
                            saleItem.SaleContract.ClaimCompensation = model;
                            db.SaleClaimCompensations.Add(model);
                        }
                    }
                }

                if (model != null)
                {
                    var compItem = db.SaleClaimCompensationItems.FirstOrDefault(
                        m => m.SaleProductItemId == viewModel.SaleProductItemId.Value);
                    if (compItem == null)
                    {
                        compItem = db.SaleClaimCompensationItems.Create();
                        model.SaleClaimCompensationItems.Add(compItem);
                        db.SaleClaimCompensationItems.Add(compItem);
                    }
                    compItem.SaleProductItemId  = viewModel.SaleProductItemId.Value;
                    compItem.CompensationReason = viewModel.CompensationReason;
                    compItem.Compensation       = viewModel.Compensation.GetValueOrDefault();
                }

                int rec = db.SaveChanges();
                if (rec < 1)
                {
                    return("销售索赔失败。");
                }
            }
            catch (Exception e)
            {
                string errorMsg = "销售索赔失败。" + e.Message;
                LogHelper.Error(errorMsg, e);
                if ((e is AggregateException) && (e as AggregateException).InnerException != null)
                {
                    LogHelper.Error(errorMsg, (e as AggregateException).InnerException);
                    errorMsg += "\t\t" + (e as AggregateException).InnerException.Message;
                }
                return(errorMsg);
            }
            return(string.Empty);
        }
コード例 #20
0
        private ContractViewModel GetIndexListContractsBothOrderAndSale(
            ExtendedIdentityDbContext db, IOwinContext context,
            ContractListCondition condition, IQueryable <OrderContract> orderQuery,
            IQueryable <SaleContract> saleQuery)
        {
            List <ContractInfo> viewModels = new List <ContractInfo>();

            UnionRecords(condition, orderQuery, saleQuery, viewModels);

            var finalResult = HandleOrderBy(condition, viewModels);

            return(finalResult);
        }
コード例 #21
0
        public string AddStockOutForUpdateStockItem(ExtendedIdentityDbContext db,
                                                    StockOutRecord model, string userName)
        {
            try
            {
                StockItem stockItem = db.StockItems.Find(model.StockItemId);
                if (stockItem != null)
                {
                    StockOutRecord record = this.GetStockOutRecord(
                        db, stockItem, model);
                    record.OperatorSysUserName = userName;
                    stockItem.StockOutRecords.Add(record);

                    var outWeight = stockItem.StockOutRecords.Sum(
                        m => m.StockWeight.GetValueOrDefault());
                    if (outWeight <= 0)
                    {
                        stockItem.StockStatus = StockStatus.InStock;
                    }
                    else if (stockItem.StockWeight.GetValueOrDefault() > outWeight)
                    {
                        stockItem.StockStatus = StockStatus.InStockSelling;
                    }
                    else
                    {
                        stockItem.StockStatus = StockStatus.IsSold;
                        stockItem.IsAllSold   = true;
                    }
                    return(AppBusinessManager.Instance.AddOrUpdateStockItem(
                               db, stockItem, userName));
                }
                return("找不到对应的库存,可能已经出仓。");
            }
            catch (Exception e)
            {
                string errorMsg = string.Format("库存出仓失败。发生异常:{0}", e.Message);
                LogHelper.Error(errorMsg, e);
                if ((e is AggregateException) &&
                    (e as AggregateException).InnerException != null)
                {
                    var tmp = (e as AggregateException).InnerException;
                    errorMsg += tmp.Message;
                    LogHelper.Error(errorMsg, tmp);
                }
                return(errorMsg);
            }
        }
コード例 #22
0
        private StockOutRecord GetStockOutRecord(ExtendedIdentityDbContext db,
                                                 StockItem stockItem, StockOutRecord model)
        {
            StockOutRecord record = db.StockOutRecords.Create();

            record.StockItemId            = model.StockItemId;
            record.StockWeight            = model.StockWeight;
            record.StockOutDate           = DateTime.Now;
            record.SaleContractId         = model.SaleContractId;
            record.RemainderStockWeight   = model.RemainderStockWeight;
            record.RemainderQuantity      = model.RemainderQuantity;
            record.Quantity               = model.Quantity;
            record.InventoriesFeeSubTotal = model.InventoriesFeeSubTotal;
            record.Comments               = model.Comments;

            return(record);
        }
コード例 #23
0
        public string AddOrUpdateStockItem(ExtendedIdentityDbContext db,
                                           StockItem model, string userName)
        {
            try
            {
                ProductItem productItem = db.ProductItems.Find(model.ProductItemId);
                StockItem   item        = db.StockItems.Create();
                item.ProductItem           = productItem;               // model.ProductItem;
                item.ProductItemId         = productItem.ProductItemId; // model.ProductItemId;
                item.Quantity              = model.Quantity;
                item.StockInDate           = DateTime.Now;
                item.StockStatus           = model.StockStatus;// StockStatus.InStock;
                item.StockWeight           = model.StockWeight;
                item.StoreHouse            = model.StoreHouse;
                item.StoreHouseId          = model.StoreHouseId;
                item.StoreHouseMountNumber = model.StoreHouseMountNumber;
                item.IsAllSold             = model.IsAllSold;
                //if (productItem.Quantity <= item.Quantity)
                //{
                //    productItem.Status = ProductItemStatus.Received;
                //    productItem.ReceiveTime = DateTime.Now;
                //}
                db.StockItems.Add(item);
                db.SaveChanges();

                return(string.Empty);
            }
            catch (Exception e)
            {
                string errorMsg = e.Message;
                if ((e is AggregateException) &&
                    (e as AggregateException).InnerException != null)
                {
                    errorMsg = string.Format(errorMsg + "\t\t{0}",
                                             (e as AggregateException).InnerException.Message);
                    LogHelper.Error(errorMsg, e.InnerException);
                }
                LogHelper.Error(errorMsg, e);
                return(errorMsg);
            }
        }
コード例 #24
0
        private ContractInfo FindOrderContractBy(ExtendedIdentityDbContext db,
                                                 IOwinContext context, string contractKey, ContractListCondition condition, DbQuery <OrderContract> contractQuery)
        {
            if (contractQuery == null)
            {
                contractQuery = db.OrderContracts.AsNoTracking();
            }
            var query = contractQuery as IQueryable <OrderContract>;

            if (condition != null && condition.IsEnable.GetValueOrDefault() &&
                !string.IsNullOrEmpty(condition.UserName))
            {
                query = AppendOrderContractEntityPrivilege(query, condition.UserName);
            }
            var first = query.FirstOrDefault(m => m.OrderContractKey == contractKey);

            if (first != null)
            {
                return(new ContractInfo(first));
            }

            return(null);
        }
コード例 #25
0
        public ContractViewModel GetIndexListContracts(IOwinContext context,
                                                       ExtendedIdentityDbContext db, ContractListCondition filter)
        {
            //Debug: 先不管那么多,只返回最简单的
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            if (filter == null || filter.IsEnable == false)
            {
                var defCondition = ContractListCondition.GetDefault();
                defCondition.UserName = context.Authentication.User.Identity.Name;
                filter = defCondition;
            }
            return(this.GetIndexListContracts(db, context, filter));

            //return new ContractViewModel() { IsEnable = false };
        }
コード例 #26
0
 public string AddOrUpdateSaleProductItem(IOwinContext owinContext,
                                          ExtendedIdentityDbContext db, SaleProductItem item)
 {
     try
     {
         int rec = db.SaveChanges();
         if (rec < 1)
         {
             return("销售货品状态信息更新失败。");
         }
     }
     catch (Exception e)
     {
         string errorMsg = "销售货品状态信息更新失败。" + e.Message;
         LogHelper.Error(errorMsg, e);
         if ((e is AggregateException) && (e as AggregateException).InnerException != null)
         {
             LogHelper.Error(errorMsg, (e as AggregateException).InnerException);
             errorMsg += "\t\t" + (e as AggregateException).InnerException.Message;
         }
         return(errorMsg);
     }
     return(string.Empty);
 }
コード例 #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="db"></param>
 /// <param name="condition"></param>
 /// <returns></returns>
 public IQueryable <OrderContract> GetIndexListOrderContract(IOwinContext owinContext,
                                                             ExtendedIdentityDbContext dbContext, ContractListCondition condition)
 {
     return(m_orderContractImpl.GetIndexListOrderContract(owinContext,
                                                          dbContext, condition));
 }
コード例 #28
0
        //public string AddOrUpdateSaleBargain(ExtendedIdentityDbContext
        //    dbContext, SaleBargain bargain)
        //{
        //    return m_saleContractImpl.AddOrUpdateSaleContractBargainCore(dbContext, bargain);
        //}

        public string UpdateSaleContractStatusCore(ExtendedIdentityDbContext dbContext,
                                                   SaleContract contract, ContractStatus contractStatus, string userName)
        {
            return(m_saleContractImpl.UpdateSaleContractStatusCore(dbContext,
                                                                   contract, contractStatus, userName));
        }
コード例 #29
0
 public string UpdateSaleContractCore(ExtendedIdentityDbContext dbContext,
                                      ContractInfo model, string userName)
 {
     return(m_saleContractImpl.UpdateSaleContractCore(dbContext,
                                                      model, userName));
 }
コード例 #30
0
        public IQueryable <ProductItem> GetIndexListProductItemByMainlandLogistics(
            ExtendedIdentityDbContext dbContext, IQueryable <ProductItem> sourceQuery,
            string logisticsCompanyName, DateTime?ReceiveTimeFrom, DateTime?ReceiveTimeTo,
            string userName)
        {
            IQueryable <ProductItem> query = sourceQuery;

            //dbContext.ProductItems.AsNoTracking();

            if (!string.IsNullOrWhiteSpace(logisticsCompanyName))
            {
                string temp = logisticsCompanyName.Trim();
                query = query.Where(p => p.OrderContract.MainlandLogistics != null &&
                                    p.OrderContract.MainlandLogistics.MLLogisCompany.
                                    CompanyName.ToLowerInvariant().Contains(temp));
            }

            if (ReceiveTimeFrom.HasValue && ReceiveTimeTo.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value >= ReceiveTimeTo.Value &&
                                    q.ReceiveTime.Value <= ReceiveTimeTo.Value);
            }
            else if (ReceiveTimeFrom.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value >= ReceiveTimeFrom.Value);
            }
            else if (ReceiveTimeTo.HasValue)
            {
                query = query.Where(q => q.ReceiveTime.HasValue &&
                                    q.ReceiveTime.Value <= ReceiveTimeTo.Value);
            }
            else
            {
                //不需要加条件
            }

            #region old
            //List<int> ids = new List<int>();

            //this.FilterByMainlandLogisComName(dbContext, logisticsCompanyName, ids);

            //if (!string.IsNullOrWhiteSpace(logisticsCompanyName))
            //{
            //    var logisComs = ResBusinessManager.Instance.GetMainlandLogisticsCompanies();

            //    //var comIds = (from one in logisComs
            //    //              where one.CompanyName.ToLowerInvariant().Contains(logisticsCompanyName.Trim().ToLowerInvariant())
            //    //              select one.MainlandLogisticsCompanyId).Join(dbContext.MainlandLogisticsTable,
            //    //           comId => comId, mainlandlogis => mainlandlogis.MainlandLogisticsCompanyId,
            //    //           (comId, mainlandlogis) => mainlandlogis.OrderContractId);

            //    //query = dbContext.OrderContracts.AsNoTracking().Where(
            //    //     ord => comIds.Contains(ord.OrderContractId));
            //}

            //this.CombineTimeSpan(dbContext, ReceiveTimeFrom, ReceiveTimeTo, ids);

            //var orderContractIds = ids.Distinct();
            //if (orderContractIds != null && orderContractIds.Count() > 0)
            //{//查出来ID,那就需要加入这个条件
            //    query = query.Where(
            //        ord => orderContractIds.Contains(ord.OrderContractId));
            //}
            #endregion

            //TODO: Filter OrderContract by userName
            if (!string.IsNullOrWhiteSpace(userName))
            {//TODO: add query condition to query
            }

            return(query);
        }