Ejemplo n.º 1
0
        public SwntResultDTO GetSwntListWithPaging(string PipelineDuns, bool IsCritical, string Keyword, DateTime?postStartDate, DateTime?postEndDate, DateTime?EffectiveStartDate, DateTime?EffectiveEndDate, SortingPagingInfo sortingPagingInfo)
        {
            //Get SWNT list using above parameters
            List <SwntPerTransaction> swntdatalist  = new List <SwntPerTransaction>();
            SwntResultDTO             swntResultDTO = new SwntResultDTO();

            try
            {
                swntdatalist = GetNoticesBySearch(PipelineDuns, IsCritical, Keyword, postStartDate, postEndDate, EffectiveStartDate, EffectiveEndDate);

                var dataQueryWithOrder = SortByColumnWithOrder(swntdatalist.AsQueryable(), sortingPagingInfo);
                sortingPagingInfo.PageCount = dataQueryWithOrder.Count();
                swntResultDTO.RecordCount   = sortingPagingInfo.PageCount;
                var resultData = dataQueryWithOrder.Skip((sortingPagingInfo.CurrentPageIndex - 1) * sortingPagingInfo.PageSize).Take(sortingPagingInfo.PageSize).ToList();

                if (resultData.Count() > 0)
                {
                    var swntResult = resultData.Select(a => modalFactory.Parse(a)).ToList();
                    swntResultDTO.swntPerTransactionDTO = swntResult;
                    return(swntResultDTO);
                }

                return(new SwntResultDTO());
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        // PageNo  = 0,1,2,3...so on.
        public LocationsResultDTO GetLocationsWithPaging(string Keyword, string PipelineDuns, string PopupFor, bool IsSpecialDelCase, SortingPagingInfo sortingPagingInfo)
        {
            LocationsResultDTO locationsResultDTO = new LocationsResultDTO();
            List <Location>    Result             = new List <Location>();
            int PageNo   = sortingPagingInfo.CurrentPageIndex;
            int PageSize = sortingPagingInfo.PageSize;

            int NotRDB = 1; // for not Receipt locs.

            if (PopupFor == "RecLoc" || PopupFor == "Receipt" || PopupFor == "ContractPath" || PopupFor == "Supply")
            {
                NotRDB = 2;  // for not delivery locs.
                if (string.IsNullOrEmpty(Keyword))
                {
                    var QueryableData          = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns && a.IsActive == true && a.RDUsageID != NotRDB);
                    var QueryableDataWithOrder = GetQueryableDataWithOrder(QueryableData, sortingPagingInfo);
                    sortingPagingInfo.PageCount = QueryableDataWithOrder.Count();
                    Result = QueryableDataWithOrder.Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                }
                else
                {
                    var QueryableDataWithKeyword = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns &&
                                                                            a.IsActive == true &&
                                                                            a.RDUsageID != NotRDB &&
                                                                            (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword)));
                    var QueryableDataWithOrder = GetQueryableDataWithOrder(QueryableDataWithKeyword, sortingPagingInfo);
                    sortingPagingInfo.PageCount = QueryableDataWithOrder.Count();
                    Result = QueryableDataWithOrder.Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                }
            }
            else
            {
                NotRDB = 1;  // not-Receipt
                if (IsSpecialDelCase)
                {
                    if (PipelineDuns == "006958581")  // ANR Pipeline Company
                    {
                        // locationList = locationList.Where(a => a.PropCode == "103565" || a.PropCode == "103702").ToList();
                        if (string.IsNullOrEmpty(Keyword))
                        {
                            Result = DbContext.Location.Where(a => a.PropCode == "103565" || a.PropCode == "103702").OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Location.Where(a => (a.PropCode == "103565" || a.PropCode == "103702") &&
                                                              (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword))).OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                    }
                    else if (PipelineDuns == "007933047") //Transwestern Pipeline Company, LLC
                    {
                        // locationList = locationList.Where(a => a.PropCode == "58646" || a.PropCode == "58647" || a.PropCode == "58648" || a.PropCode == "58649" || a.PropCode == "500543").ToList();
                        if (string.IsNullOrEmpty(Keyword))
                        {
                            Result = DbContext.Location.Where(a => a.PropCode == "58646" || a.PropCode == "58647" || a.PropCode == "58648" || a.PropCode == "58649" || a.PropCode == "500543").OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Location.Where(a => (a.PropCode == "58646" || a.PropCode == "58647" || a.PropCode == "58648" || a.PropCode == "58649" || a.PropCode == "500543") &&
                                                              (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword))).OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                    }
                    else if (PipelineDuns == "829416002")  // FAYETTEVILLE EXPRESS PIPELINE LLC
                    {
                        //locationList = locationList.Where(a => a.PropCode == "58744").ToList();
                        if (string.IsNullOrEmpty(Keyword))
                        {
                            Result = DbContext.Location.Where(a => a.PropCode == "58744").OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Location.Where(a => (a.PropCode == "58744") &&
                                                              (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword))).OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(Keyword))
                        {
                            Result = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns && a.IsActive == true && a.RDUsageID != NotRDB).OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns &&
                                                              a.IsActive == true &&
                                                              a.RDUsageID != NotRDB &&
                                                              (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword))).OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                    }
                }
                else//If location is Delivery
                {
                    if (string.IsNullOrEmpty(Keyword))
                    {
                        var QueriableDelLocData          = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns && a.IsActive == true && a.RDUsageID != NotRDB);
                        var QueryableDataWithOrderDelLoc = GetQueryableDataWithOrder(QueriableDelLocData, sortingPagingInfo);
                        sortingPagingInfo.PageCount = QueryableDataWithOrderDelLoc.Count();
                        Result = QueryableDataWithOrderDelLoc.Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                    }
                    else
                    {
                        var QueriableDelLocDataWithData = DbContext.Location.Where(a => a.PipeDuns == PipelineDuns &&
                                                                                   a.IsActive == true &&
                                                                                   a.RDUsageID != NotRDB &&
                                                                                   (a.Identifier.Contains(Keyword) || a.PropCode.Contains(Keyword) || a.Name.Contains(Keyword)));
                        var QueryableDataWithOrderDelLoc = GetQueryableDataWithOrder(QueriableDelLocDataWithData, sortingPagingInfo);
                        sortingPagingInfo.PageCount = QueryableDataWithOrderDelLoc.Count();
                        Result = QueryableDataWithOrderDelLoc.Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                    }
                }
            }
            locationsResultDTO.RecordCount  = sortingPagingInfo.PageCount;
            locationsResultDTO.locationsDTO = Result.Select(a => modalFactory.Parse(a)).OrderBy(a => a.Name).ToList();

            return(locationsResultDTO);
        }