public async Task <PositionPriceGetRes> GetPositionPrice([FromBody] PositionPriceGetReq request) { var response = new PositionPriceGetRes(); try { if (!string.IsNullOrEmpty(request.QRFID)) { PositionPriceGetRes result = await _positionRepository.GetPositionPrice(request); response.ResponseStatus.Status = "Success"; response.ResponseStatus.ErrorMessage = (result != null && result.PositionPrice != null) ? "" : "No Records Found."; response.StandardPrice = result.StandardPrice; response.PositionPrice = result.PositionPrice; response.IsSalesOfficeUser = result.IsSalesOfficeUser; } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "QRFId can not be Null/Zero."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message; } return(response); }
public async Task <PositionPriceGetRes> GetPostionPrices(PositionPriceGetReq positionPricesGetReq, string ticket) { PositionPriceGetRes positionPricesGetRes = new PositionPriceGetRes(); positionPricesGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServicePosition:GetPositionPrice"), positionPricesGetReq, typeof(PositionPriceGetRes), ticket); return(positionPricesGetRes); }
public ActionResult GetPositionPricesPartView(PositionPriceGetReq request) { PositionPriceGetRes response = new PositionPriceGetRes(); request.LoginUser = ckUserEmailId; response = positionProviders.GetPostionPrices(request, token).Result; var contractId = response.PositionPrice.Where(a => !string.IsNullOrEmpty(a.ContractId)).Select(b => b.ContractId).FirstOrDefault(); if (!string.IsNullOrEmpty(contractId)) { ViewBag.IsContractExist = true; } var dateRangeCount = response.PositionPrice.Select(b => b.DepartureId).Distinct().ToList().Count(); if (dateRangeCount > 1) { ViewBag.IsMultipleDateExist = dateRangeCount; } #region commented //foreach (var ProdRange in ProdRangeList) //{ // model.PositionPricesData.Add(new PositionPricesData // { // QRFID = request.QRFID, // PositionId = request.PositionId, // DepartureId = request.DepartureId, // Period = "ALL", // PaxSlab = "ALL", // Type = "ALL", // ProductCategory = "ALL", // BudgetPrice = ProdRange.BudgetPrice, // ContractPrice = ProdRange.ContractPrice, // BuyCurrency = ProdRange.BuyCurrency, // ProductRange = ProdRange.ProductRange, // ProductRangeId = ProdRange.ProductRangeId, // ProductRangeCode = ProdRange.ProductRangeCode // }); //} //foreach (var objModel in response.PositionPrice) //{ // //if (model.StandardPrice && model.PositionPricesData.Count > 0 && model.PositionPricesData[0].BudgetPrice == 0.00) // // model.PositionPricesData[0].BudgetPrice = objModel.BudgetPrice; // var obj = new PositionPricesData // { // PositionPriceId = objModel.PositionPriceId, // QRFID = objModel.QRFID, // PositionId = objModel.PositionId, // DepartureId = objModel.DepartureId, // Period = objModel.Period.ToString(), // PaxSlabId = objModel.PaxSlabId, // PaxSlab = objModel.PaxSlab, // Type = objModel.Type, // RoomId = objModel.RoomId, // IsSupplement = objModel.IsSupplement, // SupplierId = objModel.SupplierId, // Supplier = objModel.Supplier, // ProductCategoryId = objModel.ProductCategoryId, // ProductCategory = objModel.ProductCategory, // ProductRangeId = objModel.ProductRangeId, // ProductRange = objModel.ProductRange, // ProductRangeCode = objModel.ProductRangeCode, // ContractPrice = objModel.ContractPrice, // ContractId = objModel.ContractId, // BuyCurrencyId = objModel.BuyCurrencyId, // BuyCurrency = objModel.BuyCurrency, // BudgetPrice = objModel.BudgetPrice, // BuyPrice = objModel.BuyPrice, // MarkupAmount = objModel.MarkupAmount, // SellCurrencyId = objModel.SellCurrencyId, // SellCurrency = objModel.SellCurrency, // SellNetPrice = objModel.SellNetPrice, // TaxAmount = objModel.TaxAmount, // SellPrice = objModel.SellPrice, // ExchangeRateId = objModel.ExchangeRateId, // ExchangeRatio = objModel.ExchangeRatio // }; // model.PositionPricesData.Add(obj); //} #endregion PositionPricesViewModel model = new PositionPricesViewModel { StandardPrice = (response.StandardPrice == null || response.StandardPrice == true) ? true : false }; var ProdRangeList = response.PositionPrice.Select(a => new { a.ProductRange, a.ProductRangeId }).Distinct().ToList(); foreach (var ProdRange in ProdRangeList) { var IsExist = model.PositionPricesData.Where(a => a.ProductRangeId == ProdRange.ProductRangeId).FirstOrDefault(); if (IsExist == null) { var PriceList = response.PositionPrice.Where(a => a.ProductRangeId == ProdRange.ProductRangeId).Select(a => new { a.ProductRange, a.ProductRangeId, a.BudgetPrice, a.ContractPrice, a.ContractId, a.BuyCurrency, a.ProductRangeCode }).Distinct().ToList(); if (PriceList?.Count == 1) { model.PositionPricesData.AddRange(PriceList.Select(a => new PositionPricesData { QRFID = request.QRFID, PositionId = request.PositionId, DepartureId = request.DepartureId, Period = "ALL", PaxSlab = "ALL", Type = "ALL", ProductCategory = "ALL", BudgetPrice = a.BudgetPrice, ContractPrice = a.ContractPrice, IsContractExist = string.IsNullOrEmpty(a.ContractId) ? false : true, BuyCurrency = a.BuyCurrency, ProductRange = a.ProductRange, ProductRangeId = a.ProductRangeId, ProductRangeCode = a.ProductRangeCode })); } else { model.PositionPricesData.Add(new PositionPricesData { QRFID = request.QRFID, PositionId = request.PositionId, DepartureId = request.DepartureId, Period = "ALL", PaxSlab = "ALL", Type = "ALL", ProductCategory = "ALL", BudgetPrice = 0, ContractPrice = 0, IsContractExist = string.IsNullOrEmpty(PriceList[0].ContractId) ? false : true, BuyCurrency = PriceList[0].BuyCurrency, ProductRange = PriceList[0].ProductRange, ProductRangeId = PriceList[0].ProductRangeId, ProductRangeCode = PriceList[0].ProductRangeCode }); } } } model.PositionPricesData.AddRange(response.PositionPrice.Select(a => new PositionPricesData { PositionPriceId = a.PositionPriceId, QRFID = a.QRFID, PositionId = a.PositionId, DepartureId = a.DepartureId, Period = a.Period.ToString(), PaxSlabId = a.PaxSlabId, PaxSlab = a.PaxSlab, Type = a.Type, RoomId = a.RoomId, IsSupplement = a.IsSupplement, SupplierId = a.SupplierId, Supplier = a.Supplier, ProductCategoryId = a.ProductCategoryId, ProductCategory = a.ProductCategory, ProductRangeId = a.ProductRangeId, ProductRange = a.ProductRange, ProductRangeCode = a.ProductRangeCode, ContractPrice = a.ContractPrice, IsContractExist = string.IsNullOrEmpty(a.ContractId) ? false : true, ContractId = a.ContractId, BuyCurrencyId = a.BuyCurrencyId, BuyCurrency = a.BuyCurrency, BudgetPrice = a.BudgetPrice, BuyPrice = a.BuyPrice, MarkupAmount = a.MarkupAmount, SellCurrencyId = a.SellCurrencyId, SellCurrency = a.SellCurrency, SellNetPrice = a.SellNetPrice, TaxAmount = a.TaxAmount, SellPrice = a.SellPrice, ExchangeRateId = a.ExchangeRateId, ExchangeRatio = a.ExchangeRatio })); model.IsSalesOfficeUser = response.IsSalesOfficeUser; return(PartialView("_PositionPrices", model)); }