Example #1
0
        public PartialViewResult _Batch(string pipelineDuns)
        {
            var    identity    = (ClaimsPrincipal)Thread.CurrentPrincipal;
            string shipperDuns = identity.Claims.Where(c => c.Type == "ShipperDuns")
                                 .Select(c => c.Value).SingleOrDefault();

            var UserKey = new Guid(identity.Claims.Where(c => c.Type == "UserId")
                                   .Select(c => c.Value).SingleOrDefault());

            BatchNomCollection batchListModel = new BatchNomCollection();

            batchListModel.BatchList    = new List <BatchDTO>();
            batchListModel.pipelineDuns = pipelineDuns;
            batchListModel.showMine     = Session["showMinebatch"] == null? true : (bool)Session["showMinebatch"];
            DateTime todayDate    = DateTime.Now.Date;
            var      currentmonth = todayDate.Month;

            batchListModel.StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            batchListModel.EndDate   = batchListModel.StartDate.AddMonths(2);
            batchListModel.StatusId  = -1;
            List <BatchDTO> batchList = pntNominationService.GetBatches("", pipelineDuns, batchListModel.StatusId, todayDate.AddDays(-15), todayDate.AddDays(15), 1, 1000, batchListModel.showMine ? UserKey : Guid.Empty, shipperDuns).ToList();

            batchListModel.BatchList = batchList.OrderByDescending(a => a.CreatedDate).ToList();
            var Status = metadataFileStatusService.GetNomStatus();

            ViewBag.StatusID = Status;
            var notifier = _notifierEntityService.GetNotifierEntityForNoms(UserKey.ToString());//.GetNotifierEntityofBatchTable();

            ViewBag.NotifierEntity = notifier;
            return(PartialView(batchListModel));
            // return this.View(batchListModel);
        }
Example #2
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));
        }