예제 #1
0
        public Form1()
        {
            InitializeComponent();

            flightDao = new FlightDao();
            list      = new List <FlightViewModel>();

            list = flightDao.GetAllViewModel();

            btnCofirm        = CofirmButton();
            btnCofirm.Click += BtnCofirm_Click;
            dao              = new AirportDao();
            ComboboxItem combobox = new ComboboxItem();

            combobox.Text  = "=====Airport=====";
            combobox.Value = 0;
            cbxFrom.Items.Add(combobox);
            cbxTo.Items.Add(combobox);

            foreach (var item in dao.GetListAirport())
            {
                ComboboxItem cb = new ComboboxItem();
                cb.Text  = item.Name;
                cb.Value = item.ID;
                cbxFrom.Items.Add(cb);
                cbxTo.Items.Add(cb);
            }
            cbxFrom.SelectedIndex = 0;
            cbxTo.SelectedIndex   = 0;

            cbxSort.Items.AddRange(new object[] { new ComboboxItem()
                                                  {
                                                      Text = "Date", Value = 0
                                                  }, new ComboboxItem()
                                                  {
                                                      Text = "Time", Value = 1
                                                  },
                                                  new ComboboxItem()
                                                  {
                                                      Text = "Economy Price", Value = 2
                                                  } });
            cbxSort.SelectedIndex = 0;
            list = list.OrderByDescending(x => x.DateFlight).ToList();
        }
예제 #2
0
 private List <FlightViewModel> GetReloadList()
 {
     return(flightDao.GetAllViewModel());
 }