Beispiel #1
0
        public bool SendNomination(List <string> transactionIDs)
        {
            bool sendToTest = Convert.ToBoolean(ConfigurationManager.AppSettings["SendToTest"]);
            bool results    = false;

            ShipperReturnByIdentity currentIdentity = GetValueFromIdentity();
            int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId);

            List <bool> tempBool = new List <bool>();
            int         statusId = 0;

            foreach (var transactionID in transactionIDs)
            {
                statusId = pathedNominationService.GetStatusOnTransactionId(new Guid(transactionID));
                if (statusId == 11)
                {
                    var result = IPNTNominationService.SendNominationTransaction(new Guid(transactionID), companyId, sendToTest);
                    tempBool.Add(result);
                }
                else
                {
                    tempBool.Add(false);
                }
            }
            if ((tempBool.Where(a => a == false).Count()) == 0)
            {
                results = true;
            }
            return(results);
        }
Beispiel #2
0
        public ActionResult SaveNonPathedHybrid(NonPathedDTO model)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            model.ShipperDuns = currentIdentityValues.ShipperDuns;
            model.UserId      = Guid.Parse(currentIdentityValues.UserId);
            // var pipe = pipelineService.GetPipeline(model.PipelineId);
            model.PipelineDuns = model.PipelineDuns;
            model.CompanyId    = Convert.ToInt32(currentIdentityValues.CompanyId ?? "0");
            bool result = false;
            var  Id     = nonPathedService.SaveAllNonPathedNominations(model);

            result               = (Id == Guid.Empty) ? false : true;
            ViewBag.Cycles       = _cycleIndicator.GetCycles();
            ViewBag.SubmitStatus = result;
            if (result)
            {
                TempData["status"] = "Data saved successfully";
            }
            else
            {
                TempData["status"] = "Data saving failed";
            }
            return(RedirectToAction("Index", new { pipelineDuns = model.PipelineDuns }));
        }
Beispiel #3
0
        public async Task <ActionResult> Index(SearchCriteriaUNSC criteria, string download)
        {
            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity      = GetValueFromIdentity();
            criteria.flagDefault = false;

            if (download != null)
            {
                var request = new RestRequest(string.Format("GetTotalRecordsCountUNSC"), Method.POST)
                {
                    RequestFormat = DataFormat.Json
                };
                request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                request.AddJsonBody(criteria);
                var response = client.Execute <int>(request);

                int totalRecords = response.Data; // unscPerTransactionViewlist.Count;
                criteria.size = totalRecords;
                criteria.page = 1;
                var modelDownload = await GetAllUnscDataAsync(criteria);

                //DownloadCSV(modelDownload);
                return(RedirectToAction("Index", modelDownload));
            }
            return(RedirectToAction("Index", criteria));
        }
Beispiel #4
0
        public ActionResult Index(BONoticeSearchCriteria criteria, string download)
        {
            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity = GetValueFromIdentity();
            int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId);

            string pipelineDuns = criteria.PipelineDuns;

            ViewBag.pipelineDuns = pipelineDuns;

            if (download != null)
            {
                var request = new RestRequest(string.Format("GetSwntTotalRecords"), Method.POST)
                {
                    RequestFormat = DataFormat.Json
                };
                request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                request.AddJsonBody(criteria);
                var response     = client.Execute <int>(request);
                int totalRecords = response.Data;
                criteria.PageSize   = totalRecords;
                criteria.PageNo     = 1;
                criteria.NoticeList = GetNoticesBySearch(criteria);
                DownloadCSV(criteria);
            }
            return(this.View(criteria));
        }
Beispiel #5
0
        public async Task <ActionResult> Index(SearchCriteriaOACY criteria, string download)
        {
            var CycleIndicator = ICycleIndicator.GetCycles();

            ViewBag.Cycles = new SelectList(CycleIndicator.AsEnumerable(), "Code", "Name", 1);

            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity      = GetValueFromIdentity();
            criteria.flagDefault = false;
            if (download != null)
            {
                var request = new RestRequest(string.Format("GetTotalCountOacy"), Method.POST)
                {
                    RequestFormat = DataFormat.Json
                };
                request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                request.AddJsonBody(criteria);
                var response     = client.Execute <int>(request);
                int totalRecords = response.Data;
                criteria.size = totalRecords;
                criteria.page = 1;
                var modelDownload = await GetAllOacyDataAsync(criteria);

                //DownloadCSV(modelDownload);
                return(RedirectToAction("Index", modelDownload));
            }
            return(RedirectToAction("Index", criteria));
        }
Beispiel #6
0
        public ActionResult GetWatchListSetting(int selectedItem)
        {
            WatchListDTO            watchList       = new WatchListDTO();
            ShipperReturnByIdentity currentIdentity = GetValueFromIdentity();
            var user = SignInManager.UserManager.FindById(currentIdentity.UserId);

            if (user != null)
            {
                watchList.UserEmail = user.Email;
            }

            watchList.RuleList = new List <WatchListRule>()
            {
            };
            ViewBag.Pipeline = GetPipelines(); // pipelineService.GetAllPipelineList(GetCurrentCompanyID(),GetLoggedInUserId());
            switch (selectedItem)
            {
            case 1:
                watchList.DatasetId = Enums.EnercrossDataSets.OACY;
                break;

            case 2:
                watchList.DatasetId = Enums.EnercrossDataSets.UNSC;
                break;

            case 3:
                watchList.DatasetId = Enums.EnercrossDataSets.SWNT;
                break;
            }
            return(PartialView(watchList));
        }
        // GET: CustomUPRDRequest
        public ActionResult Index(string pipelineDuns)
        {
            CustomUPRDReqDTO dto  = new CustomUPRDReqDTO();
            var         pipelines = GetPipelines();
            PipelineDTO pipe      = pipelines.Where(a => a.DUNSNo == pipelineDuns).FirstOrDefault();

            if (pipe != null)
            {
                ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
                ViewBag.NotifierEntity = _notifierEntityService.GetNotifierEntityOfUprdStatus();
                var pipelineEDISetting = pipelineEDISettingService.GetPipelineSetting((int)DataSet.Upload_of_Requests_for_Download_of_Posted_Datasets, pipe.DUNSNo, currentIdentityValues.ShipperDuns);
                if (pipelineEDISetting != null)
                {
                    dto.EndDate     = pipelineEDISetting.EndDate;
                    dto.StartDate   = pipelineEDISetting.StartDate;
                    dto.pipelineId  = pipe.ID;
                    dto.pipeDuns    = pipe.DUNSNo;
                    dto.shipperDuns = currentIdentityValues.ShipperDuns;
                    if (pipelineEDISetting.ForOacy)
                    {
                        dto.RequestFor = 1;
                    }
                    if (pipelineEDISetting.ForUnsc)
                    {
                        dto.RequestFor = 2;
                    }
                    if (pipelineEDISetting.ForSwnt)
                    {
                        dto.RequestFor = 3;
                    }
                }
            }
            return(View(dto));
        }
Beispiel #8
0
        public ActionResult Index(SearchCriteriaUNSC criteria)
        {
            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity = GetValueFromIdentity();
            var model = new SearchCriteriaUNSC();
            //model.PipelineID = criteria.PipelineID;
            var pipelineDuns = criteria.PipelineDuns;

            model.PipelineDuns       = pipelineDuns;
            model.postTime           = criteria.postTime == null ? DateTime.Now.Date + new TimeSpan(DateTime.Now.AddHours(-4).TimeOfDay.Hours, 0, 0) : criteria.postTime;
            model.EffectiveStartDate = criteria.EffectiveStartDate;
            model.EffectiveEndDate   = criteria.EffectiveEndDate;
            if (criteria.flagDefault)
            {
                var request = new RestRequest(string.Format("GetRecentUnscPostDate"), Method.GET);
                request.AddQueryParameter("PipelineDuns", pipelineDuns);
                var response = client.Execute <DateTime?>(request);
                model.postStartDate = response.Data != null ? response.Data : DateTime.Now.Date; // _IUNSCService.GetRecentUnscPostDate(pipelineDuns);
            }
            else
            {
                model.postStartDate = criteria.postStartDate;
            }
            //criteria.postStartDate = model.postStartDate;

            model.keyword = criteria.keyword;
            //model.UnscPerTransactionViewModel = (list != null && list.Result.UnscPerTransactionViewModel.Count() > 0) ? list.Result.UnscPerTransactionViewModel;
            //var modelDownload = await GetAllUnscDataAsync(criteria);
            var data = GetAllUnscDataAsync(model);

            model.UnscPerTransactionViewModel = data.Result.UnscPerTransactionViewModel;
            return(this.View(model));
        }
Beispiel #9
0
        public ActionResult Index(NonPathedDTO model, string Search)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            model.ShipperDuns = currentIdentityValues.ShipperDuns;
            model.UserId      = Guid.Parse(currentIdentityValues.UserId);
            string pipelineDuns = model.PipelineDuns;

            if (Search == null)
            {
                model.CompanyId = Convert.ToInt32(currentIdentityValues.CompanyId ?? "0");
                bool result = false;
                var  Id     = nonPathedService.SaveAllNonPathedNominations(model);
                result               = (Id == Guid.Empty) ? false : true;
                ViewBag.Cycles       = ICycleIndicator.GetCycles();
                ViewBag.SubmitStatus = result;
                return(RedirectToAction("Index", new { pipelineDuns = model.PipelineDuns }));
            }
            else
            {
                model = nonPathedService.GetNonPathedNominations(model.PipelineDuns, model.StatusId, model.StartDate, model.EndDate, model.ShipperDuns, model.UserId.GetValueOrDefault());
                model = UpdateCounterPartyAndLocNameInNonPathed(model);
                model.PipelineDuns = pipelineDuns;
                ViewBag.StatusID   = metadataFileStatusService.GetNomStatus();
                ViewBag.Cycles     = ICycleIndicator.GetCycles();
                var notifier = _notifierEntityService.GetNotifierEntityForNoms(currentIdentityValues.UserId);//.GetNotifierEntityofBatchTable();
                ViewBag.NotifierEntity = notifier;
                return(View(model));
            }
        }
Beispiel #10
0
        public ActionResult LoadHybridPathedPartial(PathedDTO model)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            model.DunsNo    = currentIdentityValues.ShipperDuns;
            model.companyId = String.IsNullOrEmpty(currentIdentityValues.CompanyId) ? 0 : int.Parse(currentIdentityValues.CompanyId);
            model.ShipperID = new Guid(currentIdentityValues.UserId);
            if (model.PathedNomsList == null)
            {
                TempData["status"] = "Please fill row.";
                // return RedirectToAction("Index", new { BatchId = Mainmodel.Id, pipelineId = model.PipelineID });
                return(RedirectToAction("Index", new { pipelineDuns = model.PipelineDuns }));
            }
            Guid?transactionID = _pathedNominationService.SaveAndUpdatePathedNomination(model, true);

            if (transactionID != null)
            {
                TempData["status"] = "Data saved successfully";
            }
            else
            {
                TempData["status"] = "Data saving failed";
            }
            //  return RedirectToAction("Index", new { BatchId = Mainmodel.Id, pipelineId = model.PipelineID });
            return(RedirectToAction("Index", new { pipelineDuns = model.PipelineDuns }));
        }
Beispiel #11
0
        public ActionResult Index(string pipelineDuns)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            PipelineDTO pipe = new PipelineDTO();

            if (Request["pipelineDuns"] == null || string.IsNullOrEmpty(pipelineDuns))
            {
                var pipes = GetPipelines();
                pipelineDuns = pipes.Count > 0 ? pipes.FirstOrDefault().DUNSNo : string.Empty;
                pipe         = pipes.Count > 0 ? pipes.FirstOrDefault() : new PipelineDTO();
            }
            else
            {
                pipelineDuns = Request["pipelineDuns"] != null ? Request["pipelineDuns"].ToString() : pipelineDuns;
                var pipes = GetPipelines();
                pipe = pipes.Count > 0 ? pipes.Where(a => a.DUNSNo == pipelineDuns).FirstOrDefault() : new PipelineDTO();
            }

            if (pipe != null && (pipe.ModelTypeID == (int)NomType.Pathed || pipe.ModelTypeID == (int)NomType.HyPathedNonPathed))
            {
                return(RedirectToAction("Index", "PathedNomination", new { pipelineDuns = pipe.DUNSNo }));
            }
            else if (pipe != null && (pipe.ModelTypeID == (int)NomType.PNT || pipe.ModelTypeID == (int)NomType.HyNonPathedPNT || pipe.ModelTypeID == (int)NomType.HyPathedPNT))
            {
                return(RedirectToAction("Index", "Batch", new { pipelineDuns = pipe.DUNSNo }));
            }


            NonPathedDTO model = new NonPathedDTO();

            DateTime todayDate = DateTime.Now.Date;

            model.StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            model.EndDate   = model.StartDate.AddMonths(2);
            model.UserId    = Guid.Parse(currentIdentityValues.UserId);
            int status = -1;

            model.ShipperDuns  = currentIdentityValues.ShipperDuns;
            model.PipelineDuns = pipe.DUNSNo;
            model = nonPathedService.GetNonPathedNominations(pipe.DUNSNo, status, model.StartDate, model.EndDate, model.ShipperDuns, model.UserId.GetValueOrDefault());
            model = UpdateCounterPartyAndLocNameInNonPathed(model);
            model.PipelineDuns = pipe.DUNSNo;
            ViewBag.StatusID   = metadataFileStatusService.GetNomStatus();
            ViewBag.Cycles     = ICycleIndicator.GetCycles();
            var notifier = _notifierEntityService.GetNotifierEntityForNoms(currentIdentityValues.UserId);

            ViewBag.NotifierEntity = notifier;

            return(View(model));
        }
Beispiel #12
0
        public ActionResult GetData(NonPathedDTO model)
        {
            string pipelineDuns = model.PipelineDuns;
            // var pipe = pipelineService.GetPipeline(model.PipelineId);
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            model.ShipperDuns  = currentIdentityValues.ShipperDuns;
            model.UserId       = Guid.Parse(currentIdentityValues.UserId);
            model              = nonPathedService.GetNonPathedNominations(model.PipelineDuns, model.StatusId, model.StartDate, model.EndDate, model.ShipperDuns, model.UserId.GetValueOrDefault());
            model.PipelineDuns = pipelineDuns;
            ViewBag.StatusID   = metadataFileStatusService.GetNomStatus();
            ViewBag.Cycles     = ICycleIndicator.GetCycles();
            return(PartialView("_RecDelTables", model));
        }
Beispiel #13
0
        public ActionResult Index(WatchListDTO watchlist, string Save)
        {
            var msg = Validation(watchlist);

            if (string.IsNullOrEmpty(msg))
            {
                ShipperReturnByIdentity currentIdentity = GetValueFromIdentity();
                watchlist.UserId = currentIdentity.UserId;
                var url = BaseUrl();

                watchlist.MoreDetailURLinAlert = url;
                if (Save == "Update")
                {
                    // Code for Update

                    RestRequest request = new RestRequest("UpdateWatchList", Method.POST);
                    request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                    request.AddJsonBody(watchlist);
                    IRestResponse <bool> response = client.Execute <bool>(request);
                    return(RedirectToAction("List"));
                }
                else
                {
                    //Code for Save
                    RestRequest request = new RestRequest("SaveWatchList", Method.POST);
                    request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                    request.AddJsonBody(watchlist);
                    IRestResponse <bool> response = client.Execute <bool>(request);
                    bool save = response.Data;
                    if (save != false)
                    {
                        TempData["Msg"] = "Data saved successfully";
                    }
                    else
                    {
                        TempData["Msg"] = "Data saving failed";
                    }
                    return(RedirectToAction("Index", new { watchListId = 0 }));
                }
            }
            else
            {
                TempData["Msg"] = "Action failed." + msg;
                return(RedirectToAction("Index", new { watchListId = 0 }));
            }
        }
        public ActionResult Index(CustomUPRDReqDTO custUPRDReqDTO)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            var pipelineEDISetting = pipelineEDISettingService.GetPipelineSetting(11, custUPRDReqDTO.pipeDuns, currentIdentityValues.ShipperDuns);

            if (pipelineEDISetting != null)
            {
                pipelineEDISetting.StartDate    = custUPRDReqDTO.StartDate;
                pipelineEDISetting.EndDate      = custUPRDReqDTO.EndDate;
                pipelineEDISetting.SendManually = true;

                switch (custUPRDReqDTO.RequestFor)
                {
                case 1:
                    pipelineEDISetting.ForOacy = true;
                    pipelineEDISetting.ForUnsc = false;
                    pipelineEDISetting.ForSwnt = false;
                    break;

                case 2:
                    pipelineEDISetting.ForOacy = false;
                    pipelineEDISetting.ForUnsc = true;
                    pipelineEDISetting.ForSwnt = false;
                    break;

                case 3:
                    pipelineEDISetting.ForOacy = false;
                    pipelineEDISetting.ForUnsc = false;
                    pipelineEDISetting.ForSwnt = true;
                    break;

                default:
                    pipelineEDISetting.ForOacy      = false;
                    pipelineEDISetting.ForUnsc      = false;
                    pipelineEDISetting.ForSwnt      = false;
                    pipelineEDISetting.SendManually = false;
                    break;
                }
                if (pipelineEDISettingService.UpdatePipelineEDISetting(pipelineEDISetting))
                {
                }
            }
            ViewBag.NotifierEntity = _notifierEntityService.GetNotifierEntityOfUprdStatus();
            return(View(custUPRDReqDTO));
        }
Beispiel #15
0
        public ActionResult Index(string pipelineDuns)
        {
            LocationsDTO            model = new LocationsDTO();
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            PipelineDTO pipe = new PipelineDTO();

            if (Request["pipelineDuns"] == null || string.IsNullOrEmpty(pipelineDuns))
            {
                var pipes = GetPipelines();
                pipelineDuns = pipes.Count > 0 ? pipes.FirstOrDefault().DUNSNo : string.Empty;
            }
            else
            {
                pipelineDuns = Request["pipelineDuns"] != null ? Request["pipelineDuns"].ToString() : pipelineDuns;
            }
            model.PipelineDuns = pipelineDuns;
            return(View(model));
        }
Beispiel #16
0
        public ShipperReturnByIdentity GetValueFromIdentity()
        {
            ShipperReturnByIdentity value = new ShipperReturnByIdentity();
            var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;

            value.CompanyId = identity.Claims.Where(c => c.Type == "CompanyId")
                              .Select(c => c.Value).SingleOrDefault();
            value.ShipperDuns = identity.Claims.Where(c => c.Type == "ShipperDuns")
                                .Select(c => c.Value).SingleOrDefault();
            value.UserId = identity.Claims.Where(c => c.Type == "UserId")
                           .Select(c => c.Value).SingleOrDefault();
            value.UserName = identity.Claims.Where(c => c.Type == "UserName")
                             .Select(c => c.Value).SingleOrDefault();
            value.ShipperName = identity.Claims.Where(c => c.Type == "ShipperDetails")
                                .Select(c => c.Value).SingleOrDefault();
            value.FirstSelectedPipeIdByUser = Convert.ToInt16(identity.Claims.Where(a => a.Type == "FirstSelectedPipeIdByUser")
                                                              .Select(a => a.Value).SingleOrDefault());
            return(value);
        }
Beispiel #17
0
        public ActionResult LoadHybridNonPathedPartial(string pipelineDuns)
        {
            string   PipelineDuns = "";
            DateTime todayDate    = DateTime.Now.Date;
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            int status = -1;

            NonPathedDTO model = nonPathedService.GetNonPathedNominations(PipelineDuns, status, DateTime.MinValue, DateTime.MaxValue, currentIdentityValues.ShipperDuns, new Guid(currentIdentityValues.UserId));

            model = UpdateCounterPartyAndLocNameInNonPathed(model);
            if (model == null)
            {
                model = new NonPathedDTO();
            }
            model.PipelineDuns = pipelineDuns;
            var CycleIndicator = _cycleIndicator.GetCycles();

            ViewBag.Cycles = CycleIndicator;
            return(PartialView("_NonPathedHybrid", model));
        }
Beispiel #18
0
        public ActionResult Index(string val, string pipelineDuns)
        {
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            //if (pipelineId == null)
            //    pipelineId = currentIdentityValues.FirstSelectedPipeIdByUser;

            var value = val == null ? "loc" : val;

            ViewBag.SqtsType = value;
            if (value == "loc")
            {
                ViewBag.IsSqtsForLoc = true;
            }
            else
            {
                ViewBag.IsSqtsForLoc = false;
            }
            PipelineDTO pipe = new PipelineDTO();

            if (Request["pipelineDuns"] == null || string.IsNullOrEmpty(pipelineDuns))
            {
                var pipes = GetPipelines();
                pipelineDuns = pipes.Count > 0 ? pipes.FirstOrDefault().DUNSNo : string.Empty;
                pipe         = pipes.Count > 0 ? pipes.FirstOrDefault() : new PipelineDTO();
            }
            else
            {
                pipelineDuns = Request["pipelineDuns"] != null ? Request["pipelineDuns"].ToString() : pipelineDuns;
                var pipes = GetPipelines();
                pipe = pipes.Count > 0 ? pipes.Where(a => a.DUNSNo == pipelineDuns).FirstOrDefault() : new PipelineDTO();
            }

            if (pipe != null)
            {
                // NomType modelType = _pipelineService.GetPathTypeByPipelineDuns(_pipelineService.GetDunsByPipelineID(pipelineId.Value));
                ViewBag.PipelineNomType = GetPathTypeByPipelineType(pipe.ModelTypeID);
                ViewBag.PipelineDuns    = pipe.DUNSNo;
            }
            return(View());
        }
Beispiel #19
0
        public PartialViewResult GetDataSqtsOrphan(int?page, string pipelineDuns, int month, string pathType, string sqtsType, string IsSqtsQty, bool showMine, bool showZero)
        {
            ViewBag.Month        = month;
            ViewBag.PathType     = pathType;
            ViewBag.IsSqtsQty    = IsSqtsQty;
            ViewBag.IsSqtsForLoc = Convert.ToBoolean(sqtsType) ? true : false;
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            string            UserId   = showMine ? currentIdentityValues.UserId : string.Empty;
            int               pageSize = 15;
            List <SummaryDTO> model    = new List <SummaryDTO>();

            if (Convert.ToBoolean(IsSqtsQty))
            {
                model = _sqtsRepo.GetSqtsData(month, pipelineDuns, UserId, pathType, currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
            }
            else
            {
                model = _sqtsRepo.GetSqtsOrphanData(month, pipelineDuns, pathType, currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
            }
            model = UpdateCounterPartyName(model);
            return(PartialView("_sqtsOrphanData", model));
        }
Beispiel #20
0
        public ActionResult Index(string pipelineDuns)
        {
            if (TempData["status"] != null)
            {
                ViewBag.Status = TempData["status"] + "";
            }
            PipelineDTO pipe = new PipelineDTO();

            if (Request["pipelineDuns"] == null || string.IsNullOrEmpty(pipelineDuns))
            {
                var pipes = GetPipelines();
                pipelineDuns = pipes.Count > 0 ? pipes.FirstOrDefault().DUNSNo : string.Empty;
                pipe         = pipes.Count > 0 ? pipes.FirstOrDefault() : new PipelineDTO();
            }
            else
            {
                pipelineDuns = Request["pipelineDuns"] != null ? Request["pipelineDuns"].ToString() : pipelineDuns;
                var pipes = GetPipelines();
                pipe = pipes.Count > 0 ? pipes.Where(a => a.DUNSNo == pipelineDuns).FirstOrDefault() : new PipelineDTO();
            }
            // var pipe = pipelineService.GetPipeline(pipelineId);
            if (pipe != null && (pipe.ModelTypeID == (int)NomType.Pathed || pipe.ModelTypeID == (int)NomType.HyPathedNonPathed))
            {
                return(RedirectToAction("Index", "PathedNomination", new { pipelineDuns = pipe.DUNSNo }));
            }
            else if (pipe != null && pipe.ModelTypeID == (int)NomType.NonPathed)
            {
                return(RedirectToAction("Index", "NonPathed", new { pipelineDuns = pipe.DUNSNo }));
            }

            ViewBag.PipelineDuns = pipelineDuns;
            ViewBag.ModelTypeID  = pipe.ModelTypeID;
            ViewBag.Pipelinename = pipe.Name;
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            var notifier = _notifierEntityService.GetNotifierEntityForNoms(currentIdentityValues.UserId);//GetNotifierEntityofBatchTable();

            ViewBag.NotifierEntity = notifier;
            return(View());
        }
Beispiel #21
0
        public ActionResult LoadHybridPathedPartial(string pipelineDuns)
        {
            PathedDTO model = new PathedDTO();

            model.PathedNomsList = new List <PathedNomDetailsDTO>()
            {
                new PathedNomDetailsDTO()
                {
                    StartDate = DateTime.Now, EndDate = DateTime.Now, CycleID = 1
                }
            };
            model.PipelineDuns = pipelineDuns;
            DateTime todayDate = DateTime.Now.Date;
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
            int status = -1;
            int pathedListTotalCount = _pathedNominationService.GetPathedListTotalCount(model.PipelineDuns, status, DateTime.MinValue, DateTime.Now.AddYears(1), currentIdentityValues.ShipperDuns, new Guid(currentIdentityValues.UserId));

            List <PathedNomDetailsDTO> nomlist = _pathedNominationService.GetPathedListWithPaging(model.PipelineDuns, status, DateTime.MinValue, DateTime.Now.AddYears(1), currentIdentityValues.ShipperDuns, new Guid(currentIdentityValues.UserId), new SortingPagingInfo()
            {
                CurrentPageIndex = 0, PageSize = pathedListTotalCount == 0 ? 1: pathedListTotalCount
            });

            model.PathedNomsList = UpdatePathedCounterPartyAndLoactionName(nomlist);

            var CycleIndicator = _cycleIndicator.GetCycles();
            var QuantityType   = _metadataQuantityTypeIndicatorService.GetQuantityTypes();
            var CapacityType   = _metadataCapacityTypeIndicatorService.GetCapacityTypes();
            var BidUp          = _metaDataBidUpIndicatorService.GetBidUpIndicator();
            var Export         = _metadataExportDeclarationService.GetExportDeclarations();
            var Status         = metadataFileStatusService.GetNomStatus();

            ViewBag.Cycles       = CycleIndicator;
            ViewBag.QuantityType = QuantityType;
            ViewBag.CapacityType = CapacityType;
            ViewBag.BidUp        = BidUp;
            ViewBag.Export       = Export;
            ViewBag.StatusID     = Status;
            return(PartialView("_Pathedhybrid", model));
        }
Beispiel #22
0
        public ActionResult Index(SearchCriteriaOACY criteria)
        {
            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity = GetValueFromIdentity();

            var model = new SearchCriteriaOACY();

            //model.PipelineID = criteria.PipelineID;
            model.EffectiveStartDate = criteria.EffectiveStartDate;
            model.keyword            = criteria.keyword;
            model.WatchListId        = criteria.WatchListId;
            model.Cycle    = criteria.Cycle;
            model.postTime = criteria.postTime == null ? DateTime.Now.Date + new TimeSpan(DateTime.Now.AddHours(-4).TimeOfDay.Hours, 0, 0) : criteria.postTime;
            var pipelineDuns = criteria.PipelineDuns; // piplineservice.GetDunsByPipelineID(criteria.PipelineID.Value);

            model.PipelineDuns = criteria.PipelineDuns;

            if (criteria.flagDefault)
            {
                var request = new RestRequest(string.Format("GetRecentOacyPostDate"), Method.GET);
                request.AddQueryParameter("PipelineDuns", pipelineDuns);
                var response = client.Execute <DateTime?>(request);
                model.postStartDate = response.Data != null ? response.Data : DateTime.Now.Date;
            }
            else
            {
                model.postStartDate = criteria.postStartDate;
            }
            //model.postEndDate = DateTime.Now.AddHours(-4);
            var CycleIndicator = ICycleIndicator.GetCycles();

            ViewBag.Cycles = new SelectList(CycleIndicator.AsEnumerable(), "Code", "Name", 1);
            var result = GetAllOacyDataAsync(model);

            model.OacyPerTransactionViewModel = result.Result.OacyPerTransactionViewModel;
            return(this.View(model));
        }
Beispiel #23
0
        public ActionResult GetData(string pipelineDuns)
        {
            LocationListDTO model = new LocationListDTO();
            //int pipeId = pipelineId.GetValueOrDefault();
            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            //if (pipelineId == null)
            //    pipelineId = currentIdentityValues.FirstSelectedPipeIdByUser;
            model.DunsNo = pipelineDuns;

            if (!string.IsNullOrEmpty(pipelineDuns))
            {
                var request = new RestRequest(string.Format("GetPipelineLocation"), Method.POST)
                {
                    RequestFormat = DataFormat.Json
                };
                request.JsonSerializer = NewtonsoftJsonSerializer.Default;
                request.AddJsonBody(pipelineDuns);
                var response = clientLocation.Execute <LocationsResultDTO>(request);

                int totalRecords = 0;
                if (response.Data != null)
                {
                    model.LocationsList = response.Data.locationsDTO;
                    totalRecords        = response.Data.RecordCount;
                }
                else
                {
                    model.LocationsList = new List <LocationsDTO>();
                    totalRecords        = 0;
                }

                // Filter record count.
                int recFilter = totalRecords;
            }
            return(Json(new { data = model.LocationsList }, JsonRequestBehavior.AllowGet));
        }
Beispiel #24
0
        public ActionResult UpdateWatchListSetting(int id)
        {
            RestRequest request = new RestRequest("GetWatchListById/" + id, Method.GET);
            IRestResponse <WatchListDTO> response = client.Execute <WatchListDTO>(request);

            if (response.IsSuccessful)
            {
                var         watchListDto   = response.Data;
                RestRequest requestForProp = new RestRequest("GetPropertiesByDataSet", Method.GET);
                requestForProp.AddQueryParameter("dataset", watchListDto.DatasetId.ToString());
                IRestResponse <List <WatchListProperty> > responseForProp = client.Execute <List <WatchListProperty> >(requestForProp);
                List <WatchListProperty> properties      = responseForProp.Data != null ? responseForProp.Data : new List <WatchListProperty>(); //IWatchlistService.GetPropertiesByDataSet(watchListDto.DatasetId);
                ShipperReturnByIdentity  currentIdentity = GetValueFromIdentity();
                var user = SignInManager.UserManager.FindById(currentIdentity.UserId);
                if (user != null)
                {
                    watchListDto.UserEmail = user.Email;
                }
                ViewBag.Properties = properties;
                if (properties.Count > 0)
                {
                    ViewBag.Operators = properties.FirstOrDefault().Operators;
                }
                else
                {
                    ViewBag.Operators = new List <WatchListOperator>();
                }
                var pipelineList = GetPipelines();
                ViewBag.PipelineId = pipelineList;

                return(PartialView("_updatewatchList", watchListDto));
            }
            else
            {
                return(PartialView("_updatewatchList", null));
            }
        }
Beispiel #25
0
        public ActionResult Index(string pipelineDuns, BONoticeSearchCriteria criteria)
        {
            // criteria.IsCritical = true;

            DateTime minDate = DateTime.MinValue;

            ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity();

            currentIdentity = GetValueFromIdentity();
            int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId);

            criteria.RecipientCompanyID = companyId;

            ViewBag.pipelineDuns = pipelineDuns;
            // criteria.pipelineId = pipelineId;

            criteria.PipelineDuns       = pipelineDuns;
            criteria.postStartDate      = null;
            criteria.postEndDate        = null;
            criteria.EffectiveStartDate = null;
            criteria.EffectiveEndDate   = null;
            //criteria.pipelineId = pipelineId;
            return(this.View(criteria));
        }
Beispiel #26
0
        public ActionResult List()
        {
            WatchListCollection     model           = new WatchListCollection();
            ShipperReturnByIdentity currentIdentity = GetValueFromIdentity();
            RestRequest             request         = new RestRequest("GetWatchListByUserId", Method.POST);

            request.JsonSerializer = NewtonsoftJsonSerializer.Default;
            request.AddJsonBody(currentIdentity.UserId);
            IRestResponse <List <WatchListDTO> > response = client.Execute <List <WatchListDTO> >(request);

            if (response.IsSuccessful)
            {
                model.CollectionWatchList = response.Data;
            }
            else
            {
                model.CollectionWatchList = new List <WatchListDTO>();
            }
            if (TempData["WatchListDeleted"] != null)
            {
                ViewBag.Status = TempData["WatchListDeleted"].ToString();
            }
            return(this.View(model));
        }
Beispiel #27
0
        public PartialViewResult SQTSPartials(SqtsPartials sqts, int month, string sqtsType, string pipelineDuns, bool showMine, bool showZero, int?page)
        {
            int pageSize = 20;

            page          = page == null ? 1 : page;
            ViewBag.Month = month;
            //if (Request["pipelineId"] != null)
            //{
            //    var pipelineData = Request["pipelineId"] + "";
            //    string[] pilineVals = pipelineData.Split('-');
            //    pipelineId = Convert.ToInt32(pilineVals[0]);
            //}
            if (sqtsType == null)
            {
                sqtsType = "loc";
            }
            dynamic model = null;

            if (Request["pipelineDuns"] == null || string.IsNullOrEmpty(pipelineDuns))
            {
                var pipes = GetPipelines();
                pipelineDuns = pipes.Count > 0 ? pipes.FirstOrDefault().DUNSNo : string.Empty;
            }
            else
            {
                pipelineDuns = Request["pipelineDuns"] != null ? Request["pipelineDuns"].ToString() : pipelineDuns;
            }

            ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();

            //if (pipelineId == null)
            //    pipelineId = currentIdentityValues.FirstSelectedPipeIdByUser;
            //pipeDto = _pipelineService.GetPipeline(pipelineId.Value);
            ViewBag.PipelineDuns = pipelineDuns;
            string PartialName = string.Empty;

            ViewBag.IsSqtsForLoc = sqtsType == "loc" ? true : false;
            string UserId = showMine ? currentIdentityValues.UserId : string.Empty;

            switch (sqts)
            {
            case SqtsPartials.NomQty:
                PartialName = "_NomQtyPartial";
                model       = _nomRepo.GetAcceptedNomsOnDate(month, pipelineDuns, UserId, currentIdentityValues.ShipperDuns, sqtsType == "loc" ? true : false, showZero);
                break;

            case SqtsPartials.SqtsQty:
                ViewBag.PathType  = "P";
                ViewBag.IsSqtsQty = "true";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> list = _sqtsRepo.GetSqtsData(month, pipelineDuns, UserId, "P", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                list  = UpdateCounterPartyName(list);
                model = list;
                break;

            case SqtsPartials.SqtsOrphan:
                PartialName       = "_sqtsOrphanCom";
                ViewBag.IsSqtsQty = "false";
                ViewBag.PathType  = "P";
                List <SummaryDTO> listO = _sqtsRepo.GetSqtsOrphanData(month, pipelineDuns, "P", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listO = UpdateCounterPartyName(listO);
                model = listO;
                break;

            case SqtsPartials.NomQtyDelivery:
                PartialName = "_NomQtyDeliveryPartial";
                model       = _nomRepo.GetAcceptedNomOnDate(month, "D", pipelineDuns, UserId, currentIdentityValues.ShipperDuns, sqtsType == "loc" ? true : false, showZero);
                break;

            case SqtsPartials.NomQtyReceipt:
                PartialName = "_NomQtyReceiptPartial";
                model       = _nomRepo.GetAcceptedNomOnDate(month, "R", pipelineDuns, UserId, currentIdentityValues.ShipperDuns, sqtsType == "loc" ? true : false, showZero);
                break;

            case SqtsPartials.SqtsOrphanDelivery:
                ViewBag.PathType  = "D";
                ViewBag.IsSqtsQty = "false";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listDO = _sqtsRepo.GetSqtsOrphanData(month, pipelineDuns, "D", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listDO = UpdateCounterPartyName(listDO);
                model  = listDO;
                break;

            case SqtsPartials.SqtsOrphanReceipt:
                ViewBag.PathType  = "R";
                ViewBag.IsSqtsQty = "false";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listRO = _sqtsRepo.GetSqtsOrphanData(month, pipelineDuns, "R", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listRO = UpdateCounterPartyName(listRO);
                model  = listRO;
                break;

            case SqtsPartials.SqtsQtyDelivery:
                ViewBag.PathType  = "D";
                ViewBag.IsSqtsQty = "true";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listD = _sqtsRepo.GetSqtsData(month, pipelineDuns, UserId, "D", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listD = UpdateCounterPartyName(listD);
                model = listD;
                break;

            case SqtsPartials.SqtsQtyReceipt:
                ViewBag.PathType  = "R";
                ViewBag.IsSqtsQty = "true";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listR = _sqtsRepo.GetSqtsData(month, pipelineDuns, UserId, "R", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listR = UpdateCounterPartyName(listR);
                model = listR;
                break;

            case SqtsPartials.NomQtyContractPath:
                PartialName = "__NomQtyContractPathPartial";
                model       = _nomRepo.GetNomQtyForContractPath(month, pipelineDuns, UserId, currentIdentityValues.ShipperDuns, sqtsType == "loc" ? true : false, showZero);
                break;

            case SqtsPartials.SqtsOrphanContractPath:
                ViewBag.PathType  = "T";
                ViewBag.IsSqtsQty = "false";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listCO = _sqtsRepo.GetSqtsOrphanData(month, pipelineDuns, "T", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listCO = UpdateCounterPartyName(listCO);
                model  = listCO;
                break;

            case SqtsPartials.SqtsQtyContractPath:
                ViewBag.PathType  = "T";
                ViewBag.IsSqtsQty = "true";
                PartialName       = "_sqtsOrphanCom";
                List <SummaryDTO> listC = _sqtsRepo.GetSqtsData(month, pipelineDuns, UserId, "T", currentIdentityValues.ShipperDuns, showZero, pageSize, page.Value);
                listC = UpdateCounterPartyName(listC);
                model = listC;
                break;

            case SqtsPartials.OperSqts:
                PartialName = "_OperSqts";
                string shipperSubDuns           = string.Empty;
                var    shipperAndSubShipperDuns = _shipperSubCompRepo.GetShipperAndSubShipperCompOnDuns(currentIdentityValues.ShipperDuns);
                if (shipperAndSubShipperDuns == null)
                {
                    shipperSubDuns = currentIdentityValues.ShipperDuns;
                }
                else
                {
                    shipperSubDuns = shipperAndSubShipperDuns.SubShipperCompDuns + "," + currentIdentityValues.ShipperDuns;
                }
                var data = _sqtsOpRepo.GetSqtsForOperator(month, pipelineDuns, shipperSubDuns, sqtsType == "loc" ? true : false, showZero);
                data = UpdateSqopCpName(data);
                return(PartialView(PartialName, data));

            default:
                break;
            }
            return(PartialView(PartialName, model));
        }
Beispiel #28
0
        public ActionResult DownloadExcel(string pipelineDuns, int month, string pathType, string IsSqtsQty, bool showMine, bool showZero)
        {
            try
            {
                ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity();
                string            UserId = showMine ? currentIdentityValues.UserId : string.Empty;
                List <SummaryDTO> list   = new List <SummaryDTO>();
                if (Convert.ToBoolean(IsSqtsQty))
                {
                    list = _sqtsRepo.GetAllSqtsData(month, pipelineDuns, UserId, pathType, currentIdentityValues.ShipperDuns, showZero);
                    list = UpdateCounterPartyName(list);

                    // list = _sqtsRepo.GetSqtsDataForExcel(month, pipelineDuns, UserId, pathType, currentIdentityValues.ShipperDuns, showZero);
                }
                else
                {
                    list = _sqtsRepo.GetAllSqtsOrphanData(month, pipelineDuns, pathType, currentIdentityValues.ShipperDuns, showZero);
                    list = UpdateCounterPartyName(list);
                    // list = _sqtsRepo.GetSqtsOrphanDataForExcel(month, pipelineDuns, pathType, currentIdentityValues.ShipperDuns, showZero);
                }
                //list = UpdateCounterPartyName(list);
                IWorkbook workbook;
                workbook = new XSSFWorkbook();
                var headerStyle = workbook.CreateCellStyle();
                var headerFont  = workbook.CreateFont();
                headerFont.IsBold = true;
                headerStyle.SetFont(headerFont);
                //headerStyle.FillBackgroundColor = IndexedColors.Green.Index;


                ISheet sheet1 = workbook.CreateSheet("SQTS");


                IRow      row1     = sheet1.CreateRow(0);
                DataTable dt       = ToDataTable(list);
                int       headCell = 0;
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    String columnName = dt.Columns[j].ToString();
                    if (columnName.Trim() != "SubmittedDate" && columnName.Trim() != "Username" && columnName.Trim() != "Qty")
                    {
                        ICell cell = row1.CreateCell(headCell);
                        cell.SetCellValue(columnName);
                        cell.CellStyle = headerStyle;
                        headCell++;
                    }
                }
                //loops through data
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int  rowCell = 0;
                    IRow row     = sheet1.CreateRow(i + 1);
                    for (int j = 0; j < dt.Columns.Count; j++)
                    {
                        String columnName = dt.Columns[j].ToString();
                        if (columnName.Trim() != "SubmittedDate" && columnName.Trim() != "Username" && columnName.Trim() != "Qty")
                        {
                            string value = string.Empty;
                            if (columnName.Trim() == "nomStartDate" || columnName.Trim() == "nomEndDate")
                            {
                                value = Convert.ToDateTime(dt.Rows[i][columnName].ToString()).ToString("MM/dd/yyyy");
                            }
                            else
                            {
                                value = dt.Rows[i][columnName].ToString();
                            }
                            //string date = DateTime.Now.ToString("");
                            ICell cell = row.CreateCell(rowCell);
                            rowCell++;
                            if (columnName.Trim() == "UpStreamName")
                            {
                                string formula = "VLOOKUP(K" + (i + 2) + ",CP!A1:B5000,2,0)";
                                cell.SetCellFormula(formula);
                            }
                            else if (columnName.Trim() == "DownStreamName")
                            {
                                string formula = "VLOOKUP(L" + (i + 2) + ",CP!A1:B5000,2,0)";
                                cell.SetCellFormula(formula);
                            }
                            else
                            {
                                cell.SetCellValue(value);
                            }
                        }
                    }
                }
                #region Counter Party Sheet
                var      path     = Path.Combine(HostingEnvironment.MapPath("~/App_Data"), "CounterParty.xml");
                FileInfo fileInfo = new FileInfo(path);
                if (System.IO.File.Exists(path) && !IsFileLocked(fileInfo))
                {
                    XmlDocument xml = new XmlDocument();
                    xml.Load(path);
                    XmlNodeList    nodeListCP = xml.GetElementsByTagName("CounterPartiesDTO");
                    List <XmlNode> NodeCP     = new List <XmlNode>(nodeListCP.Cast <XmlNode>());
                    ISheet         sheet2     = workbook.CreateSheet("CP");
                    IRow           row2       = sheet2.CreateRow(0);
                    ICell          cell1      = row2.CreateCell(0);
                    cell1.SetCellValue("Identifier");
                    cell1.CellStyle = headerStyle;
                    ICell cell2 = row2.CreateCell(1);
                    cell2.SetCellValue("Name");
                    cell2.CellStyle = headerStyle;
                    for (int i = 0; i < NodeCP.Count; i++)
                    {
                        IRow  row      = sheet2.CreateRow(i + 1);
                        var   nodeIden = NodeCP[i].SelectSingleNode("Identifier").InnerText;
                        var   nodeName = NodeCP[i].SelectSingleNode("Name").InnerText;
                        ICell cellIden = row.CreateCell(0);
                        cellIden.SetCellValue(nodeIden);
                        ICell cellName = row.CreateCell(1);
                        cellName.SetCellValue(nodeName);
                    }
                }
                #endregion
                using (var exportData = new MemoryStream())
                {
                    workbook.Write(exportData);
                    return(File(exportData.ToArray(),
                                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                                "SQTS.xls"));
                }
            }
            catch (Exception ex)
            {
                return(File(new byte[0],
                            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                            "SQTS.xls"));
            }
        }