示例#1
0
        private void clear()
        {
            dpFromCity.Items.Clear();
            dpToCity.Items.Clear();
            dpAirlineName.Items.Clear();
            dpFlightName.Items.Clear();
            DropDownList1.Items.Clear();
            DropDownList2.Items.Clear();
            DropDownList4.Items.Clear();
            DropDownList5.Items.Clear();

            DropDownList1.Items.Add("0");
            DropDownList4.Items.Add("0");
            for (int i = 1; i <= 24; i++)
            {
                DropDownList1.Items.Add(i.ToString());
                DropDownList4.Items.Add(i.ToString());
            }
            DropDownList1.DataBind();
            DropDownList4.DataBind();

            for (int i = 0; i <= 59; i++)
            {
                DropDownList2.Items.Add(i.ToString());
                DropDownList5.Items.Add(i.ToString());
            }
            DropDownList2.DataBind();
            DropDownList5.DataBind();
            
            txtDuration.Enabled = false;

            txtDuration.Text = "";
            chkStatus.Checked = false;
            CityManager obj = new CityManager();
            try
            {
                City[] cityList = obj.GetCities();

                dpFromCity.Items.Add("None");
                foreach (City c in cityList)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpFromCity.Items.Add(item);
                }
                dpFromCity.DataBind();

                dpToCity.Items.Add("None");
                foreach (City c in cityList)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpToCity.Items.Add(item);
                }
                dpToCity.DataBind();
            }
            catch (CityManagerException e)
            {
                lblError.Text = e.Message;
            }


            Airlines objairline = new Airlines();
            try
            {
                List<Airline> airlinelist = objairline.GetAllAirlinesCollecction();

                dpAirlineName.Items.Add("None");
                foreach (Airline c in airlinelist)
                {
                    ListItem item = new ListItem(c.Name, c.Id.ToString());
                    dpAirlineName.Items.Add(item);
                }
                dpAirlineName.DataBind();
            }
            catch (AirlineManagerException e)
            {
                lblError.Text = e.Message;
            }
           
            var travelClassvalues = Enum.GetValues(typeof(TravelClass)).Cast<TravelClass>();
            Repeater1.DataSource = travelClassvalues;
            Repeater1.DataBind();

        }