public ThanhVienDto GetThanhVien(string mtv) { ArrayList arr = new ArrayList(); ThanhVienDto dto; OleDbDataReader reader = (OleDbDataReader)dao.GetDanhSachThanhVien(); while (reader.Read()) { dto = new ThanhVienDto(); dto.MaThanhVien = reader["MaThanhVien"].ToString(); dto.ThanhVienCu = reader["ThanhVienCu"].ToString(); dto.MaLoaiQuanHe = reader["MaLoaiQuanHe"].ToString(); dto.NgayPhatSinh = System.Convert.ToDateTime(reader["NgayPhatSinh"].ToString()); dto.HoVaTen = reader["HoVaTen"].ToString(); dto.GioiTinh = reader["GioiTinh"].ToString(); dto.NgayGioSinh = System.Convert.ToDateTime(reader["NgayGioSinh"].ToString()); dto.MaQueQuan = reader["MaQueQuan"].ToString(); dto.MaNgheNghiep = reader["MaNgheNghiep"].ToString(); dto.DiaChi = reader["DiaChi"].ToString(); dto.Doi = reader["Doi"].ToString(); dto.ChaMe = reader["ChaMe"].ToString(); if (dto.MaThanhVien == mtv) reader.Close(); return dto; } reader.Close(); return null; }
private void Click_Delete(object sender, EventArgs e) { ThanhVienBus bus = new ThanhVienBus(); ThanhVienDto dto=new ThanhVienDto(); string str=dataGridView_ThanhVien.CurrentRow.Cells[0].Value.ToString(); dto=bus.GetThanhVien(str); bus.ThanhVien = dto; DialogResult result = MessageBox.Show("Do you really want to Delete?", "Quan Ly Gia Pha", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) bus.Delete(); }
private ThanhVienDto GetForm_TiepNhanThanhVien() { ThanhVienDto tv = new ThanhVienDto(); tv.MaThanhVien = textBox_mathanhvien.Text; tv.ThanhVienCu = textBox_thanhviencu.Text; tv.NgayPhatSinh = System.Convert.ToDateTime(dateTimePicker_ngayphatsinh.Text); tv.GioiTinh = comboBox_gioitinh.Text; tv.MaQueQuan = (string)comboBox_maquequan.SelectedValue; tv.Doi = textBox_doi.Text; tv.ChaMe = textBox_chame.Text; tv.MaLoaiQuanHe = (string)comboBox_maloaiquanhe.SelectedValue; tv.HoVaTen = textBox_hovaten.Text; tv.NgayGioSinh = System.Convert.ToDateTime(dateTimePicker_ngaysinh.Text); tv.MaNgheNghiep =(string)comboBox_manghenghiep.SelectedValue; tv.DiaChi = textBox_diachi.Text; return tv; }
public void Update(ThanhVienDto dto) { string query="UPDATE THANHVIEN SET MaThanhVien='"+dto.MaThanhVien+ "',ThanhVienCu='"+dto.ThanhVienCu+ "',MaLoaiQuanHe='"+dto.MaLoaiQuanHe+ "',NgayPhatSinh='"+dto.NgayPhatSinh+ "',HoVaTen='"+dto.HoVaTen+ "',GioiTinh='"+dto.GioiTinh+ "',NgayGioSinh='"+dto.NgayGioSinh+ "',MaQueQuan='"+dto.MaQueQuan+ "',MaNgheNghiep='"+dto.MaNgheNghiep+ "',DiaChi='"+dto.DiaChi+ "',Doi='"+dto.Doi+ "',ChaMe='"+dto.ChaMe+ "' WHERE MaThanhVien='"+dto.MaThanhVien+"'"; _provider.executeQuery(query); }
public void Insert(ThanhVienDto dto) { string query = "INSERT INTO THANHVIEN(MaThanhVien,ThanhVienCu,MaLoaiQuanHe,NgayPhatSinh,HoVaTen,GioiTinh,NgayGioSinh,MaQueQuan,MaNgheNghiep,DiaChi,Doi,ChaMe) VALUES ('" + dto.MaThanhVien+"','"+ dto.ThanhVienCu + "','" + dto.MaLoaiQuanHe + "','" + dto.NgayPhatSinh + "','" + dto.HoVaTen + "','" + dto.GioiTinh + "','" + dto.NgayGioSinh + "','" + dto.MaQueQuan + "','" + dto.MaNgheNghiep + "','" + dto.DiaChi + "','" + dto.Doi + "','" + dto.ChaMe + "')"; _provider.executeQuery(query); }