Exemplo n.º 1
0
        public IActionResult GetDetailedInfo(string QRFID, long filterByDeparture = 0)
        {
            DetailedInfoViewModel model = new DetailedInfoViewModel();

            #region Dropdown Binding
            QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq()
            {
                QRFID = QRFID, date = (DateTime?)null
            };
            QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result;
            QRFPaxSlabGetReq       objPaxSlabReq        = new QRFPaxSlabGetReq()
            {
                QRFID = QRFID
            };
            QRFPaxGetResponse objPaxSlabRes = coProviders.GetPaxSlabDetailsForCostingByQRF_Id(objPaxSlabReq, token).Result;
            GuesstimateGetReq request       = new GuesstimateGetReq()
            {
                QRFID = QRFID
            };
            GuesstimateGetRes response = coProviders.GetGuesstimate(request, token).Result;

            model.ProductNameList    = GetProductNamesFromGuesstimate(response.Guesstimate.GuesstimatePosition);
            model.SupplierList       = GetSuppliersFromGuesstimate(response.Guesstimate.GuesstimatePosition);
            model.ProductTypeList    = GetProductTypesFromGuesstimate(response.Guesstimate.GuesstimatePosition);
            model.DepartureDatesList = (objDepartureDatesRes.DepartureDates).Select(a => new AttributeValues {
                AttributeValue_Id = a.Departure_Id.ToString(), Value = Convert.ToDateTime(a.Date).ToString("dd MMM yy")
            }).ToList();
            model.PaxSlabList = (objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs).Select(a => new AttributeValues {
                AttributeValue_Id = a.PaxSlab_Id.ToString(), Value = a.From + "-" + a.To
            }).ToList();
            #endregion

            return(PartialView("_DetailedInfo", model));
        }
Exemplo n.º 2
0
        public IActionResult GetGuesstimateData(string QRFID, string filterByDay = null, string filterByServiceType = null, string filterByPackageType = null, long filterByDeparture = 0, long filterByPaxSlab = 0, string SuccessMessage = null, string ErrorMessage = null, string CalculateFor = null)
        {
            try
            {
                if (!(string.IsNullOrEmpty(SuccessMessage)))
                {
                    TempData["success"] = SuccessMessage;
                }

                if (!(string.IsNullOrEmpty(ErrorMessage)))
                {
                    TempData["error"] = ErrorMessage;
                }

                GuesstimateViewModel model = new GuesstimateViewModel();

                //#region Get Summary Detailsby QRFId
                //qrfSummaryGetReq = new QRFSummaryGetReq();
                //qrfSummaryGetReq.QRFID = QRFID;
                //qrfSummaryGetRes = qrfSummaryProviders.GetQRFSummary(qrfSummaryGetReq, token).Result;
                //model.SummaryDetails = qrfSummaryMapping.GetQRFSummaryDetails(qrfSummaryGetRes, token);
                //#endregion

                #region Filter Dropdown Bindings

                var objKeepAs = new List <AttributeValues>();

                MasterTypeRequest objMasterTypeRequest = new MasterTypeRequest();
                objMasterTypeRequest.Property = "QRF Masters";
                objMasterTypeRequest.Name     = "Position Type";

                SalesProviders     objSalesProvider      = new SalesProviders(_configuration);
                MasterTypeResponse objMasterTypeResponse = objSalesProvider.GetGenericMasterForType(objMasterTypeRequest, token).Result;

                if (objMasterTypeResponse.Status == "Success" && objMasterTypeResponse.PropertyList.Count > 0)
                {
                    if (objMasterTypeResponse.PropertyList[0].Attribute[0].AttributeName == "Position Type")
                    {
                        objKeepAs = objMasterTypeResponse.PropertyList[0].Attribute[0].Values.ToList();
                    }
                }

                QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq()
                {
                    QRFID = QRFID, date = (DateTime?)null
                };
                QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result;
                QRFPaxSlabGetReq       objPaxSlabReq        = new QRFPaxSlabGetReq()
                {
                    QRFID = QRFID
                };
                QRFPaxGetResponse objPaxSlabRes = coProviders.GetPaxSlabDetailsForCostingByQRF_Id(objPaxSlabReq, token).Result;
                model.PaxSlabList = (objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs).Select(a => new AttributeValues {
                    AttributeValue_Id = a.PaxSlab_Id.ToString(), Value = a.From + "-" + a.To
                }).ToList();
                model.DepartureDatesList = (objDepartureDatesRes.DepartureDates).Select(a => new AttributeValues {
                    AttributeValue_Id = a.Departure_Id.ToString(), Value = Convert.ToDateTime(a.Date).ToString("dd MMM yy")
                }).ToList();

                #endregion

                #region Get Guesstimate by QRFId
                GuesstimateGetRes response = new GuesstimateGetRes();
                GuesstimateGetReq request  = new GuesstimateGetReq();
                request.QRFID        = QRFID;
                request.DepartureId  = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture;
                request.PaxSlabId    = filterByPaxSlab == 0 ? objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs[0].PaxSlab_Id : filterByPaxSlab;
                request.CalculateFor = CalculateFor;
                request.LoginUserId  = ckUserEmailId;
                response             = coProviders.GetGuesstimate(request, token).Result;
                GetDistinctRanges(response.Guesstimate, ref model);
                model.Guesstimate                    = response.Guesstimate;
                model.Guesstimate.VersionId          = model.Guesstimate.VersionId;
                ViewBag.VersionName                  = model.Guesstimate.VersionName;
                ViewBag.VersionDescription           = model.Guesstimate.VersionDescription;
                model.Guesstimate.VersionName        = "";
                model.Guesstimate.VersionDescription = "";
                model.NextVersionId                  = response.LastVersionId + 1;
                model.IsStandardPrice                = response.IsStandardPrice;
                #endregion

                #region Filter Logic

                model.DayList         = GetDays(model.Guesstimate.GuesstimatePosition);
                model.ServiceTypeList = GetProductTypes(model.Guesstimate.GuesstimatePosition);
                model.KeepAsList      = objKeepAs;

                if (filterByDay == "All")
                {
                    filterByDay = null;
                }

                if (filterByServiceType == "All")
                {
                    filterByServiceType = null;
                }

                if (filterByPackageType == "All")
                {
                    filterByPackageType = null;
                }

                if (!string.IsNullOrEmpty(filterByDay))
                {
                    model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.Day == filterByDay).ToList();
                }

                if (!string.IsNullOrEmpty(filterByServiceType))
                {
                    model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.ProductType == filterByServiceType).ToList();
                }

                if (!string.IsNullOrEmpty(filterByPackageType))
                {
                    model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.KeepAs == filterByPackageType).ToList();
                }

                //model.Guesstimate.GuesstimateDetails = model.Guesstimate.GuesstimateDetails.Where(x => model.SummaryDetails.Any(a => a.OriginalItineraryDetails.Any(b => b.PositionId == x.PositionId))).ToList();

                model.Day           = filterByDay;
                model.Service       = filterByServiceType;
                model.KeepAs        = filterByPackageType;
                model.DepartureDate = filterByDeparture.ToString();
                model.PaxSlab       = filterByPaxSlab.ToString();

                #endregion

                return(PartialView("_Guesstimate", model));
            }
            catch (Exception ex)
            {
                throw;
                return(View());
            }
        }