protected void gvProductList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Enabled") { var id = (SpecialProductType)Convert.ToInt32(e.CommandArgument); var air = SpecialProductService.Query(id); if (air != null) { var view = new SpecialProductView(id) { Description = air.Description, Enabled = !air.Enabled, Explain = air.Explain, Name = air.Name }; try { SpecialProductService.Update(view, CurrentUser.UserName); RegisterScript("alert('" + (air.Enabled ? "禁用成功!" : "启用成功!") + "')"); } catch (Exception ex) { ShowExceptionMessage(ex, air.Enabled ? "禁用" : "启用"); return; } Datainit(); } } }
private void BindSpecialProduct(CompanyParameter paramter) { chkSingleness.Checked = paramter.Singleness && SpecialProductService.Query(SpecialProductType.Singleness).Enabled; txtSingleness.Text = (paramter.SinglenessRate * 1000M).TrimInvaidZero(); chkDisperse.Checked = paramter.Disperse && SpecialProductService.Query(SpecialProductType.Disperse).Enabled; txtDisperse.Text = (paramter.DisperseRate * 1000M).TrimInvaidZero(); //chkCostFree.Checked = paramter.CostFree && SpecialProductService.Query(SpecialProductType.CostFree).Enabled; //txtCostFree.Text = (paramter.CostFreeRate * 1000M).TrimInvaidZero(); chkBloc.Checked = paramter.Bloc && SpecialProductService.Query(SpecialProductType.Bloc).Enabled; txtBloc.Text = (paramter.BlocRate * 1000M).TrimInvaidZero(); chkBusiness.Checked = paramter.Business && SpecialProductService.Query(SpecialProductType.Business).Enabled; txtBusiness.Text = (paramter.BusinessRate * 1000M).TrimInvaidZero(); if (!SpecialProductService.Query(SpecialProductType.Singleness).Enabled) { chkSingleness.Enabled = false; } if (!SpecialProductService.Query(SpecialProductType.Disperse).Enabled) { chkDisperse.Enabled = false; } //if (!SpecialProductService.Query(SpecialProductType.CostFree).Enabled) { chkCostFree.Enabled = false; } if (!SpecialProductService.Query(SpecialProductType.Bloc).Enabled) { chkBloc.Enabled = false; } if (!SpecialProductService.Query(SpecialProductType.Business).Enabled) { chkBusiness.Enabled = false; } }
private void BindSpecialPolicyHelpInfos() { var source = SpecialProductService.Query(); SpecialPolicyInfos.DataSource = source; SpecialPolicTitleList.DataSource = source; SpecialPolicyInfos.DataBind(); SpecialPolicTitleList.DataBind(); }
private void Datainit() { gvProductList.DataSource = SpecialProductService.Query().Select( o => new { Id = o.SpecialProductType.GetHashCode(), o.Name, o.Explain, Describe = o.Description, o.Enabled, Remark = o.SpecialProductType.GetDescription() } ); gvProductList.DataBind(); }
private object RecommandSelector(InstructionalFlight flight) { Flight f = flight.OriginalFlight; SpecialProductView specialPolicyInfo = SpecialProductService.Query(flight.OriginalPolicy.Type); return(new { AirlineCode = f.Airline, f.AirlineName, f.FlightNo, Aircraft = f.AirCraft, f.Departure, f.Arrival, YBPrice = f.StandardPrice, f.AirportFee, BAF = f.BAF.Adult, AdultBAF = f.BAF.Adult, ChildBAF = f.BAF.Child, f.IsStop, LowerPrice = flight.SettleAmount, f.DaysInterval, TakeoffTime = String.Format("{0:00}:{1:00}", f.TakeoffTime.Hour, f.TakeoffTime.Minute), f.FlightDate, LandingTime = String.Format("{0:00}:{1:00}", f.LandingTime.Hour, f.LandingTime.Minute), SeatCount = flight.ResourceAmount, SuccessOrderCount = flight.Statistic.Total.SuccessTicketCount, OrderSuccessRate = (flight.Statistic.Total.OrderSuccessRate * 100).TrimInvaidZero() + "%", gradeFirst = Math.Floor(flight.CompannyGrade), gradeSecond = flight.CompannyGrade / 0.1m % 10, flight.IsRepeated, policyId = flight.OriginalPolicy.Id, policyType = (int)flight.OriginalPolicy.PolicyType, publisher = flight.OriginalPolicy.Owner, officeNo = flight.OriginalPolicy.OfficeCode, needAUTH = flight.OriginalPolicy.NeedAUTH, EIList = getProvisionList(flight.OriginalPolicy), Condition = ReplaceEnter(flight.OriginalPolicy.Condition), PolicyDesc = ReplaceEnter(specialPolicyInfo.Description), spType = ReplaceEnter(specialPolicyInfo.Name), specialPolicy = ReplaceEnter(flight.OriginalPolicy.Type.ToString()), needApplication = flight.OriginalPolicy.ConfirmResource, WarnInfo = (flight.OriginalPolicy.Type == SpecialProductType.CostFree && !flight.OriginalPolicy.IsSeat) ? "这是候补票<a class='tips_btn standby_ticket'>什么是候补票?</a>" : flight.OriginalPolicy.ConfirmResource ? "<a class='tips_btn'>什么是申请?</a>" : String.Empty, }); }
private void BindSpecialProduct(CompanyParameter paramter) { chkSingleness1.Checked = chkSingleness.Checked = paramter.Singleness && SpecialProductService.Query(SpecialProductType.Singleness).Enabled; lblSingleness1.Text = lblSingleness.Text = (paramter.SinglenessRate * 1000M).TrimInvaidZero(); chkDisperse1.Checked = chkDisperse.Checked = paramter.Disperse && SpecialProductService.Query(SpecialProductType.Disperse).Enabled; lblDisperse1.Text = lblDisperse.Text = (paramter.DisperseRate * 1000M).TrimInvaidZero(); chkCostFree.Checked = paramter.CostFree && SpecialProductService.Query(SpecialProductType.CostFree).Enabled; lblCostFree.Text = (paramter.CostFreeRate * 1000M).TrimInvaidZero(); chkBloc1.Checked = chkBloc.Checked = paramter.Bloc && SpecialProductService.Query(SpecialProductType.Bloc).Enabled; lblBloc1.Text = lblBloc.Text = (paramter.BlocRate * 1000M).TrimInvaidZero(); chkBusiness1.Checked = chkBusiness.Checked = paramter.Business && SpecialProductService.Query(SpecialProductType.Business).Enabled; lblBusiness1.Text = lblBusiness.Text = (paramter.BusinessRate * 1000M).TrimInvaidZero(); chkOtherSpecial.Checked = paramter.OtherSpecial && SpecialProductService.Query(SpecialProductType.OtherSpecial).Enabled; lblOtherSpecialRate.Text = (paramter.OtherSpecialRate * 1000M).TrimInvaidZero(); chkLowToHighSpecial.Checked = paramter.LowToHigh && SpecialProductService.Query(SpecialProductType.LowToHigh).Enabled; lblLowToHighSpecialRate.Text = (paramter.LowToHighRate * 1000M).TrimInvaidZero(); }
/// <summary> /// 查询特殊政策类型 /// </summary> /// <returns></returns> public object QuerySpecialProductTypeList() { var companyParamer = CompanyService.GetCompanyParameter(CurrentCompany.CompanyId) ?? new CompanyParameter { CostFree = false, Bloc = false, Business = false, Disperse = false, Singleness = false, LowToHigh = false }; return(from item in SpecialProductService.Query() where item.Enabled && ((companyParamer.Singleness && item.SpecialProductType == SpecialProductType.Singleness) || (companyParamer.CostFree && item.SpecialProductType == SpecialProductType.CostFree) || (companyParamer.Bloc && item.SpecialProductType == SpecialProductType.Bloc) || (companyParamer.Business && item.SpecialProductType == SpecialProductType.Business) || (companyParamer.Disperse && item.SpecialProductType == SpecialProductType.Disperse) || (companyParamer.OtherSpecial && item.SpecialProductType == SpecialProductType.OtherSpecial) || (companyParamer.LowToHigh && item.SpecialProductType == SpecialProductType.LowToHigh)) select new { item.Name, Value = item.SpecialProductType, item.Description }); }
private void Datainit() { string id = Request.QueryString["Id"]; if (!string.IsNullOrEmpty(id)) { var view = SpecialProductService.Query((SpecialProductType)Convert.ToByte(id)); if (view != null) { lblProductId.Text = view.SpecialProductType.GetHashCode().ToString(); txtProductName.Text = view.Name; txtProductExplain.Text = view.Explain; txtProductDescribe.Text = view.Description; if (view.Enabled) { rdoEnabled.Checked = true; } else { rdoDisabled.Checked = true; } } } }
protected override string ExecuteCore() { var flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Segments, _pnr.ItineraryType, _pnr.Passenges.First().Value.Type, _pnr.IsTeam); var policyFilterCondition = GetPolicyFilter(flights); PolicyType policyType = queryPolicyType(flights); //匹配政策 List <MatchedPolicy> matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, _pnr.Passenges.First().Value.Type, 10).ToList(); List <MatchedPolicy> matchedSpeciafPolicies = null; if (policyType != PolicyType.Special) { policyFilterCondition = GetPolicyFilter(flights, PolicyType.Special); matchedSpeciafPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, _pnr.Passenges.First().Value.Type, 10).ToList(); } StringBuilder str = new StringBuilder(); if (matchedPolicies == null) { throw new InterfaceInvokeException("9", "没有找到相关政策"); } if (policyType != PolicyType.Special) { var list = from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = (item.ParValue - item.SettleAmount).TrimInvaidZero(), Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter((regulation == null ? getEI(flights) : getProvision(regulation))), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, generalPolicy.ChangePNR, EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed.ETDZ / 60, RefundSpeed = item.Speed.Refund / 60 }; str.Append("<policies>"); foreach (var item in list) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } var queryList = from item in matchedSpeciafPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = (item.ParValue - item.SettleAmount).TrimInvaidZero(), Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, ChangePNR = "", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in queryList) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } foreach (var item in matchedSpeciafPolicies) { if (!matchedPolicies.Contains(item)) { matchedPolicies.Add(item); } } } else { var queryList = from item in matchedPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = 0, Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, ChangePNR = "", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed.ETDZ / 60, RefundSpeed = item.Speed.Refund / 60 }; foreach (var item in queryList) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } str.Append("</policies>"); //将匹配出来的政策存入缓存中 CustomContext context = CustomContext.NewContext(); context[_pnr.Code.BPNR + _pnr.Code.PNR] = matchedPolicies; ContextCenter.Instance.Save(context); str.AppendFormat("<key>{0}</key>", context.Id.ToString()); return(str.ToString()); }
private object QueryAllPolicies(PolicyType policyType, int policyCount, string source, string policyOwner, bool needSubsidize, bool IsUsePatPrice, bool isExternalPolicy, decimal maxdRebate = 0) { PassengerType passengerType = getPassengerType(source); var policyFilterCondition = new PolicyFilterConditions { PolicyType = policyType, Purchaser = CurrentCompany.CompanyId }; var orderView = Session["OrderView"] as OrderView; // 升舱时,指向原订单出票方 if (FlightReserveModule.ChoosePolicy.UpgradeByPNRCodeSource == source || FlightReserveModule.ChoosePolicy.UpgradeByQueryFlightSource == source) { policyFilterCondition.Provider = Guid.Parse(policyOwner); } else if (FlightReserveModule.ChoosePolicy.ChangeProviderSource == source) { // 换出票方时,排除原订单出票方、产品方 和 采购方 Order order = FlightReserveModule.ChoosePolicy.GetOriginalOrder(source); policyFilterCondition.ExcludeProviders.Add(order.Purchaser.CompanyId); if (order.Supplier != null) { policyFilterCondition.ExcludeProviders.Add(order.Supplier.CompanyId); } if (order.Provider != null) { policyFilterCondition.ExcludeProviders.Add(order.Provider.CompanyId); } } if (FlightReserveModule.ChoosePolicy.ImportSource == source) { policyFilterCondition.PatContent = orderView.PatContent; policyFilterCondition.PnrContent = orderView.PnrContent; policyFilterCondition.PnrPair = orderView.PNR; } IEnumerable <VoyageFilterInfo> voyages = getVoyageFilterInfos(source); // 特殊票时,只取航班查询处选择的价格 if (policyType == PolicyType.Special) { PolicyView policyView = FlightReserveModule.ChoosePolicy.GetPolicyView(source); var firstFlight = voyages.FirstOrDefault(); if (firstFlight != null && firstFlight.Bunk == null) { policyFilterCondition.PatPrice = getPatPrice(source); } else if (policyView != null && firstFlight != null && firstFlight.Bunk == null) { policyFilterCondition.PublishFare = policyView.PublishFare; } } else { policyFilterCondition.PatPrice = getPatPrice(source); } policyFilterCondition.Voyages.AddRange(voyages); policyFilterCondition.VoyageType = FlightReserveModule.ChoosePolicy.GetVoyageType(source); policyFilterCondition.SuitReduce = hasReduce(source); policyFilterCondition.NeedSubsidize = needSubsidize; policyFilterCondition.IsUsePatPrice = IsUsePatPrice || orderView.FdSuccess; policyFilterCondition.AllowTicketType = FilterByTime(voyages.Min(f => f.Flight.TakeOffTime)); policyFilterCondition.MaxdRebate = maxdRebate; IEnumerable <MatchedPolicy> matchedPolicies = null; if (FlightReserveModule.ChoosePolicy.ChangeProviderSource == source && FlightReserveModule.ChoosePolicy.GetOriginalOrder(source).IsSpecial) { matchedPolicies = PolicyMatchServcie.MatchBunkForSpecial(policyFilterCondition, isExternalPolicy, policyCount).ToList(); } else { matchedPolicies = PolicyMatchServcie.MatchBunk(policyFilterCondition, isExternalPolicy, passengerType, policyCount).ToList(); } MatchedPolicyCache = matchedPolicies.ToList(); if (policyType == PolicyType.Special) { return(from item in matchedPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { PolicyId = item.Id, PolicyDesc = ReplaceEnter(specialPolicyInfo.Description), spType = ReplaceEnter(specialPolicyInfo.Name), specialPolicy = ReplaceEnter(specialPolicy.Type.ToString()), PolicyOwner = item.Provider, PolicyType = (int)PolicyType.Special, Fare = item.ParValue.TrimInvaidZero(), item.SettleAmount, EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), EIList = getProvisionList(item.OriginalPolicy as IHasRegulation), Condition = ReplaceEnter(item.OriginalPolicy.Condition ?? "无"), SuccessOrderCount = item.Statistics.Total.SuccessTicketCount, WorkingTime = getTimeRange(item.WorkStart, item.WorkEnd), VoyageSuccessOrderCount = item.Statistics.Voyage.SuccessTicketCount, OrderSuccessRate = (item.Statistics.Total.OrderSuccessRate * 100).TrimInvaidZero() + "%", item.NeedAUTH, gradeFirst = Math.Floor(item.CompannyGrade), gradeSecond = item.CompannyGrade / 0.1m % 10, needApplication = specialPolicy.ConfirmResource, WarnInfo = (specialPolicy.Type == SpecialProductType.CostFree && !specialPolicy.IsSeat) ? "需要候补<br /><a class='tips_btn standby_ticket'>什么是候补票?</a>" : specialPolicy.ConfirmResource ? "需要申请<br /><a class='tips_btn'>什么是申请?</a>" : String.Empty, RenderTicketPrice = specialPolicy.Type == SpecialProductType.CostFree || item.ParValue != 0, PolicyTypes = item.PolicyType.GetDescription(), IsFreeTicket = specialPolicy.Type == SpecialProductType.CostFree, IsNOSeat = specialPolicy.Type == SpecialProductType.CostFree && !specialPolicy.IsSeat, RelationType = (int)item.RelationType }); } return(from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation select new { Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero() + "%", dRebate = item.Commission, Commission = (item.ParValue - item.SettleAmount).TrimInvaidZero(), SettleAmount = item.SettleAmount.TrimInvaidZero(), WorkingTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), ETDZEfficiency = (item.Speed.ETDZ / 60) + "分钟", RefundEfficiency = (item.Speed.Refund / 60) + "分钟", TicketType = (item.OriginalPolicy == null ? (item.OriginalExternalPolicy == null ? TicketType.BSP : item.OriginalExternalPolicy.TicketType) : item.OriginalPolicy.TicketType).ToString(), PolicyId = item.Id, PolicyOwner = item.Provider, PolicyType = (int)item.PolicyType, OfficeNo = item.OriginalPolicy == null ? item.OfficeNumber : item.OriginalPolicy.OfficeCode, EI = ReplaceEnter((regulation == null ? getEI(source) : getProvision(regulation))), EIList = getProvisionList(item.OriginalPolicy as IHasRegulation), Condition = (item.OriginalPolicy == null && item.OriginalExternalPolicy == null ? "无" : ReplaceEnter(item.OriginalPolicy != null ? item.OriginalPolicy.Condition : item.OriginalExternalPolicy.Condition) ?? "无") + ((generalPolicy != null && generalPolicy.ChangePNR) || (item.IsExternal && item.OriginalExternalPolicy.RequireChangePNR) ? "。需要换编码出票" : String.Empty), NeedAUTH = item.OriginalPolicy == null ? item.NeedAUTH : item.OriginalPolicy.NeedAUTH, PolicyTypes = item.PolicyType.GetDescription(), IsBusy = OrderRemindService.QueryProviderRemindInfo(item.Provider).ETDZ > 5, item.HasSubsidized, RelationType = (int)item.RelationType, setChangePNREnable = !item.IsExternal && (generalPolicy == null || !generalPolicy.ChangePNR) //采购是否能设置是否允许换编码 }); }
public object QueryPolicies(PolicyType policyType, int policyCount, string policyOwner, float rate, bool showTip) { var source = "5"; var passengerType = getPassengerType(); var policyFilterCondition = new Service.PolicyMatch.Domain.PolicyFilterConditions { PolicyType = policyType, Purchaser = CurrentCompany.CompanyId }; // 换出票方时,排除原订单出票方、产品方 和 采购方 var order = FlightReserveModule.ChoosePolicy.GetOriginalOrder(source); policyFilterCondition.ExcludeProviders.Add(order.Purchaser.CompanyId); if (order.Supplier != null) { policyFilterCondition.ExcludeProviders.Add(order.Supplier.CompanyId); } if (order.Provider != null) { policyFilterCondition.ExcludeProviders.Add(order.Provider.CompanyId); } // 特殊票时,只取航班查询处选择的价格 if (policyType == PolicyType.Special) { var policyView = FlightReserveModule.ChoosePolicy.GetPolicyView(source); if (policyView != null) { policyFilterCondition.PublishFare = policyView.PublishFare; } } var voyages = getVoyageFilterInfos(source); policyFilterCondition.Voyages.AddRange(voyages); policyFilterCondition.VoyageType = FlightReserveModule.ChoosePolicy.GetVoyageType(source); policyFilterCondition.SuitReduce = hasReduce(source); policyFilterCondition.PatPrice = getPatPrice(source); policyFilterCondition.Purchaser = order.Purchaser.CompanyId; policyFilterCondition.AllowTicketType = ChoosePolicy.FilterByTime(voyages.Min(f => f.Flight.TakeOffTime)); IEnumerable <Service.PolicyMatch.MatchedPolicy> matchedPolicies = null; if (FlightReserveModule.ChoosePolicy.ChangeProviderSource == source && FlightReserveModule.ChoosePolicy.GetOriginalOrder(source).IsSpecial) { matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunkForSpecial(policyFilterCondition, false, policyCount).ToList(); } else { matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, false, passengerType, policyCount).ToList(); } MatchedPolicyCache = matchedPolicies.ToList(); var YBPrice = order.PNRInfos.First().Passengers.First().Tickets.Sum(p => p.Price.Fare); if (policyType == PolicyType.Special) { return(from item in matchedPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) let Provider = GetCompanyInfo(item.Provider) select new { PolicyId = item.Id, PolicyDesc = ChoosePolicy.ReplaceEnter(specialPolicyInfo.Description), spType = ChoosePolicy.ReplaceEnter(specialPolicyInfo.Name), specialPolicy = ChoosePolicy.ReplaceEnter(specialPolicy.Type.ToString()), PolicyOwner = item.Provider, PolicyType = (int)PolicyType.Special, Fare = YBPrice.TrimInvaidZero(), SettleAmount = (YBPrice * (1 - item.Commission)).TrimInvaidZero(), EI = ChoosePolicy.ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), EIList = getProvisionList(item.OriginalPolicy as IHasRegulation), Condition = ChoosePolicy.ReplaceEnter(item.OriginalPolicy.Condition ?? "无"), SuccessOrderCount = item.Statistics.Total.SuccessTicketCount, WorkingTime = getTimeRange(item.WorkStart, item.WorkEnd), VoyageSuccessOrderCount = item.Statistics.Voyage.SuccessTicketCount, OrderSuccessRate = (item.Statistics.Total.OrderSuccessRate * 100).TrimInvaidZero() + "%", item.NeedAUTH, gradeFirst = Math.Floor(item.CompannyGrade), gradeSecond = item.CompannyGrade / 0.1m % 10, needApplication = specialPolicy.ConfirmResource, RenderTicketPrice = specialPolicy.Type == SpecialProductType.CostFree || item.ParValue != 0, PolicyTypes = item.PolicyType.GetDescription(), ProviderName = Provider.AbbreviateName, ProviderAccount = Provider.UserName, IsBusy = Service.Remind.OrderRemindService.QueryProviderRemindInfo(item.Provider).ETDZ > 5, IsHigher = item.Rebate * 100 > (decimal)rate, TipInfo = string.Empty, RelationType = (int)item.RelationType }); } return(from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation let Provider = GetCompanyInfo(item.Provider) select new { Fare = YBPrice.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero() + "%", Commission = (YBPrice - item.SettleAmount).TrimInvaidZero(), SettleAmount = item.SettleAmount.TrimInvaidZero(), WorkingTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), ETDZEfficiency = (item.Speed.ETDZ / 60) + "分 ", RefundEfficiency = (item.Speed.Refund / 60) + "分钟", TicketType = (item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType).ToString(), PolicyId = item.Id, PolicyOwner = item.Provider, PolicyType = (int)item.PolicyType, OfficeNo = item.OriginalPolicy == null ? item.OfficeNumber : item.OriginalPolicy.OfficeCode, EI = ChoosePolicy.ReplaceEnter((regulation == null ? getEI(source) : getProvision(regulation))), EIList = getProvisionList(item.OriginalPolicy as IHasRegulation), Condition = (item.OriginalPolicy == null ? "无" : ChoosePolicy.ReplaceEnter(item.OriginalPolicy.Condition) ?? "无") + (generalPolicy != null && generalPolicy.ChangePNR ? "。需要换编码出票" : string.Empty), NeedAUTH = item.OriginalPolicy == null ? item.NeedAUTH : item.OriginalPolicy.NeedAUTH, PolicyTypes = item.PolicyType.GetDescription(), ProviderName = Provider.AbbreviateName, ProviderAccount = Provider.UserName, IsHigher = item.Commission * 100 > (decimal)rate, TipInfo = !showTip ? string.Empty : item.Commission * 100 > (decimal)rate ? "<span class=\"obvious-b\">提示:该供应商返点高于原供应商,选择此供应商出票后平台将能够得到" + Math.Round(item.Commission * 100 - (decimal)rate, 2).ToString() + "%(" + ((item.Commission - (decimal)rate / 100) * item.ParValue).TrimInvaidZero() + "元)</span>" : item.Commission * 100 < (decimal)rate ? "<span class=\"obvious\">请注意:该供应商的返点低于原供应商的返点,选择此政策后平台需要补差额" + Math.Round((decimal)rate - item.Commission * 100, 2).ToString() + "%(" + (((decimal)rate / 100 - item.Commission) * item.ParValue).TrimInvaidZero() + "元)</span>" : string.Empty, RelationType = (int)item.RelationType, setChangePNREnable = !item.IsExternal && (generalPolicy == null || !generalPolicy.ChangePNR) //采购是否能设置是否允许换编码 }); }
public static void GetPolicy(List <MatchedPolicy> matchedPolicies, List <MatchedPolicy> matchedSpeciafPolicies, StringBuilder str, PolicyType policyType, List <DataTransferObject.FlightQuery.FlightView> flights, Service.Organization.Domain.ExternalInterfaceSetting interfaceSetting) { if ((policyType & PolicyType.Special) != PolicyType.Special) { var list = from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation select new { Id = item.Id, Type = item.PolicyType == PolicyType.BargainDefault ? (int)PolicyType.Bargain : item.PolicyType == PolicyType.NormalDefault ? (int)PolicyType.Normal : (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue - item.SettleAmount), Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter((regulation == null ? getEI(flights) : getProvision(regulation))), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = generalPolicy == null ? false : generalPolicy.ChangePNR, EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in list) { if (((interfaceSetting.PolicyTypes & PolicyType.Normal) == (PolicyType)item.Type) || ((interfaceSetting.PolicyTypes & PolicyType.Bargain) == (PolicyType)item.Type) || ((interfaceSetting.PolicyTypes & PolicyType.Team) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR ? 1 : 0); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } if ((policyType & PolicyType.Team) != PolicyType.Team) { var queryList = from item in matchedSpeciafPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue - item.SettleAmount), Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = "0", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in queryList) { if (((interfaceSetting.PolicyTypes & PolicyType.Team) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } foreach (var item in matchedSpeciafPolicies) { if (!matchedPolicies.Contains(item)) { matchedPolicies.Add(item); } } } } else { var queryList = from item in matchedPolicies let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) where item != null && item.OriginalPolicy != null && !specialPolicy.ConfirmResource select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = 0, Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = "0", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60, OrganizaPolicy = item.OriginalPolicy }; foreach (var item in queryList) { if (((interfaceSetting.PolicyTypes & PolicyType.Special) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } } }