コード例 #1
0
ファイル: Sizes.cs プロジェクト: Osama91/CCWFM
 public List <_Model.TblSize> GetSizesBySizeGroup(int?_Skip, int?_Take, int _SizeGroup)
 {
     using (var context = new _Model.WorkFlowManagerDBEntities())
     {
         if (_Skip != null)
         {
             return(context.TblSizes.Where(x => x.TblSizeGroup == _SizeGroup).OrderBy(x => x.Id).Skip((int)_Skip).Take((int)_Take).ToList());
         }
         else
         {
             return(context.TblSizes.Where(x => x.TblSizeGroup == _SizeGroup).OrderBy(x => x.Id).ToList());
         }
     }
 }
コード例 #2
0
        public List <PurchaseOrderDetailDto> GetTransferInventDimLines(int skip, int take, string dataArea, string journal, IEnumerable <decimal> lineNumbers, string sort, string filter, Dictionary <string, object> valuesObjects)
        {
            using (var context = new _Model.WorkFlowManagerDBEntities())
            {
                // if (filter != null)
                //{
                if (valuesObjects == null)
                {
                    valuesObjects = new Dictionary <string, object>();
                }

                if (filter == null)
                {
                    filter = "it.PURCHID ==(@PURCHID0)";
                }
                else
                {
                    filter = filter + " and it.PURCHID ==(@PURCHID0)";
                }

                valuesObjects.Add("PURCHID0", journal);
                filter = filter + " and it.DATAAREAID ==(@DATAAREAID0)";
                valuesObjects.Add("DATAAREAID0", dataArea);
                //int counter = 0;

                var parameterCollection = ConvertToParamters(valuesObjects);
                var querytemp           = context.TransferInventDims.Where(filter, parameterCollection.ToArray()).OrderBy(sort).Skip(skip).Take(take);
                var query = querytemp.Select(p => new PurchaseOrderDetailDto
                {
                    ItemName    = p.NAME,
                    ItemId      = p.ITEMID,
                    Unit        = p.PURCHUNIT,
                    FabricColor = p.CONFIGID,
                    BatchNo     = p.INVENTBATCHID,
                    Quantity    = (float)p.PURCHQTY,
                    UnitPrice   = (float)p.PRICEUNIT,
                    TotalPrice  = (float)p.LINEAMOUNT,
                    LineNumber  = p.LINENUM,
                    Location    = p.WMSLOCATIONID,
                    Warehouse   = p.INVENTLOCATIONID,
                    Site        = p.INVENTSITEID,
                });

                return(query.ToList());
            }
        }
コード例 #3
0
        public List <_Model.SizeCode> GetSizes(int?_Skip, int?_Take)
        {
            List <_Model.SizeCode> temp;

            using (_Model.WorkFlowManagerDBEntities context = new _Model.WorkFlowManagerDBEntities())
            {
                if (_Skip != null)
                {
                    temp = context.SizeCodes.OrderBy(x => x.SizeCode_Id).Skip((int)_Skip).Take((int)_Take).ToList();
                    return(temp);
                }
                else
                {
                    temp = context.SizeCodes.OrderBy(x => x.SizeCode_Id).ToList();
                    return(temp);
                }
            }
        }
コード例 #4
0
        public List <PurchaseOrderDetailDto> GetRecivedDyedOrders(int skip, int take, string journal, IEnumerable <decimal> lineNumbers, string sort, string filter, Dictionary <string, object> valuesObjects)
        {
            using (var context = new _Model.WorkFlowManagerDBEntities())
            {
                if (valuesObjects == null)
                {
                    valuesObjects = new Dictionary <string, object>();
                }

                if (filter == null)
                {
                    filter = "it.TblDyeingOrdersMainDetail.TblDyeingOrdersHeader.DocPlan ==(@PURCHID0)";
                }
                else
                {
                    filter = filter + " and it.TblDyeingOrdersMainDetail.TblDyeingOrdersHeader.DocPlan ==(@PURCHID0)";
                }

                filter = filter + " and it.TransactionType ==(@TransactionType0)";
                valuesObjects.Add("PURCHID0", journal);
                valuesObjects.Add("TransactionType0", 1);
                var parameterCollection = ConvertToParamters(valuesObjects);
                var querytemp           = context.TblDyeingOrdersDetails.Include("TblDyeingOrdersMainDetail").Where(filter, parameterCollection.ToArray());
                var query = querytemp.Select(p => new PurchaseOrderDetailDto
                {
                    ItemName    = p.DyedFabric,
                    ItemId      = p.DyedFabric,
                    Unit        = p.Unit,
                    FabricColor = p.Color,
                    BatchNo     = SqlFunctions.StringConvert((double)p.BatchNo).Trim(),
                    Quantity    = (float)p.CalculatedTotalQty,
                    UnitPrice   = (float)0,
                    TotalPrice  = (float)0,
                    LineNumber  = p.Iserial,
                    Location    = p.TblDyeingOrdersMainDetail.WareHouse,
                    Warehouse   = p.TblDyeingOrdersMainDetail.WareHouse,
                    Site        = context.V_Warehouse.FirstOrDefault(w => w.WarehouseID == p.TblDyeingOrdersMainDetail.WareHouse).SiteId,
                });

                return(query.ToList());
            }
        }
コード例 #5
0
 public List <_Model.StyleHeader> GetStyleHeaders(int?_Skip, int?_Take)
 {
     try
     {
         using (_Model.WorkFlowManagerDBEntities context = new _Model.WorkFlowManagerDBEntities())
         {
             if (_Skip != null)
             {
                 return(context.StyleHeaders.OrderByDescending(x => x.StyleHeader_CreatedDate).Skip((int)_Skip).Take((int)_Take).ToList());
             }
             else
             {
                 return(context.StyleHeaders.OrderByDescending(x => x.StyleHeader_CreatedDate).ToList());
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #6
0
 public List <_Model.SizeCode> GetSizesBySizeGroup(int?_Skip, int?_Take, string _SizeGroup)
 {
     using (_Model.WorkFlowManagerDBEntities context = new _Model.WorkFlowManagerDBEntities())
     {
         if (!string.IsNullOrEmpty(_SizeGroup.Trim()))
         {
             if (_Skip != null)
             {
                 return(context.SizeCodes.Where(x => x.SizeCode_SizeGroup == _SizeGroup).OrderBy(x => x.SizeCode_Id).Skip((int)_Skip).Take((int)_Take).ToList());
             }
             else
             {
                 return(context.SizeCodes.Where(x => x.SizeCode_SizeGroup == _SizeGroup).OrderBy(x => x.SizeCode_Id).ToList());
             }
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #7
0
 public List <_Model.StyleHeader_SalesOrder_Colors> GetSalesOrderColors(int?_Skip, int?_Take, string _SalesOrder)
 {
     using (var context = new _Model.WorkFlowManagerDBEntities())
     {
         if (_Skip != null && _Take != null)
         {
             return(context.StyleHeader_SalesOrder_Colors
                    .Where(x => x.StyleHeader_Colors_SalesOrder == _SalesOrder)
                    .OrderBy(x => x.StyleHeader_Colors_Index)
                    .Skip((int)_Skip)
                    .Take((int)_Take)
                    .ToList());
         }
         else
         {
             return(context.StyleHeader_SalesOrder_Colors
                    .Where(x => x.StyleHeader_Colors_SalesOrder == _SalesOrder)
                    .OrderBy(x => x.StyleHeader_Colors_Index)
                    .ToList());
         }
     }
 }
コード例 #8
0
 public List <_Model.StyleHeader_SalesOrder> GetSalesOrders(int?_Skip, int?_Take, string _StyleHeader)
 {
     using (var context = new _Model.WorkFlowManagerDBEntities())
     {
         if (_Skip != null && _Take != null)
         {
             return(context.StyleHeader_SalesOrder
                    .Where(x => x.StyleHeader == _StyleHeader)
                    .OrderByDescending(x => x.SalesOrderCreationDate)
                    .Skip((int)_Skip)
                    .Take((int)_Take)
                    .ToList());
         }
         else
         {
             return(context.StyleHeader_SalesOrder
                    .Where(x => x.StyleHeader == _StyleHeader)
                    .OrderByDescending(x => x.SalesOrderCreationDate)
                    .ToList());
         }
     }
 }
コード例 #9
0
        public List <PurchaseOrderDto> GetPurchaseOrderJournals(int skip, int take, string dataArea, string sort, string filter, Dictionary <string, object> valuesObjects, out int fullCount, int type = 0)
        {
            if (valuesObjects == null)
            {
                valuesObjects = new Dictionary <string, object>();
            }
            if (type != 1)
            {
                if (filter == null)
                {
                    filter = "it.DATAAREAID ==(@DATAAREAID0)";
                }
                else
                {
                    filter = filter + " and it.DATAAREAID ==(@DATAAREAID0)";
                }

                valuesObjects.Add("DATAAREAID0", dataArea);
            }
            var parameterCollection = ConvertToParamters(valuesObjects);
            var searchedItems       = new List <PurchaseOrderDto>();

            fullCount = 0;

            using (var context = new _Model.ax2009_ccEntities())
            {
                if (type == 0)
                {
                    fullCount     = context.PURCHTABLEs.Where(filter, parameterCollection.ToArray()).Count();
                    searchedItems = (from p in context.PURCHTABLEs.Where(filter, parameterCollection.ToArray()).OrderBy(p => p.DATAAREAID).Skip(skip).Take(take)
                                     select new PurchaseOrderDto
                    {
                        VendorCode = p.ORDERACCOUNT,
                        VendorName = p.PURCHNAME,
                        CreatedDate = p.CREATEDDATETIME,
                        DataArea = p.DATAAREAID,
                        JournalId = p.PURCHID,
                        Status = p.PURCHSTATUS,
                    }).OrderByDescending(x => x.CreatedDate).Take(30).ToList();
                }

                if (type == 2)
                {
                    fullCount     = context.INVENTJOURNALTABLEs.Where(filter, parameterCollection.ToArray()).Count();
                    searchedItems = (from p in context.INVENTJOURNALTABLEs
                                     .Where(filter, parameterCollection.ToArray()).OrderBy(p => p.DATAAREAID).Skip(skip).Take(take)
                                     select new PurchaseOrderDto
                    {
                        VendorCode = "",
                        VendorName = "",
                        DataArea = p.DATAAREAID,
                        JournalId = p.JOURNALID,
                    }).OrderByDescending(x => x.DataArea).Take(30).ToList();
                }
            }

            if (type == 1)
            {
                using (var context = new _Model.WorkFlowManagerDBEntities())
                {
                    if (filter == null)
                    {
                        fullCount     = context.TblDyeingOrdersHeaders.Count();
                        searchedItems = (from p in context.TblDyeingOrdersHeaders.OrderByDescending(p => p.DocPlan).Skip(skip).Take(take).Where(w => w.TblDyeingOrdersMainDetails.Any(r => r.TransactionType == 0))
                                         select new PurchaseOrderDto
                        {
                            VendorCode = p.Vendor,
                            VendorName = p.Vendor,
                            DataArea = "ccm",
                            JournalId = p.DocPlan,
                        }).Take(30).ToList();
                    }
                    else
                    {
                        fullCount     = context.TblDyeingOrdersHeaders.Where(filter, parameterCollection.ToArray()).Count();
                        searchedItems = (from p in context.TblDyeingOrdersHeaders
                                         .Where(filter, parameterCollection.ToArray()).GroupBy(x => new { x.DocPlan, x.Vendor }).OrderByDescending(p => p.Key.DocPlan).Skip(skip).Take(take)
                                         select new PurchaseOrderDto
                        {
                            VendorCode = p.Key.Vendor,
                            VendorName = p.Key.Vendor,
                            DataArea = "ccm",
                            JournalId = p.Key.DocPlan,
                        }).Take(30).ToList();
                    }
                }
            }

            return(searchedItems);
        }