コード例 #1
0
        protected override List <ExpenditureRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <ExpenditureRecord> ret = dc.GetTable <ExpenditureRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is ExpenditureRecordSearchCondition)
            {
                ExpenditureRecordSearchCondition con = search as ExpenditureRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.Category))
                {
                    ret = ret.Where(item => item.Category.Contains(con.Category));
                }
            }
            return(ret.ToList());
        }
コード例 #2
0
        protected override List <StackOutSheet> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <StackOutSheet>(item => item.Items);
            dc.LoadOptions = opt;
            IQueryable <StackOutSheet> ret = dc.GetTable <StackOutSheet>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is StackOutSheetSearchCondition)
            {
                StackOutSheetSearchCondition con = search as StackOutSheetSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (!string.IsNullOrEmpty(con.WareHouseID))
                {
                    ret = ret.Where(item => item.WareHouseID == con.WareHouseID);
                }
                if (con.SheetTypes != null && con.SheetTypes.Count > 0)
                {
                    ret = ret.Where(item => con.SheetTypes.Contains(item.ClassID));
                }
                if (con.WithTax != null)
                {
                    if (con.WithTax.Value)
                    {
                        ret = ret.Where(item => item.WithTax == true);
                    }
                    else
                    {
                        ret = ret.Where(item => item.WithTax == false);
                    }
                }
            }
            List <StackOutSheet> sheets = ret.ToList();

            return(sheets);
        }
コード例 #3
0
        protected override List <CustomerPayment> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <CustomerPayment> ret = dc.GetTable <CustomerPayment>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is CustomerPaymentSearchCondition)
            {
                CustomerPaymentSearchCondition con = search as CustomerPaymentSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (con.PaymentTypes != null && con.PaymentTypes.Count > 0)
                {
                    ret = ret.Where(item => con.PaymentTypes.Contains(item.ClassID));
                }
                if (con.HasRemain != null)
                {
                    if (con.HasRemain.Value)
                    {
                        ret = ret.Where(item => item.Assigned < item.Amount);
                    }
                    else
                    {
                        ret = ret.Where(item => item.Assigned >= item.Amount);
                    }
                }
            }
            List <CustomerPayment> sheets = ret.ToList();

            return(sheets);
        }
コード例 #4
0
        protected override List <StackInSheet> GetingItems(DataContext dc, SearchCondition search)
        {
            //这种通过两次查询获取信息的方式,在商品很多时会引起性能问题,以后看能不能做联接查询,一次出结果
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <StackInSheet>(sheet => sheet.Items);
            dc.LoadOptions = opt;
            IQueryable <StackInSheet> ret = dc.GetTable <StackInSheet>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is StackInSheetSearchCondition)
            {
                StackInSheetSearchCondition con = search as StackInSheetSearchCondition;
                if (!string.IsNullOrEmpty(con.SupplierID))
                {
                    ret = ret.Where(item => item.SupplierID == con.SupplierID);
                }
                if (!string.IsNullOrEmpty(con.WareHouseID))
                {
                    ret = ret.Where(item => item.WareHouseID == con.WareHouseID);
                }
            }
            List <StackInSheet> sheets = ret.ToList();

            return(sheets);
        }
コード例 #5
0
        protected override List <CustomerOtherReceivable> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <CustomerOtherReceivable> ret = dc.GetTable <CustomerOtherReceivable>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is CustomerOtherReceivableSearchCondition)
            {
                CustomerOtherReceivableSearchCondition con = search as CustomerOtherReceivableSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
            }
            List <CustomerOtherReceivable> items = ret.ToList();

            return(items);
        }
コード例 #6
0
        protected override List <OrderItemRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <OrderItemRecord>(item => item.Customer);
            opt.LoadWith <OrderItemRecord>(item => item.Product);
            dc.LoadOptions = opt;
            IQueryable <OrderItemRecord> ret = dc.GetTable <OrderItemRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.SheetNo));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is OrderSearchCondition)
            {
                OrderSearchCondition con = search as OrderSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (!string.IsNullOrEmpty(con.Sales))
                {
                    ret = ret.Where(item => item.SalesPerson == con.Sales);
                }
                if (con.WithTax != null)
                {
                    if (con.WithTax.Value)
                    {
                        ret = ret.Where(item => item.WithTax == true);
                    }
                    else
                    {
                        ret = ret.Where(item => item.WithTax == false);
                    }
                }
            }
            if (search is OrderItemRecordSearchCondition)
            {
                OrderItemRecordSearchCondition con = search as OrderItemRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.ProductID))
                {
                    ret = ret.Where(item => item.ProductID == con.ProductID);
                }
                if (!string.IsNullOrEmpty(con.CategoryID))
                {
                    ret = ret.Where(item => item.Product.CategoryID == con.CategoryID);
                }
            }
            List <OrderItemRecord> items = ret.ToList();

            if (search is OrderItemRecordSearchCondition) //从数据库获取回来数据后再筛选
            {
                OrderItemRecordSearchCondition con = search as OrderItemRecordSearchCondition;
                if (con.HasToDelivery != null)
                {
                    if (con.HasToDelivery.Value)
                    {
                        items = items.Where(item => item.NotShipped > 0).ToList();
                    }
                    else
                    {
                        items = items.Where(item => item.NotShipped == 0).ToList();
                    }
                }
                if (con.HasToPurchase != null)
                {
                    if (con.HasToPurchase.Value)
                    {
                        items = items.Where(item => item.NotPurchased > 0).ToList();
                    }
                    else
                    {
                        items = items.Where(item => item.NotPurchased == 0).ToList();
                    }
                }
            }
            return(items);
        }
コード例 #7
0
        protected override List <PurchaseItemRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <PurchaseItemRecord>(item => item.Supplier);
            opt.LoadWith <PurchaseItemRecord>(item => item.Product);
            dc.LoadOptions = opt;
            IQueryable <PurchaseItemRecord> ret = dc.GetTable <PurchaseItemRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.SheetNo));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is PurchaseOrderSearchCondition)
            {
                PurchaseOrderSearchCondition con = search as PurchaseOrderSearchCondition;
                if (!string.IsNullOrEmpty(con.SupplierID))
                {
                    ret = ret.Where(item => item.SupplierID == con.SupplierID);
                }
                if (!string.IsNullOrEmpty(con.Buyer))
                {
                    ret = ret.Where(item => item.Buyer == con.Buyer);
                }
            }
            if (search is PurchaseItemRecordSearchCondition)
            {
                PurchaseItemRecordSearchCondition con = search as PurchaseItemRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.ProductID))
                {
                    ret = ret.Where(item => item.ProductID == con.ProductID);
                }
                if (!string.IsNullOrEmpty(con.OrderID))
                {
                    ret = ret.Where(item => item.OrderID == con.OrderID);
                }
            }
            List <PurchaseItemRecord> items = ret.ToList();

            if (search is PurchaseItemRecordSearchCondition)
            {
                PurchaseItemRecordSearchCondition con = search as PurchaseItemRecordSearchCondition;
                if (con.HasOnway != null)
                {
                    if (con.HasOnway.Value)
                    {
                        items = items.Where(item => item.OnWay > 0).ToList();
                    }
                    else
                    {
                        items = items.Where(item => item.OnWay == 0).ToList();
                    }
                }
            }
            return(items);
        }
コード例 #8
0
        protected override List <StackOutRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <StackOutRecord>(item => item.Customer);
            opt.LoadWith <StackOutRecord>(item => item.WareHouse);
            opt.LoadWith <StackOutRecord>(item => item.Product);
            opt.LoadWith <Product>(item => item.Category);
            dc.LoadOptions = opt;
            IQueryable <StackOutRecord> ret = dc.GetTable <StackOutRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.SheetNo));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is StackOutSheetSearchCondition)
            {
                StackOutSheetSearchCondition con = search as StackOutSheetSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (!string.IsNullOrEmpty(con.WareHouseID))
                {
                    ret = ret.Where(item => item.WareHouseID == con.WareHouseID);
                }
                if (con.SheetTypes != null && con.SheetTypes.Count > 0)
                {
                    ret = ret.Where(item => con.SheetTypes.Contains(item.ClassID));
                }
            }
            if (search is StackOutRecordSearchCondition)
            {
                StackOutRecordSearchCondition con = search as StackOutRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.ProductID))
                {
                    ret = ret.Where(item => item.ProductID == con.ProductID);
                }
                if (!string.IsNullOrEmpty(con.CategoryID))
                {
                    ret = ret.Where(item => item.Product.CategoryID == con.CategoryID);
                }
                if (!string.IsNullOrEmpty(con.OrderID))
                {
                    ret = ret.Where(item => item.OrderID == con.OrderID);
                }
                if (con.OrderItem != null)
                {
                    ret = ret.Where(item => item.OrderItem == con.OrderItem);
                }
            }
            List <StackOutRecord> items = ret.ToList();

            return(items);
        }