Example #1
0
 //
 public int GetLastID()
 {
     if (this.DATA == null)
     {
         this.DATA = new Xa_Phuong_Data();
     }
     return(Convert.ToInt32(this.DATA.GetLastID()));
 }
Example #2
0
        public void DanhsachVanHoaXa(GridControl dg, BindingNavigator bn, TextBoxX mabuudien, TextBoxX tendiem, ComboBoxEx cmbhuyen, ComboBoxEx cmbxa, TextBoxX diachi, ComboBoxEx cmbDN)
        {
            BindingSource bs = new BindingSource();

            bs.DataSource    = data.ChitietBDVanHoaXa();
            bn.BindingSource = bs;
            dg.DataSource    = bs;

            Huyen_Thi_Data db = new Huyen_Thi_Data();

            cmbhuyen.DataSource    = db.HienThiDanhSachHuyen();
            cmbhuyen.DisplayMember = "TenHuyen";
            cmbhuyen.ValueMember   = "MaHuyen";

            Xa_Phuong_Data dbxa = new Xa_Phuong_Data();

            cmbxa.DataSource    = dbxa.DanhSach_Xa_Phuong();
            cmbxa.DisplayMember = "TenXa";
            cmbxa.ValueMember   = "MaXa";

            QL_DoanhNghiep_Data dbDN = new QL_DoanhNghiep_Data();

            cmbDN.DataSource    = dbDN.Show_DoanhNghiep();
            cmbDN.DisplayMember = "TenDoanhNghiep";
            cmbDN.ValueMember   = "MaDoanhNghiep";

            if (mabuudien.DataBindings.Count > 0)
            {
                mabuudien.DataBindings.Clear();
                tendiem.DataBindings.Clear();
                cmbhuyen.DataBindings.Clear();
                cmbxa.DataBindings.Clear();
                diachi.DataBindings.Clear();
                cmbDN.DataBindings.Clear();
            }
            mabuudien.DataBindings.Add("Text", bs, "MaDaiLyBuuDienVHX");
            tendiem.DataBindings.Add("Text", bs, "TenDaiLyBuuDienVHX");
            cmbhuyen.DataBindings.Add("SelectedValue", bs, "MaHuyen");
            cmbxa.DataBindings.Add("SelectedValue", bs, "MaXa");
            diachi.DataBindings.Add("Text", bs, "DiaChi");
            cmbDN.DataBindings.Add("SelectedValue", bs, "MaDoanhNghiep");
        }