Exemplo n.º 1
0
    public static PolicyView Create()
    {
        GameObject obj    = (GameObject)(GameObject)GameObject.Instantiate(Resources.Load("Prefabs/LoginScreen/Policy"));
        PolicyView policy = obj.GetComponent <PolicyView>();

        return(policy);
    }
Exemplo n.º 2
0
        private void bindFlights(IEnumerable <FlightView> flights, string source, PolicyView policy)
        {
            this.ucFlights.InitData(false, flights, policy);
            hidFlightCount.Value = flights.Count().ToString();
            var firstFlgiht = flights.First();

            if (firstFlgiht.BunkType != null && firstFlgiht.YBPrice == 0 && firstFlgiht.BunkType.Value == BunkType.Free)
            {
                hidisFreeTicket.Value = "1";
            }
            hidFlishtInfos.Value = string.Format("{0},{1},{2:yyyy-MM-dd}", firstFlgiht.Departure.Code, firstFlgiht.Arrival.Code, firstFlgiht.Departure.Time);
        }
Exemplo n.º 3
0
        private MatchedPolicy QueryPolicies(PolicyType policyType, string flights, string passengers, DataTransferObject.Order.OrderView orderView)
        {
            PassengerType passengerType         = PassengerType.Adult;
            var           policyFilterCondition = new PolicyFilterConditions
            {
                PolicyType = policyType,
                Purchaser  = Company.CompanyId
            };
            IEnumerable <VoyageFilterInfo> voyages = getVoyageFilterInfos(flights, passengers);

            // 特殊票时,只取航班查询处选择的价格
            if (policyType == PolicyType.Special)
            {
                PolicyView policyView   = null;
                var        flightFlight = voyages.FirstOrDefault();
                if (flightFlight != null && flightFlight.Bunk == null)
                {
                    policyFilterCondition.PatPrice = orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null;
                }
                else if (policyView != null && flightFlight != null && flightFlight.Bunk == null)
                {
                    policyFilterCondition.PublishFare = policyView.PublishFare;
                }
            }
            else
            {
                policyFilterCondition.PatPrice = orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null;
            }
            policyFilterCondition.Voyages.AddRange(voyages);
            policyFilterCondition.VoyageType      = VoyageType.OneWay;
            policyFilterCondition.SuitReduce      = hasReduce(voyages, orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null);
            policyFilterCondition.NeedSubsidize   = true;
            policyFilterCondition.IsUsePatPrice   = false;
            policyFilterCondition.AllowTicketType = FilterByTime(voyages.Min(f => f.Flight.TakeOffTime));
            policyFilterCondition.MaxdRebate      = 0;

            IEnumerable <MatchedPolicy> matchedPolicies = PolicyMatchServcie.MatchBunk(policyFilterCondition, false, passengerType, 1).ToList();

            if (!matchedPolicies.Any() || matchedPolicies.FirstOrDefault() == null)
            {
                InterfaceInvokeException.ThrowNotFindPolicyException();
            }
            return(matchedPolicies.FirstOrDefault());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 查询往返第二程航班
        /// </summary>
        public object QueryRTSecondTipFlights(string firstTripPolicyInfoArgs, string firstTripFlightArgs, DateTime flightDate)
        {
            var firstTripFlight = FlightView.Parse(firstTripFlightArgs);
            var firstTripPolicy = PolicyView.Parse(firstTripPolicyInfoArgs);

            if (firstTripFlight == null || firstTripPolicy == null)
            {
                throw new CustomException("缺少去程信息");
            }
            var originalFlights = Service.FlightQueryService.QueryRTSecondTipFlights(firstTripFlight.Arrival.Code,
                                                                                     firstTripFlight.Departure.Code,
                                                                                     flightDate,
                                                                                     firstTripFlight.AirlineCode,
                                                                                     firstTripFlight.Arrival.Time,
                                                                                     firstTripPolicy.Type,
                                                                                     getFirstSelectedBunk(firstTripFlightArgs), BasePage.OwnerOEMId);

            saveFlights(originalFlights, VoyageSerial.Second);
            return(originalFlights.Select(constructFlightQueryResultView).GetEnumerator());
        }
Exemplo n.º 5
0
 private void bindFlights(IEnumerable <DataTransferObject.FlightQuery.FlightView> flights, PolicyView policy)
 {
     ucFlights.InitData(true, flights, policy);
 }
Exemplo n.º 6
0
 public void InitData(bool showEI, IEnumerable <DataTransferObject.FlightQuery.FlightView> flights, PolicyView policy)
 {
     this.m_showEI  = showEI;
     this.m_flights = flights;
     this.m_policy  = policy;
 }
Exemplo n.º 7
0
        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)           //采购是否能设置是否允许换编码
            });
        }
Exemplo n.º 8
0
        private List <PolicyView> MapEmegenlerPolicy_TO_PolictView(IList <EmegenlerPolicyDecorator> Policies)
        {
            var policiesAccessRoles = Policies.Select(x => new
            {
                AuthType   = x.AuthBase,
                Identifier = x.AuthBaseIdentifier
            }).Distinct().Where(a => a.AuthType == AuthBase.Role);

            var RoleList = new List <Group>();

            foreach (var role in policiesAccessRoles)
            {
                var dbRole = _context.Groups.Where(gr => gr.Id == Convert.ToInt32(role.Identifier)).FirstOrDefault();
                RoleList.Add(dbRole);
            }


            var policiesAccessUsers = Policies.Select(x => new
            {
                AuthType   = x.AuthBase,
                Identifier = x.AuthBaseIdentifier
            }).Distinct().Where(a => a.AuthType == AuthBase.User);


            var UserList = new List <User>();

            foreach (var user in policiesAccessUsers)
            {
                var dbUser = _context.Users.Where(gr => gr.Id == Convert.ToInt32(user.Identifier)).FirstOrDefault();
                UserList.Add(dbUser);
            }


            var ListOfPolicyViews = new List <PolicyView>();

            var localMapConfiguration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <EmegenlerPolicyDecorator, PolicyView>();
            });

            IMapper autoMapper = localMapConfiguration.CreateMapper();

            foreach (var policy in Policies)
            {
                var policyView = new PolicyView();
                autoMapper.Map(policy, policyView);

                if (policy.AuthBase == AuthBase.Role)
                {
                    var getRoleName = RoleList
                                      .FirstOrDefault(r => r.Id == Convert.ToInt32(policy.AuthBaseIdentifier))
                                      .Name;
                    policyView.IdentifierName = getRoleName;
                }
                if (policy.AuthBase == AuthBase.User)
                {
                    var getUser = UserList
                                  .FirstOrDefault(r => r.Id == Convert.ToInt32(policy.AuthBaseIdentifier));

                    var getUserName = getUser.Name + " " + getUser.Surname;

                    policyView.IdentifierName = getUserName;
                }

                ListOfPolicyViews.Add(policyView);
            }

            return(ListOfPolicyViews);
        }
Exemplo n.º 9
0
 private void OnClickBtnDieuKhoan(GameObject targetObject)
 {
     PolicyView.Create();
 }
Exemplo n.º 10
0
        private void setParametersInfo(string source, IEnumerable <FlightView> flights)
        {
            // 来源
            this.hidSource.Value = source;
            // 政策类型
            Common.Enums.PolicyType policyType;
            // 通过航班查询时,使用前面选择的政策类型
            if (ReservateSource == source || UpgradeByQueryFlightSource == source)
            {
                PolicyView policyView = GetPolicyView(source);
                policyType = policyView.Type;
            }
            else if (ImportSource == source)
            {
                // 编码导入时
                // 如果团队编码,则为团队政策
                if (GetOrderView(source).IsTeam)
                {
                    policyType = PolicyType.Team;
                }
                else
                {
                    // 根据舱位的类型来决定政策类型
                    if (flights.Any(f => f.BunkType == BunkType.Promotion || f.BunkType == BunkType.Production || f.BunkType == BunkType.Transfer))
                    {
                        policyType = PolicyType.Bargain;
                    }
                    else
                    {
                        switch (flights.First().BunkType)
                        {
                        case BunkType.Economic:
                        case BunkType.FirstOrBusiness:
                            policyType = PolicyType.Normal | PolicyType.Bargain;
                            break;

                        case BunkType.Promotion:
                        case BunkType.Production:
                        case BunkType.Transfer:
                            policyType = PolicyType.Bargain;
                            break;

                        default:
                            policyType = PolicyType.Special;
                            break;
                        }
                    }
                }
            }
            else
            {
                // 通过编码方式升舱 或 换出票方时,只能使用普通政策
                policyType = PolicyType.Normal;
            }
            this.hidDefaultPolicyType.Value = ((int)policyType).ToString();
            // 如果是升舱 或 换出票方,需要原订单号和原出票方
            if (UpgradeByPNRCodeSource == source || UpgradeByQueryFlightSource == source)
            {
                this.hidOriginalOrderId.Value     = Request.QueryString["orderId"];
                this.hidOriginalPolicyOwner.Value = Request.QueryString["provider"];
            }
            else if (ChangeProviderSource == source)
            {
                this.hidOriginalOrderId.Value     = Request.QueryString["orderId"];
                this.hidOriginalPolicyOwner.Value = GetOriginalOrder(source).Provider.CompanyId.ToString();
            }
            // 如果是编码导入 或 通过编码方式升舱 或换出票方 的时候,需要编码信息
            if (UpgradeByPNRCodeSource == source)
            {
                this.hidPNRCode.Value = GetApplyformView(source).PNR.PNR;
            }
            else if (ImportSource == source)
            {
                this.hidPNRCode.Value = GetOrderView(source).PNR.PNR;
            }
            else if (ChangeProviderSource == source)
            {
                this.hidPNRCode.Value = GetOriginalOrder(source).ReservationPNR.PNR;
            }
        }