Exemplo n.º 1
0
        void loadDSLoaiTour()
        {
            List <LoaiTour> result = DalTour.GetAllLoaiTour();

            cbLoaiTour.DropDownStyle = ComboBoxStyle.DropDownList;
            cbLoaiTour.DataSource    = result;

            cbLoaiTour.DisplayMember = "Ten";
            cbLoaiTour.ValueMember   = "Id";

            //cbLoaiTour.SelectedValue = 4;
        }
Exemplo n.º 2
0
        public void loadDSTour()
        {
            dt = new DataTable();
            dt.Columns.Add("Id");
            dt.Columns.Add("Tên Tour");
            dt.Columns.Add("Mã Loại Tour");

            listTour = DalTour.getAllTour();
            foreach (Tour tour in listTour)
            {
                dt.Rows.Add(tour.Id, tour.Ten, tour.MaLoaiTour);
            }
            dv = new DataView(dt);

            dataGridView1.DataSource = dv;
            dataGridView1.Refresh();
            dataGridView1.Update();
            dataGridView1.AutoGenerateColumns = false;

            //    dataGridView1.Columns["DoanDLs"].Visible = false;
            // dataGridView1.Columns.Remove("DoanDLs");


            comboBox1.Items.Clear();
            List <String> ColNameList = new List <String>();

            ColNameList.Add("Tất cả");

            int i = 1;

            foreach (DataColumn c in dt.Columns)
            {
                ColNameList.Add(c.ColumnName);

                /*if(i++ >= 3)
                 * {
                 *  break;
                 * }*/
            }


            String[] ColNameArray = ColNameList.ToArray();

            comboBox1.Items.AddRange(ColNameArray);
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            //   curTour = (listTour != null) ? listTour[0] : null;
        }
Exemplo n.º 3
0
 void LoadTour()
 {
     listTour = DalTour.getAllTour();
     foreach (Tour tour in listTour)
     {
         cbTour.Items.Add(tour.Id + ". " + tour.Ten.Trim());
     }
     try
     {
         // cbTour.SelectedIndex = 0;
     }
     catch (Exception e)
     {
     }
 }
Exemplo n.º 4
0
 void loadGia()
 {
     DisableEditGia();
     if (TrangThai == "AddTour")
     {
         btSuaGia.Enabled = false;
         btXoaGia.Enabled = false;
     }
     else
     {
         listGiaTour          = DalTour.GetGiaByTour(curTour);
         listGia_TourBindings = new BindingList <Gia>(listGiaTour);
         //dgvGia.AutoGenerateColumns = false;
         dgvGia.DataSource                = listGia_TourBindings;
         dgvGia.Columns[0].HeaderText     = "Id";
         dgvGia.Columns[2].HeaderText     = "Ngay Bat Dau";
         dgvGia.Columns[3].HeaderText     = "Ngay Ket Thuc";
         dgvGia.Columns[1].HeaderText     = "Gia";
         dgvGia.Columns["MaTour"].Visible = false;
         dgvGia.Columns["Tour"].Visible   = false;
     }
 }
Exemplo n.º 5
0
        void loadDiaDiem()
        {
            listDiaDiem = DalDiaDiem.GetAllDiaDiem();
            listBoxPhai.Items.Clear();
            listBoxTrai.Items.Clear();
            if (TrangThai == "AddTour")
            {
                foreach (DiaDiem diaDiem in listDiaDiem)
                {
                    if (!listDiaDiem_Tour.Contains(diaDiem))
                    {
                        listBoxTrai.Items.Add(diaDiem);
                    }
                }

                listBoxTrai.DisplayMember = "Ten";
                listBoxTrai.ValueMember   = "Id";
                listBoxPhai.DisplayMember = "Ten";
                listBoxPhai.ValueMember   = "Id";
            }
            else
            {
                listDiaDiem_Tour = DalTour.GetDiaDiemByTour(curTour);
                foreach (DiaDiem diaDiem in listDiaDiem_Tour)
                {
                    listBoxPhai.Items.Add(diaDiem);
                    listDiaDiem.RemoveAll(s => s.Id == diaDiem.Id);
                }


                foreach (DiaDiem diaDiem in listDiaDiem)
                {
                    if (!listDiaDiem_Tour.Contains(diaDiem))
                    {
                        listBoxTrai.Items.Add(diaDiem);
                    }
                }

                listBoxTrai.DisplayMember = "Ten";
                listBoxTrai.ValueMember   = "Id";
                listBoxPhai.DisplayMember = "Ten";
                listBoxPhai.ValueMember   = "Id";

                if (listBoxTrai.Items.Count > 0)
                {
                    listBoxTrai.SetSelected(0, true);
                }
                if (listBoxPhai.Items.Count > 0)
                {
                    listBoxPhai.SetSelected(0, true);
                }
            }

            //listĐiaiemBindings = new BindingList<DiaDiem>(listDiaDiem);
            // listBoxTrai.DataSource = listĐiaiemBindings;

            /* listBoxTrai.DisplayMember = "Ten";
             * listBoxTrai.ValueMember = "Id";*/

            //listBoxTrai.SelectedValue = 3;

            //mattour = 1

            /*if (Id != 0)
             * {
             *
             * }*/
        }