コード例 #1
0
        public List <BeforeDelivery> GetSpecificWordGroup(int customer_Id, int manufacturer_Id, string keywords, int responsibleStaff_Id,
                                                          int helper_Id, DateTime startDate, DateTime endDate)
        {
            using (DefaultConnection db = new DefaultConnection())
            {
                int openCustomer_Id      = BusinessPartnerData.GetIdRange(db, customer_Id)[0];
                int closeCustomer_Id     = BusinessPartnerData.GetIdRange(db, customer_Id)[1];
                int openManufacturer_Id  = ManufacturerData.GetIdRange(db, manufacturer_Id)[0];
                int closeManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[1];
                int openStaff_Id         = IdRange.Staff(db, responsibleStaff_Id)[0];
                int closeStaff_Id        = IdRange.Staff(db, responsibleStaff_Id)[1];
                int openHelper_Id        = IdRange.Helper(db, helper_Id)[0];
                int closeHelper_Id       = IdRange.Helper(db, helper_Id)[1];
                List <BeforeDelivery> beforeDeliveries = new List <BeforeDelivery>();

                if (!String.IsNullOrEmpty(keywords))
                {
                    SQLWhereString whereString = new SQLWhereString();
                    string where = whereString.SearchKeyWhere <BeforeDelivery>(db, keywords);
                    string[] keywordArray = keywords.Split(new[] { ' ', ' ' });
                    beforeDeliveries = db.Database
                                       .SqlQuery <BeforeDelivery>(where)
                                       .ToList();
                    return(beforeDeliveries
                           .Where(so => so.Customer_Id >= openCustomer_Id &&
                                  so.Customer_Id <= closeCustomer_Id &&
                                  so.Manufacturer_Id >= openManufacturer_Id &&
                                  so.Manufacturer_Id <= closeManufacturer_Id &&
                                  so.ResponsibleStaff_Id >= openStaff_Id &&
                                  so.ResponsibleStaff_Id <= closeStaff_Id &&
                                  so.Helper_Id >= openHelper_Id &&
                                  so.Helper_Id <= closeHelper_Id &&
                                  so.SalesOrderDate >= startDate &&
                                  so.SalesOrderDate <= endDate)
                           .ToList());
                }
                else
                {
                    return(db.BeforeDeliveries
                           .Where(so => so.Customer_Id >= openCustomer_Id &&
                                  so.Customer_Id <= closeCustomer_Id &&
                                  so.Manufacturer_Id >= openManufacturer_Id &&
                                  so.Manufacturer_Id <= closeManufacturer_Id &&
                                  so.ResponsibleStaff_Id >= openStaff_Id &&
                                  so.ResponsibleStaff_Id <= closeStaff_Id &&
                                  so.Helper_Id >= openHelper_Id &&
                                  so.Helper_Id <= closeHelper_Id &&
                                  so.SalesOrderDate >= startDate &&
                                  so.SalesOrderDate <= endDate)
                           .ToList());
                }
            }
        }
コード例 #2
0
        public List <BeforeWarehousing> GetSpecificWordGroup(int supplier_Id, int manufacturer_Id, string keywords,
                                                             DateTime startDate, DateTime endDate)
        {
            using (DefaultConnection db = new DefaultConnection())
            {
                int openSupplier_Id      = BusinessPartnerData.GetIdRange(db, supplier_Id)[0];
                int closeSupplier_Id     = BusinessPartnerData.GetIdRange(db, supplier_Id)[1];
                int openManufacturer_Id  = ManufacturerData.GetIdRange(db, manufacturer_Id)[0];
                int closeManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[1];
                List <BeforeWarehousing> beforeWarehousings = new List <BeforeWarehousing>();

                if (!String.IsNullOrEmpty(keywords))
                {
                    SQLWhereString whereString = new SQLWhereString();
                    string where       = whereString.SearchKeyWhere <BeforeWarehousing>(db, keywords);
                    beforeWarehousings = db.Database
                                         .SqlQuery <BeforeWarehousing>(where)
                                         .ToList();
                    beforeWarehousings = beforeWarehousings
                                         .Where(bw => bw.Supplier_Id >= openSupplier_Id &&
                                                bw.Supplier_Id <= closeSupplier_Id &&
                                                bw.Manufacturer_Id >= openManufacturer_Id &&
                                                bw.Manufacturer_Id <= closeManufacturer_Id &&
                                                bw.PurchaseDate >= startDate &&
                                                bw.PurchaseDate <= endDate)
                                         .ToList();
                    return(beforeWarehousings);
                }
                else
                {
                    beforeWarehousings = db.BeforeWarehousings
                                         .Where(bw => bw.Supplier_Id >= openSupplier_Id &&
                                                bw.Supplier_Id <= closeSupplier_Id &&
                                                bw.Manufacturer_Id >= openManufacturer_Id &&
                                                bw.Manufacturer_Id <= closeManufacturer_Id &&
                                                bw.PurchaseDate >= startDate &&
                                                bw.PurchaseDate <= endDate)
                                         .ToList();
                    return(beforeWarehousings);
                }
            }
        }