Пример #1
0
    protected void BindData()
    {
        if (this.Request["CityName"] != null)
        {
            lblCityName.Text = this.Request["CityName"].Trim();
            lblCityName1.Text = this.Request["CityName"].Trim();
        }

        List<Terms.Common.Domain.City> citylist = new List<Terms.Common.Domain.City>();

        if (Session["CityNameList"] != null)
        {
            IList list = (IList)Session["CityNameList"];

            for (int i = 0; i < list.Count; i++)
            {
                Terms.Common.Domain.City citytemp = new Terms.Common.Domain.City();
                citytemp.Name = ((Terms.Common.Domain.City)list[i]).Name + ", " + ((Terms.Common.Domain.City)list[i]).Country.Name;
                citytemp.Code = ((Terms.Common.Domain.City)list[i]).Code;
                citylist.Add(citytemp);
            }

            Terms.Common.Domain.City city = new Terms.Common.Domain.City();
            city.Name = "Or enter a new city name:";

            citylist.Add(city);
            plCityName.Visible = true;
            PLCiytName1.Visible = false;
            choosecity.Visible = true;
            PLCiytName2.Visible = false;
            PLCiytName3.Visible = false;

            rblCityName.DataTextField = "Name";
            rblCityName.DataValueField = "Code";

            rblCityName.DataSource = citylist;
            rblCityName.DataBind();
        }
        else if (this.Request["CityName"] != null && (this.Request["CityName"].ToString().Trim() == "" || this.Request["CityName"].ToString().Trim().Length < 3))
        {
            PLCiytName2.Visible = true;
            PLCiytName3.Visible = false;
            choosecity.Visible = false;
            List<City> list = new List<City>();
            City city = new City();
            city.Name = "Enter a new city name:";
            list.Add(city);
            plCityName.Visible = false;
            PLCiytName1.Visible = false;

            rblCityName.DataTextField = "Name";
            rblCityName.DataValueField = "Code";

            rblCityName.DataSource = list;
            rblCityName.DataBind();
        }
        else if (this.Request["ErrorMessage"] != null && this.Request["ErrorMessage"].ToString().Trim() != "")
        {
            txtCityName.Text = ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location;
            PLCiytName2.Visible = false;
            choosecity.Visible = false;
            List<City> list = new List<City>();
            City city = new City();
            city.Name = "Enter a new city name:";
            list.Add(city);
            plCityName.Visible = false;
            PLCiytName1.Visible = false;
            PLCiytName3.Visible = true;

            rblCityName.DataTextField = "Name";
            rblCityName.DataValueField = "Code";

            rblCityName.DataSource = list;
            rblCityName.DataBind();
        }
        else
        {
            PLCiytName3.Visible = false;
            PLCiytName2.Visible = false;
            choosecity.Visible = false;
            List<City> list = new List<City>();
            City city = new City();
            city.Name = "Enter a new city name:";
            list.Add(city);
            plCityName.Visible = false;
            PLCiytName1.Visible = true;

            rblCityName.DataTextField = "Name";
            rblCityName.DataValueField = "Code";

            rblCityName.DataSource = list;
            rblCityName.DataBind();
        }

        //Ĭ��ѡ�е�һ��
        if (rblCityName.Items.Count > 0)
            rblCityName.SelectedIndex = 0;
    }
Пример #2
0
    /// <summary>
    /// Init page
    /// </summary>
    private void Initial()
    {
        BindSeason();
        InitBinderInfo();
        if (!((TourSearchCondition)this.Transaction.CurrentSearchConditions).IsLandOnly)
        {
            this.tbDeptPlace.Visible = true;
            IApplicationContext ctx = ContextRegistry.GetContext();
            List<Terms.Common.Domain.City> temp = new List<Terms.Common.Domain.City>();

            IApplicationCacheFoundationDate applicationCacheFoundationDate = ctx["ApplicationCacheFoundationDate"] as IApplicationCacheFoundationDate;
            temp = applicationCacheFoundationDate.FindCityByCountry("US"); //ֻȡ��������
            List<Terms.Common.Domain.City> Citys = new List<Terms.Common.Domain.City>();
            foreach (Terms.Common.Domain.City city in temp)
            {
                Terms.Common.Domain.City tempcity = new Terms.Common.Domain.City();
                tempcity.Code = city.Code;
                if (city.ProvinceName != "")
                    tempcity.Name = city.Name + ", " + city.ProvinceName;
                else
                    tempcity.Name = city.Name;
                Citys.Add(tempcity);
            }
            ddlUsaCity.DataSource = Citys;
            ddlUsaCity.DataTextField = "Name";
            ddlUsaCity.DataValueField = "Code";
            ddlUsaCity.DataBind();
            lblDisplay.Visible = false;
        }
        else
        {
            isIndex4Or5.Text = "4";
            isIndex5Or6.Text = "5";
            lblDisplay.Visible = IsDisPlay(((TourSearchCondition)Utility.Transaction.CurrentSearchConditions).Counrty);
        }

        TourProfile tourProfile = (TourProfile)((TourMaterial)SelectTourMaterial).Profile;
        lblHighlight.Text = ((TourMaterial)SelectTourMaterial).Profile.Description;
        lblRemark.Text = ((Terms.Product.Business.MVTourProfile)tourProfile).Attention;//((TourMaterial)SelectTourMaterial).Profile.
        BindTravelerChange(tourProfile);
        dlFrices.DataSource = PriceDateList;
        dlFrices.DataBind();
    }