Example #1
0
        internal static bool RequireFD(IEnumerable <FlightView> flights)
        {
            // 普通政策,单程根据时间段来决定是否需要核价格
            // 如果是默认政策,舱位是普通舱位时,判断条件跟普通政策一样。
            FlightView firstFlight = flights.First();

            if (firstFlight.BunkType.HasValue)
            {
                BunkType bunkType = firstFlight.BunkType.Value;
                if ((bunkType == BunkType.Economic || bunkType == BunkType.FirstOrBusiness))
                {
                    switch (flights.Count())
                    {
                    case 2:
                        return(false);

                    case 1:
                        DateTime now = DateTime.Now;
                        return(SystemParamService.FDTimeZones.Any(item => item.Lower.Date <= now && now <= item.Upper.Date));

                    default:
                        return(false);
                    }
                }
            }
            return(false);
        }
Example #2
0
        internal static bool RequirePat(IEnumerable <FlightView> flights, PolicyType policyType)
        {
            // 普通政策,单程根据时间段来决定是否需要P价格,其他的都要
            // 如果是默认政策,舱位是普通舱位时,判断条件跟普通政策一样。
            FlightView firstFlight = flights.First();

            if (firstFlight.BunkType.HasValue)
            {
                BunkType bunkType = firstFlight.BunkType.Value;
                if (policyType == PolicyType.Normal || policyType == PolicyType.NormalDefault ||
                    (policyType == PolicyType.OwnerDefault && (bunkType == BunkType.Economic || bunkType == BunkType.FirstOrBusiness)))
                {
                    switch (flights.Count())
                    {
                    case 2:
                        return(true);

                    case 1:
                        DateTime today = DateTime.Today;
                        return(SystemParamService.PATTimeZones.Any(item => item.Lower.Date <= today && today <= item.Upper.Date));
                    }
                }
            }
            return(false);
        }
Example #3
0
        /// <summary>
        /// 列表绑定
        /// </summary>
        private void DataBindArea()
        {
            //舱位类型
            System.Reflection.FieldInfo[] classType = typeof(BunkType).GetFields();
            foreach (var item in classType)
            {
                if (!item.IsSpecialName)                                    //反射出第一个Field为特殊Field
                {
                    BunkType obj   = (BunkType)item.GetRawConstantValue();  //对应的文章
                    string   text  = obj.GetDescription();
                    string   value = item.GetRawConstantValue().ToString(); //对应的值
                    radiolist.Items.Add(new ListItem(text, value));
                }
            }
            this.radiolist.Items[0].Selected = true;
            //航空公司
            foreach (var item in FoundationService.Airlines)
            {
                this.ddlAirline.Items.Add(new ListItem(item.Code.Value + "-" + item.ShortName, item.Code.Value));
            }
            this.ddlAirline.Items.Insert(0, new ListItem("-请选择-", "0"));
            //到达机场 出发机场

            foreach (var item in FoundationService.Airports)
            {
                string name = item.Code.Value + "-" + item.ShortName;
                this.ddlDepartCity.Items.Add(new ListItem(name, item.Code.Value));
                this.ddlArriveCity.Items.Add(new ListItem(name, item.Code.Value));
            }
            this.ddlDepartCity.Items.Insert(0, new ListItem("-所有-", "0"));
            this.ddlArriveCity.Items.Insert(0, new ListItem("-所有-", "0"));

            //头等/公务舱描述
            this.ddltdType.Items.Clear();
            this.ddltdType.DataSource     = SystemDictionaryService.Query(SystemDictionaryType.FirstOrBusinessBunkDescription);
            this.ddltdType.DataTextField  = "Name";
            this.ddltdType.DataValueField = "Id";
            this.ddltdType.DataBind();
            this.ddltdType.Items.Insert(0, new ListItem("-请选择-", "0"));

            //特价舱描述
            this.ddlTJType.Items.Clear();
            this.ddlTJType.DataSource     = SystemDictionaryService.Query(SystemDictionaryType.PromotionBunkDescription);
            this.ddlTJType.DataTextField  = "Name";
            this.ddlTJType.DataValueField = "Id";
            this.ddlTJType.DataBind();
            this.ddlTJType.Items.Insert(0, new ListItem("-请选择-", "0"));

            //免票描述
            dropMpType.Items.Clear();
            dropMpType.DataSource     = SystemDictionaryService.Query(SystemDictionaryType.FreeDescription);
            dropMpType.DataTextField  = "Name";
            dropMpType.DataValueField = "Id";
            dropMpType.DataBind();
            dropMpType.Items.Insert(0, new ListItem("-请选择-", "0"));
            Service.Foundation.Domain.Bunk bunk = string.IsNullOrEmpty(Request.QueryString["Id"]) ? null : FoundationService.QueryBunkNew(new Guid(Request.QueryString["Id"]));
            //适用行程
            var voyageTypes = (Enum.GetValues(typeof(VoyageTypeValue)) as VoyageTypeValue[]).Select(item => new KeyValuePair <int, string>((int)item, item.GetDescription()));

            foreach (var item in voyageTypes)
            {
                var listIetm = new ListItem();
                if (bunk != null && (bunk.VoyageType & (VoyageTypeValue)item.Key) == (VoyageTypeValue)item.Key)
                {
                    listIetm.Selected = true;
                }
                listIetm.Value = item.Key.ToString();
                listIetm.Text  = item.Value;
                chklVoyageType.Items.Add(listIetm);
            }
            //旅行类型
            var travelTypes = (Enum.GetValues(typeof(TravelTypeValue)) as TravelTypeValue[]).Select(item => new KeyValuePair <int, string>((int)item, item.GetDescription()));

            foreach (var item in travelTypes)
            {
                var listItem = new ListItem();
                if (bunk != null && (bunk.TravelType & (TravelTypeValue)item.Key) == (TravelTypeValue)item.Key)
                {
                    listItem.Selected = true;
                }
                listItem.Value = item.Key.ToString();
                listItem.Text  = item.Value;
                chklTravelType.Items.Add(listItem);
            }
            //旅客类型
            var passengerTypes = (Enum.GetValues(typeof(PassengerTypeValue)) as PassengerTypeValue[]).Select(item => new KeyValuePair <int, string>((int)item, item.GetDescription()));

            foreach (var item in passengerTypes)
            {
                var listItem = new ListItem();
                if (bunk != null && (bunk.PassengerType & (PassengerTypeValue)item.Key) == (PassengerTypeValue)item.Key)
                {
                    listItem.Selected = true;
                }
                listItem.Text  = item.Value;
                listItem.Value = item.Key.ToString();
                chklPassengerType.Items.Add(listItem);
            }
        }