Пример #1
0
        public frChiTietTour()
        {
            InitializeComponent();
            TrangThai = "AddTour";
            this.Text = "Thêm Tour";

            listDiaDiem      = DalDiaDiem.GetAllDiaDiem();
            listDiaDiem_Tour = new List <DiaDiem>();
            HienThiThongTin();
        }
Пример #2
0
        private void btXoa_Click(object sender, EventArgs e)
        {
            if (curDiaDiem.KiemtraXoa())
            {
                curDiaDiem.Delete();
                if (listDiaDiem.Count > 0)
                {
                    curDiaDiem = listDiaDiem[0];
                }

                listDiaDiem = DalDiaDiem.GetAllDiaDiem();
                loadData();
            }
            else
            {
                MessageBox.Show("Dia dieem da duoc su dung nen khong the xoa", "Lỗi: Dia diem da duoc su dung!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Пример #3
0
        private void btLuu_Click(object sender, EventArgs e)
        {
            if (txTen.Text.Trim() == "")
            {
                MessageBox.Show("Tên bị rỗng", "Lỗi: Tên không được rỗng!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DiaDiem temp = new DiaDiem()
            {
                Id = int.Parse(txId.Text), Ten = txTen.Text, GhiChu = txGHichu.Text
            };

            if (temp.Id != -1)
            {
                temp.updated = true;
            }
            temp.Save();
            MessageBox.Show("Lưu thành công địa điểm mã:" + temp.Id, "Thành công: Lưu thành công!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            KhoaChinhSua();
            listDiaDiem = DalDiaDiem.GetAllDiaDiem();
            loadData();
        }
Пример #4
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)
             * {
             *
             * }*/
        }
Пример #5
0
 private void DanhSachDiaDiem_Load(object sender, EventArgs e)
 {
     listDiaDiem = DalDiaDiem.GetAllDiaDiem();
     loadData();
 }