Beispiel #1
0
        public async Task <QuoteSearchRes> GetQRFEnquiryPipelineList(QuoteSearchReq objQuoteSearchReq, string ticket)
        {
            QuoteSearchRes objQuoteSearchRes = new QuoteSearchRes();

            objQuoteSearchRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceQuote:QRFAgentDetailsBySearchCriteria"), objQuoteSearchReq, typeof(QuoteSearchRes), ticket);

            return(objQuoteSearchRes);
        }
Beispiel #2
0
        public IActionResult Quote(QuoteSearchViewModel model)
        {
            SalesQuoteLibrary    quoteLibrary = new SalesQuoteLibrary(_configuration);
            QuoteSearchViewModel modelMaster  = new QuoteSearchViewModel();

            modelMaster = quoteLibrary.BindMasterData(_configuration, token);
            model.PipelineStagesList = modelMaster.PipelineStagesList;
            model.QuotePriorityList  = modelMaster.QuotePriorityList;
            model.QuoteResultList    = modelMaster.QuoteResultList;
            model.QuoteStatusList    = modelMaster.QuoteStatusList;
            model.DateTypeList       = modelMaster.DateTypeList;
            model.MonthList          = modelMaster.MonthList;
            model.YearList           = modelMaster.YearList;
            model.DivisionList       = modelMaster.DivisionList;
            model.DestinationList    = modelMaster.DestinationList;

            QuoteSearchReq objQuoteSearchReq = new QuoteSearchReq();

            objQuoteSearchReq.CurrentPipeline = model.PipelineStages;
            objQuoteSearchReq.AgentName       = model.AgentName;
            objQuoteSearchReq.QRFID           = model.CNKReferenceNo;
            objQuoteSearchReq.TourCode        = model.AgentReferenceNo;
            objQuoteSearchReq.TourName        = model.AgentTour;
            objQuoteSearchReq.QRFStatus       = model.QuoteStatus;
            objQuoteSearchReq.QuoteResult     = model.QuoteResult;
            objQuoteSearchReq.Priority        = model.QuotePriority;
            objQuoteSearchReq.Date            = model.DateType;
            objQuoteSearchReq.Division        = model.Division;
            objQuoteSearchReq.Destination     = model.Destination;
            objQuoteSearchReq.UserId          = ckLoginUser_Id;

            if (string.IsNullOrEmpty(model.From))
            {
                objQuoteSearchReq.From = null;
            }
            else
            {
                var strFromDT = model.From.Split("/");
                if (strFromDT?.Count() >= 3)
                {
                    DateTime fromDT = new DateTime(Convert.ToInt32(strFromDT[2]), Convert.ToInt32(strFromDT[1]), Convert.ToInt32(strFromDT[0]));
                    objQuoteSearchReq.From = fromDT;
                }
                else
                {
                    objQuoteSearchReq.From = null;
                }
            }
            if (string.IsNullOrEmpty(model.To))
            {
                objQuoteSearchReq.To = null;
            }
            else
            {
                var strToDT = model.To.Split("/");
                if (strToDT?.Count() >= 3)
                {
                    DateTime toDT = new DateTime(Convert.ToInt32(strToDT[2]), Convert.ToInt32(strToDT[1]), Convert.ToInt32(strToDT[0]));
                    objQuoteSearchReq.To = toDT;
                }
                else
                {
                    objQuoteSearchReq.To = null;
                }
            }

            objQuoteSearchReq.Month = model.Month;
            objQuoteSearchReq.Year  = Convert.ToInt16(model.Year);

            SalesProviders objSalesProvider  = new SalesProviders(_configuration);
            QuoteSearchRes objQuoteSearchRes = objSalesProvider.GetQRFEnquiryPipelineList(objQuoteSearchReq, token).Result;

            model.EnquiryPipeline = new EnquiryPipelineViewModel();
            model.EnquiryPipeline.QuoteSearchDetails = objQuoteSearchRes.QuoteSearchDetails;
            if (model.EnquiryPipeline.QuoteSearchDetails != null)
            {
                foreach (var i in model.EnquiryPipeline.QuoteSearchDetails)
                {
                    if (i.AgentPassengerInfo == null)
                    {
                        i.AgentPassengerInfo = new AgentPassengerInfo();
                    }
                    if (i.FollowUpItem == null)
                    {
                        i.FollowUpItem = new FollowUpItem();
                    }
                }
            }
            model.EnquiryPipeline.Status     = objQuoteSearchRes.ResponseStatus.Status;
            model.EnquiryPipeline.TotalCount = objQuoteSearchRes.TotalCount;
            ViewBag.PipelineStages           = model.PipelineStages;
            ViewBag.SearchResult             = true;
            ViewBag.IsAllowToEdit            = false;

            if (model.PipelineStages == "Quote Pipeline" || model.PipelineStages == "Agent Approval Pipeline" || model.PipelineStages == "Amendment Pipeline" || model.PipelineStages == "Handover Pipeline")
            {
                if (UserRoles.Contains("Sales Officer"))
                {
                    ViewBag.IsAllowToEdit = true;
                }
            }
            else if (model.PipelineStages == "Costing Pipeline")
            {
                if (UserRoles.Contains("Costing Officer"))
                {
                    ViewBag.IsAllowToEdit = true;
                }
            }
            else if (model.PipelineStages == "Costing Approval Pipeline")
            {
                if (UserRoles.Contains("Product Accountant"))
                {
                    ViewBag.IsAllowToEdit = true;
                }
            }

            return(View(model));
        }