Ejemplo n.º 1
0
        public LocationsResultDTO GetLocationByPipeline(string pipelineDuns)
        {
            LocationsResultDTO locResult = new LocationsResultDTO();
            var locationResult           = DbContext.Locations.Where(a => a.PipeDuns == pipelineDuns).ToList();

            locResult.locationsDTO = locationResult.Select(a => modalFactory.Parse(a)).OrderBy(a => a.Name).ToList();
            locResult.RecordCount  = locResult.locationsDTO.Count();
            return(locResult);
        }
Ejemplo n.º 2
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.º 3
0
        public bool SaveUserPermissions(UserPipelineDTO userMapping)
        {
            string userID = (userMapping.userPipelineMappingDTO.Count > 0 && !string.IsNullOrEmpty(userMapping.userPipelineMappingDTO.Select(u => u.UserId).FirstOrDefault()) ? userMapping.userPipelineMappingDTO[0].UserId : userMapping.UserId);


            var userPipelineMapping = factory.Parse(userMapping);

            if (userMapping != null)
            {
                var deleteUser = dbcontext.UserPipelineMappings.Where(a => a.userId == userID).Select(a => a).ToList();
                var Delete     = dbcontext.UserPipelineMappings.RemoveRange(deleteUser);
                dbcontext.SaveChanges();
                var OnlyNomsOrUprd = userPipelineMapping
                                     .Where(a => a.IsNoms == true || a.IsUPRD == true)
                                     .Select(a => a).ToList();
                var result  = dbcontext.UserPipelineMappings.AddRange(OnlyNomsOrUprd);
                var Success = dbcontext.SaveChanges();
                if (Success > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
        public List <CounterPartiesDTO> GetCounterParties(string Keyword, string PipeDuns)
        {
            List <CounterParty> data = new List <CounterParty>();

            if (string.IsNullOrEmpty(Keyword))
            {
                data = DbContext.CounterParties.Where(a =>
                                                      a.IsActive
                                                      ).ToList();
            }
            else
            {
                data = DbContext.CounterParties.Where(a =>
                                                      (a.Identifier.Contains(Keyword) ||
                                                       a.PropCode.Contains(Keyword) ||
                                                       a.Name.Contains(Keyword))
                                                      //&& (a.PipeDuns == PipeDuns)
                                                      && a.IsActive
                                                      ).ToList();
            }

            return(data.Select(a => modalFactory.Parse(a)).ToList());
        }
Ejemplo n.º 5
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.Locations.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.Locations.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.Locations.Where(a => a.PropCode == "103565" || a.PropCode == "103702").OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Locations.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.Locations.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.Locations.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.Locations.Where(a => a.PropCode == "58744").OrderBy(a => a.Name).Skip((PageNo - 1) * PageSize).Take(PageSize).ToList();
                        }
                        else
                        {
                            Result = DbContext.Locations.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.Locations.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.Locations.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.Locations.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.Locations.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);
        }