public async Task <CostingGetRes> GetCostingDetailsByQRFID([FromBody] CostingGetReq request) { var response = new CostingGetRes(); try { if (request != null && !string.IsNullOrEmpty(request.QRFID)) { response = await _costingRepository.GetCostingDetailsByQRFID(request); response.ResponseStatus.Status = "Success"; response.ResponseStatus.ErrorMessage = response.CostingGetProperties != null ? "" : "No Records Found."; } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "QRF ID 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 <CostingGetRes> GetCostingDetailsByQRFID(CostingGetReq request) { //var builder = Builders<mQRFPrice>.Filter; //var filter = builder.Where(q => q.QRFID == request.QRFID && q.IsCurrentVersion == true); //return await _MongoContext.mQRFPrice.Find(filter).Project(q => new CostingGetProperties //{ // QRFID = q.QRFID, // VersionId = q.VersionId, // VersionName = q.VersionName, // VersionDescription = q.VersionDescription, // IsCurrentVersion = q.IsCurrentVersion, // SalesOfficer = q.SalesOfficer, // CostingOfficer = q.CostingOfficer, // ProductAccountant = q.ProductAccountant, // AgentInfo = q.AgentInfo, // AgentProductInfo = q.AgentProductInfo, // AgentPassengerInfo = q.AgentPassengerInfo, // AgentRoom = q.QRFAgentRoom, // DepartureDates = q.Departures, //}).FirstOrDefaultAsync(); CostingGetRes response = new CostingGetRes(); var qrfprice = _MongoContext.mQRFPrice.AsQueryable().Where(x => x.QRFID == request.QRFID && x.IsCurrentVersion == true).OrderByDescending(y => y.VersionId).FirstOrDefault(); response.CostingGetProperties.QRFID = qrfprice.QRFID; response.CostingGetProperties.QRFPriceID = qrfprice.QRFPrice_Id; response.CostingGetProperties.VersionId = qrfprice.VersionId; response.CostingGetProperties.VersionName = qrfprice.VersionName; response.CostingGetProperties.VersionDescription = qrfprice.VersionDescription; response.CostingGetProperties.IsCurrentVersion = qrfprice.IsCurrentVersion; response.CostingGetProperties.SalesOfficer = qrfprice.SalesOfficer; response.CostingGetProperties.CostingOfficer = qrfprice.CostingOfficer; response.CostingGetProperties.ProductAccountant = qrfprice.ProductAccountant; response.CostingGetProperties.ValidForAcceptance = qrfprice.ValidForAcceptance; response.CostingGetProperties.ValidForTravel = qrfprice.ValidForTravel; response.CostingGetProperties.AgentInfo = qrfprice.AgentInfo; response.CostingGetProperties.AgentProductInfo = qrfprice.AgentProductInfo; response.CostingGetProperties.AgentPassengerInfo = qrfprice.AgentPassengerInfo; response.CostingGetProperties.AgentRoom = qrfprice.QRFAgentRoom; response.CostingGetProperties.DepartureDates = qrfprice.Departures; response.CostingGetProperties.FollowUpCostingOfficer = qrfprice.FollowUpCostingOfficer; response.CostingGetProperties.FollowUpWithClient = qrfprice.FollowUpWithClient; ContactDetailsResponse objContactDetailsRes = _userRepository.GetContactsByEmailId(new ContactDetailsRequest { Email = qrfprice.SalesOfficer }); if (objContactDetailsRes != null && objContactDetailsRes.Contacts != null) { response.CostingGetProperties.SalesOfficerMobile = !string.IsNullOrEmpty(objContactDetailsRes.Contacts.MOBILE) ? objContactDetailsRes.Contacts.MOBILE : objContactDetailsRes.Contacts.TEL; } response.EnquiryPipeline = _MongoContext.mQuote.AsQueryable().Where(x => x.QRFID == request.QRFID).Select(y => y.CurrentPipeline).FirstOrDefault(); bool IsLinkedQRFsExist = _quoteRepository.ChcekLinkedQRFsExist(request.QRFID).Result; response.IsLinkedQRFsExist = IsLinkedQRFsExist; return(response); }
public async Task <CostingGetRes> GetCostingDetailsByQRFID(CostingGetReq objCostingRequest, string ticket) { CostingGetRes objCostingResponse = new CostingGetRes(); objCostingResponse = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCommon:GetCostingDetailsByQRFID"), objCostingRequest, typeof(CostingGetRes), ticket); return(objCostingResponse); }
public COHeaderViewModel GetCOTourInfoHeader(ref NewQuoteViewModel model, string token) { CostingGetReq objCostingRequest = new CostingGetReq() { QRFID = model.QRFID }; CostingGetRes objCostingResponse = coProviders.GetCostingDetailsByQRFID(objCostingRequest, token).Result; CostingGetProperties objResult = objCostingResponse.CostingGetProperties; if (objResult != null) { model.COHeaderViewModel.QRFID = objResult.QRFID; model.COHeaderViewModel.AgentID = objResult.AgentInfo.AgentID; model.COHeaderViewModel.AgentName = objResult.AgentInfo.AgentName; model.COHeaderViewModel.TourCode = objResult.AgentProductInfo.TourCode; model.COHeaderViewModel.TourName = objResult.AgentProductInfo.TourName; model.COHeaderViewModel.NoOfNights = Convert.ToInt32(objResult.AgentProductInfo.Duration); model.COHeaderViewModel.NoOfDays = Convert.ToInt32(objResult.AgentProductInfo.Duration) + 1; model.COHeaderViewModel.SalesPerson = objResult.SalesOfficer; model.COHeaderViewModel.ContactPersonID = objResult.AgentInfo.ContactPersonID; model.COHeaderViewModel.ContactPerson = objResult.AgentInfo.ContactPerson; model.COHeaderViewModel.EmailAddress = objResult.AgentInfo.EmailAddress; model.COHeaderViewModel.MobileNo = objResult.AgentInfo.MobileNo; model.COHeaderViewModel.Destination = objResult.AgentProductInfo.Destination; model.COHeaderViewModel.TravelDate = objResult.DepartureDates.Count > 0 ? objResult.DepartureDates[0].Date : null; model.COHeaderViewModel.Version = objResult.VersionId; model.COHeaderViewModel.Pax = objResult.AgentPassengerInfo.Where(a => a.Type == "ADULT").Select(b => b.count).FirstOrDefault(); model.COHeaderViewModel.CostingOfficer = objResult.CostingOfficer; model.COHeaderViewModel.ProductAccountant = objResult.ProductAccountant; model.COHeaderViewModel.ValidForTravel = objResult.ValidForTravel; model.COHeaderViewModel.ValidForAcceptance = objResult.ValidForAcceptance; model.mdlMenuViewModel.EnquiryPipeline = objCostingResponse.EnquiryPipeline; model.COHeaderViewModel.IsLinkedQRFsExist = objCostingResponse.IsLinkedQRFsExist; model.COHeaderViewModel.QRFPriceID = objResult.QRFPriceID; model.COHeaderViewModel.FollowUpCostingOfficer = objResult.FollowUpCostingOfficer != null ? (Convert.ToDateTime(objResult.FollowUpCostingOfficer)).ToString("dd/MMM/yyyy").Replace('-', '/') : ""; model.COHeaderViewModel.WithClient = objResult.FollowUpWithClient != null ? (Convert.ToDateTime(objResult.FollowUpWithClient)).ToString("dd/MMM/yyyy").Replace('-', '/') : ""; model.COHeaderViewModel.SalesPersonMobile = objResult.SalesOfficerMobile; } else { model.COHeaderViewModel.QRFID = ""; model.COHeaderViewModel.AgentName = ""; model.COHeaderViewModel.TourCode = ""; model.COHeaderViewModel.TourName = ""; model.COHeaderViewModel.NoOfNights = 0; model.COHeaderViewModel.NoOfDays = 0; model.COHeaderViewModel.SalesPerson = ""; model.COHeaderViewModel.ContactPerson = ""; model.COHeaderViewModel.Destination = ""; model.COHeaderViewModel.TravelDate = DateTime.MinValue; model.COHeaderViewModel.Version = 0; model.COHeaderViewModel.Pax = 0; model.COHeaderViewModel.CostingOfficer = ""; model.COHeaderViewModel.ValidForTravel = ""; model.COHeaderViewModel.ValidForAcceptance = ""; model.COHeaderViewModel.IsLinkedQRFsExist = false; model.COHeaderViewModel.QRFPriceID = ""; } return(model.COHeaderViewModel); }