public GiayKhaiSinh findByMaCD(string maCD) { try { string sqlString = "select * from GiayKhaiSinhs where MaCD = " + maCD + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); GiayKhaiSinh gks = new GiayKhaiSinh() { So = (string)ds.Tables[0].Rows[0].ItemArray[0], MaQuyen = (string)ds.Tables[0].Rows[0].ItemArray[1], MaCD = (string)ds.Tables[0].Rows[0].ItemArray[2], //CongDan = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[2]), NoiSinh = (string)ds.Tables[0].Rows[0].ItemArray[3], MaCD_Cha = (string)ds.Tables[0].Rows[0].ItemArray[4], //Cha = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[4]), MaCD_Me = (string)ds.Tables[0].Rows[0].ItemArray[5], //Me = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[5]), MaCD_NguoiKhai = (string)ds.Tables[0].Rows[0].ItemArray[6], //NguoiKhai = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[6]), QuanHe = (string)ds.Tables[0].Rows[0].ItemArray[7], NgayDK_KhaiSinh = (DateTime)ds.Tables[0].Rows[0].ItemArray[8], }; return(gks); } catch (Exception e) { MessageBox.Show("Lỗi findByMaCD KhaiSinh!!! + " + e.Message); return(null); } }
public CongDan TimMaCD(string MaCD) { string sqlString = "select * from CongDans where MaCD = '" + MaCD + "'"; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); //CongDan cd = new CongDan() //{ // MaCD = (string)ds.Tables[0].Rows[0].ItemArray[0], // HoLot = (string)ds.Tables[0].Rows[0].ItemArray[1], // Ten = (string)ds.Tables[0].Rows[0].ItemArray[2], // GioiTinh = (bool)ds.Tables[0].Rows[0].ItemArray[3], // NgaySinh = (DateTime)ds.Tables[0].Rows[0].ItemArray[4], // QuocTich = (string)ds.Tables[0].Rows[0].ItemArray[5], // DanToc = (string)ds.Tables[0].Rows[0].ItemArray[6], // TonGiao = (string)ds.Tables[0].Rows[0].ItemArray[7], // QueQuan = (string)ds.Tables[0].Rows[0].ItemArray[8], // soCMND = (string)ds.Tables[0].Rows[0].ItemArray[9], // MaHK = (string)ds.Tables[0].Rows[0].ItemArray[10], // SDT = (string)ds.Tables[0].Rows[0].ItemArray[11], // DiaChiThuongTru = (string)ds.Tables[0].Rows[0].ItemArray[12], // DiaChiTamTru = (string)ds.Tables[0].Rows[0].ItemArray[13], // NgheNghiep = (string)ds.Tables[0].Rows[0].ItemArray[14], // MaGDKKetHon = (string)ds.Tables[0].Rows[0].ItemArray[15], // ConSong = (bool)ds.Tables[0].Rows[0].ItemArray[16], // HinhAnh = (string)ds.Tables[0].Rows[0].ItemArray[17], //}; CongDan cd = findById((string)ds.Tables[0].Rows[0].ItemArray[0]); return(cd); }
public GiayNhanConNuoi findById(string id) { try { string sqlString = "select * from GiayNhanConNuois where MaGiayNhanConNuoi = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); GiayNhanConNuoi gncn = new GiayNhanConNuoi() { MaGiayNhanConNuoi = (string)ds.Tables[0].Rows[0].ItemArray[0], MaQuyen = (string)ds.Tables[0].Rows[0].ItemArray[1], MaCD_Cha = (string)ds.Tables[0].Rows[0].ItemArray[2], //Cha = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[2]), MaCD_Me = (string)ds.Tables[0].Rows[0].ItemArray[3], //Me = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[3]), MaCD_Con = (string)ds.Tables[0].Rows[0].ItemArray[4], //Con = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[4]), NoiDangKi = (string)ds.Tables[0].Rows[0].ItemArray[5], NgayDangKi = (DateTime)ds.Tables[0].Rows[0].ItemArray[6], GhiChu = (string)ds.Tables[0].Rows[0].ItemArray[7] }; return(gncn); } catch (Exception e) { MessageBox.Show("Lỗi findById GiayNhanConNuoi + " + e.Message); return(null); } }
public ThuongTru findById(string id) { try { string sqlString = "select * from ThuongTrus where So = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); ThuongTru gks = new ThuongTru() { SoQuyen = (string)ds.Tables[0].Rows[0].ItemArray[0], SoDK = (int)ds.Tables[0].Rows[0].ItemArray[1], MaCD = (string)ds.Tables[0].Rows[0].ItemArray[2], NgayDK = (DateTime)ds.Tables[0].Rows[0].ItemArray[3], MaHoKhau = (string)ds.Tables[0].Rows[0].ItemArray[4], NoiDKThuongTru = (string)ds.Tables[0].Rows[0].ItemArray[5], NgayDen = (DateTime)ds.Tables[0].Rows[0].ItemArray[6], NgayHuy = (DateTime)ds.Tables[0].Rows[0].ItemArray[7], }; return(gks); } catch (Exception e) { MessageBox.Show("Lỗi FindById ThuongTru!!! + " + e.Message); return(null); } }
public List <HoKhau_QuanHe> findByMaHK(string id) { try { string sqlString = "select * from HoKhau_QuanHe Where maHK = '" + id + "'"; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); DataTable dt = ds.Tables[0]; List <HoKhau_QuanHe> hoKhau_QuanHes = new List <HoKhau_QuanHe>(); foreach (DataRow dr in dt.Rows) { HoKhau_QuanHe hk = new HoKhau_QuanHe() { maHK = (string)dr.ItemArray[0], maCD = (string)dr.ItemArray[1], idQuanHe = (int)dr.ItemArray[2], QuanHe = ketNoiQuanHe.findById((int)ds.Tables[0].Rows[0].ItemArray[2]) }; hoKhau_QuanHes.Add(hk); } return(hoKhau_QuanHes); } catch (Exception e) { MessageBox.Show("Lỗi findByMaHK HoKhau_QuanHe + " + e.Message); return(null); } }
public GiayChungTu findById(string id) { try { string sqlString = "select * from GiayChungTus where MaGiayChungTu = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); GiayChungTu gct = new GiayChungTu() { MaGiayChungTu = (string)ds.Tables[0].Rows[0].ItemArray[0], MaQuyen = (string)ds.Tables[0].Rows[0].ItemArray[1], MaCD = (string)ds.Tables[0].Rows[0].ItemArray[2], //CongDan = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[2]), CoQuanBaoTu = (string)ds.Tables[0].Rows[0].ItemArray[3], NoiChet = (string)ds.Tables[0].Rows[0].ItemArray[4], NguyenNhan = (string)ds.Tables[0].Rows[0].ItemArray[5], MaCD_NguoiKhai = (string)ds.Tables[0].Rows[0].ItemArray[6], //NguoiKhai = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[6]), NgayTu = (DateTime)ds.Tables[0].Rows[0].ItemArray[7], }; return(gct); } catch (Exception e) { MessageBox.Show("Lỗi findById ChungTu + " + e.Message); return(null); } }
public HoKhau TimHK(string MaHK) { string sqlString = "select * from HoKhaus where SoHK = " + MaHK + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); HoKhau hk = new HoKhau() { SoHK = (string)ds.Tables[0].Rows[0].ItemArray[0], DiaChi = (string)ds.Tables[0].Rows[0].ItemArray[1], }; return(hk); }
public DataTable LayCongDan() { QuanLyDanCuModelADO db = new QuanLyDanCuModelADO(); DataSet sd = db.ExecuteQueryDataSet("select * from ConDans", CommandType.Text); return(sd.Tables[0]); }
public CMND findById(string id) { try { string sqlString = "select * from CMNDs where MaSo = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); CMND cmnd = new CMND() { MaSo = (string)ds.Tables[0].Rows[0].ItemArray[0], NgayCap = (DateTime)ds.Tables[0].Rows[0].ItemArray[1], NoiCap = (string)ds.Tables[0].Rows[0].ItemArray[2], }; return(cmnd); } catch (Exception e) { MessageBox.Show("Lỗi findById CMND + " + e.Message); return(null); } }
public Array getArray() { try { string sqlString = "select * from QuanHes "; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); DataTable dt = ds.Tables[0]; List <QuanHe> quanHes = new List <QuanHe>(); foreach (DataRow dr in dt.Rows) { QuanHe qh = findById((int)dr.ItemArray[0]); quanHes.Add(qh); } return(quanHes.ToArray()); } catch (Exception e) { MessageBox.Show("Lỗi getArray QuanHe + " + e.Message); return(null); } }
public CapGiayTo findById(int id) { try { string sqlString = "select * from CapGiayToes where id = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); CapGiayTo cgt = new CapGiayTo() { id = (int)ds.Tables[0].Rows[0].ItemArray[0], MaCD = (string)ds.Tables[0].Rows[0].ItemArray[1], //CongDan = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[1]), LoaiGiayTo = (string)ds.Tables[0].Rows[0].ItemArray[2], NgayCap = (DateTime)ds.Tables[0].Rows[0].ItemArray[3] }; return(cgt); } catch (Exception e) { MessageBox.Show("Lỗi findById CapGiayTo + " + e.Message); return(null); } }
public NguoiDung KiemTraDangNhap(string user, string pass) { string sqlString = "select * from NguoiDungs where username = '******' AND password = '******'"; DataSet ds = quanLyDanCuModelADO.ExecuteQueryDataSet(sqlString, CommandType.Text); NguoiDung nd = new NguoiDung() { username = (string)ds.Tables[0].Rows[0].ItemArray[0], password = (string)ds.Tables[0].Rows[0].ItemArray[1], IDQuyen = (bool)ds.Tables[0].Rows[0].ItemArray[2] }; return(nd); }
public DonViQuanLi LayDonVi() { QuanLyDanCuModelADO db = Form1.db; string sqlString = "select * from DonViQuanLis "; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); DataTable dt = ds.Tables[0]; List <DonViQuanLi> thuongtrus = new List <DonViQuanLi>(); foreach (DataRow dr in dt.Rows) { DonViQuanLi tt = findById((string)dr.ItemArray[0]); thuongtrus.Add(tt); } return(thuongtrus[0]); }
public void TaoMoi(TamVang TV) { try { string sqlString = "select * from TamVangs "; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); DataTable dt = ds.Tables[0]; List <TamVang> thuongtrus = new List <TamVang>(); foreach (DataRow dr in dt.Rows) { TamVang tt = findById((string)dr.ItemArray[0]); thuongtrus.Add(tt); } TamVang tts = thuongtrus.LastOrDefault(); int MaxSoDk = tts.SoDK; TV.SoDK = MaxSoDk + 1; create(TV); } catch (Exception e) { } }
public GiayDangKiKetHon findById(string id) { try { string sqlString = "select * from GiayDangKiKetHons where MaGDKKetHon = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); GiayDangKiKetHon gdkkh = new GiayDangKiKetHon() { MaGDKKetHon = (string)ds.Tables[0].Rows[0].ItemArray[0], MaQuyen = (string)ds.Tables[0].Rows[0].ItemArray[1], MaCD_Chong = (string)ds.Tables[0].Rows[0].ItemArray[2], //Chong = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[2]), MaCD_Vo = (string)ds.Tables[0].Rows[0].ItemArray[3], //Vo = ketNoiCongDan.findById((string)ds.Tables[0].Rows[0].ItemArray[3]), NgayDangKi = (DateTime)ds.Tables[0].Rows[0].ItemArray[4], }; return(gdkkh); } catch (Exception e) { MessageBox.Show("Lỗi findById KetHon + " + e.Message); return(null); } }
public DonViQuanLi findById(string id) { try { QuanLyDanCuModelADO db = Form1.db; string sqlString = "select * from DonViQuanLis where So = " + id + ""; DataSet ds = db.ExecuteQueryDataSet(sqlString, CommandType.Text); DonViQuanLi gks = new DonViQuanLi() { id = (int)ds.Tables[0].Rows[0].ItemArray[0], Phuong = (string)ds.Tables[0].Rows[0].ItemArray[1], Quan = (string)ds.Tables[0].Rows[0].ItemArray[2], ThanhPho = (string)ds.Tables[0].Rows[0].ItemArray[3], }; return(gks); } catch (Exception e) { MessageBox.Show("Lỗi FindById TamVang!!! + " + e.Message); return(null); } }