private void xóaToolStripMenuItem_Click(object sender, EventArgs e) { ThanhVien tv = dulieu.ThanhViens.Where(p => p.MaTV == txtMaThanhVien.Text).SingleOrDefault(); if (tv != null) { dulieu.ThanhViens.DeleteOnSubmit(tv); dulieu.SubmitChanges(); load(); } }
private void sửaToolStripMenuItem_Click(object sender, EventArgs e) { ThanhVien tv = dulieu.ThanhViens.Where(p => p.MaTV == txtMaThanhVien.Text).SingleOrDefault(); if (tv != null) { tv.HoTenTVC = //.Text; tv.HoTenTVM = txtThanhVienMoi.Text; tv.QueQuan = cbQuanHe.Text; tv.LoaiQuanHe = cbQuanHe.Text; tv.GioiTinh = cbGioiTinh.Text; tv.NgaySinh = dtNgaySinh.Value; tv.NgayPhatSinh = dtNgayPhatSinh.Value; tv.NgheNghiep = cbnghenghiep.Text; tv.DiaChi = txtdiachi.Text; dulieu.SubmitChanges(); load(); } }
private void gvThanhVien_RowEnter(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = gvThanhVien.Rows[e.RowIndex]; string maThanhVien = row.Cells["MaTV"].Value.ToString(); ThanhVien tv = dulieu.ThanhViens.Where(p => p.MaTV == maThanhVien).SingleOrDefault(); if (tv != null) { txtMaThanhVien.Text = tv.MaTV; txtThanhVienMoi.Text = tv.HoTenTVM; cmbTVC.Text = tv.HoTenTVM; // txtThanhVienCu.Text = tv.HoTenTVC; txtThanhVienMoi.Text = tv.HoTenTVM; txtdiachi.Text = tv.DiaChi; cbGioiTinh.Text = tv.GioiTinh; cbnghenghiep.Text = tv.NgheNghiep; cbQuanHe.Text = tv.LoaiQuanHe; cbQueQuab.Text = tv.QueQuan; dtNgaySinh.Value = tv.NgaySinh.Value; dtNgayPhatSinh.Value = tv.NgayPhatSinh.Value; } }
private void thêmToolStripMenuItem_Click(object sender, EventArgs e) { try{ ThanhVien tv = new ThanhVien(); tv.MaTV = txtMaThanhVien.Text; tv.HoTenTVC = cmbTVC.Text;//txtThanhVienCu.Text; tv.HoTenTVM = txtThanhVienMoi.Text; tv.QueQuan = cbQuanHe.Text; tv.LoaiQuanHe = cbQuanHe.Text; tv.GioiTinh = cbGioiTinh.Text; tv.NgaySinh = dtNgaySinh.Value; tv.NgayPhatSinh = dtNgayPhatSinh.Value; tv.NgheNghiep = cbnghenghiep.Text; tv.DiaChi = txtdiachi.Text; // tv.HinhAnh = pictureBox1.Image; dulieu.ThanhViens.InsertOnSubmit(tv); dulieu.SubmitChanges(); load(); }catch { MessageBox.Show("Mã Thành Viên Không Được Trùng Vui Lòng Nhập Lại", "Thông báo", MessageBoxButtons.OK); } }
partial void DeleteThanhVien(ThanhVien instance);
partial void UpdateThanhVien(ThanhVien instance);
partial void InsertThanhVien(ThanhVien instance);