public void LapTheDocGia(TheDocGia TheDocGia) { Data.LapPhieu Temp = new Data.LapPhieu(); Data.DocGia Temp2 = new Data.DocGia(); Temp.IdNguoiLap = TheDocGia.IdNguoiLap; Temp.MaPhieu = TheDocGia.MaVe; Temp2.IdDocGia = TheDocGia.IdDocGia; Temp2.TenDocGia = TheDocGia.HoTen; Temp2.NgaySinh = TheDocGia.NgaySinh; Temp2.CMND = TheDocGia.CMND; Temp2.GioiTinh = TheDocGia.GioiTinh; Temp2.DiaChi = TheDocGia.DiaChi; Temp2.SDT = TheDocGia.Phone; Temp2.Email = TheDocGia.Mail; Temp2.LoaiDocGia = TheDocGia.LoaiDocGia; Temp2.NgayLap = TheDocGia.NgayLapThe; Temp2.MaPhieu = TheDocGia.MaVe; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.LapPhieus.InsertOnSubmit(Temp); KetNoi.DocGias.InsertOnSubmit(Temp2); KetNoi.SubmitChanges(); }
// private void LapTheDocGia_Load(object sender, EventArgs e) { Class.XuLyThuVien KiemTra = new Class.XuLyThuVien(); Class.TheDocGia The = KiemTra.InfoPhieuDocGia(IdDocGia_FormMain); txtHoTen.Text = The.HoTen; txtEmail.Text = The.Mail; txtDiaChi.Text = The.DiaChi; ntxtCMND.Text = The.CMND; ntxtPhone.Text = The.Phone; if (The.GioiTinh == "Nam") { rdNam.Checked = true; } else { rdNu.Checked = true; } dateTimePicker1.Value = DateTime.Parse(The.NgaySinh); lblGiaTriThe.Text = string.Format("Thẻ Có Giá Trị {0} Tháng Kể Từ Ngày Lập Thẻ", GiaTriThe); lblMaThe.Text = The.MaVe; lblNgayLap.Text = The.NgayLapThe; }
// public TheDocGia InfoPhieuDocGia(int IdDocGia) { TheDocGia Temp = new TheDocGia(); KetNoi = new Data.QuanLyThuVienDataContext(); //LayTen Temp.HoTen = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.TenDocGia).Single(); //LayGioiTinh Temp.GioiTinh = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.GioiTinh).Single(); //LayNgaySinh Temp.NgaySinh = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.NgaySinh).Single(); //LayDienThoai Temp.Phone = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.SDT).Single(); //LayDiaChi Temp.DiaChi = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.DiaChi).Single(); //LayCMND Temp.CMND = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.CMND).Single(); //LayMail Temp.Mail = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.Email).Single(); //LayNgayLap Temp.NgayLapThe = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.NgayLap).Single(); //LayMaPhieu Temp.MaVe = (from linq in KetNoi.DocGias where linq.IdDocGia == IdDocGia select linq.MaPhieu).Single(); return(Temp); }
// public void SuaTheDocGia(TheDocGia TheDocGia, int IdDocGia) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.DocGia Temp2 = new Data.DocGia(); Temp2 = KetNoi.DocGias.Where(s => s.IdDocGia == IdDocGia).Single(); Temp2.TenDocGia = TheDocGia.HoTen; Temp2.NgaySinh = TheDocGia.NgaySinh; Temp2.CMND = TheDocGia.CMND; Temp2.GioiTinh = TheDocGia.GioiTinh; Temp2.DiaChi = TheDocGia.DiaChi; Temp2.SDT = TheDocGia.Phone; Temp2.Email = TheDocGia.Mail; Temp2.LoaiDocGia = TheDocGia.LoaiDocGia; KetNoi.SubmitChanges(); }
private void btnDatThe_Click(object sender, EventArgs e) { Visible_Sao(); if (Compelete() == false) { } else if ((DateTime.Now.Year - dateTimePicker1.Value.Year) <= TuoiMuonSach) { MetroFramework.MetroMessageBox.Show(this, "Độc Giả Chưa Đủ Độ Tuổi Mượn Sách", "Không Được Phép", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (MetroFramework.MetroMessageBox.Show(this, "Chắc Chắn Hay Không", "Bạn Muốn Sửa Thẻ Này", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Class.TheDocGia The = new Class.TheDocGia(); The.HoTen = txtHoTen.Text; The.DiaChi = txtDiaChi.Text; The.Phone = ntxtPhone.Text; The.NgaySinh = dateTimePicker1.Text.ToString(); if (rdNam.Checked == true) { The.GioiTinh = "Nam"; } else { The.GioiTinh = "Nữ"; } The.Mail = txtEmail.Text; The.CMND = ntxtCMND.Text; The.LoaiDocGia = txtLoaiDocGia.Text; The.MaVe = lblMaThe.Text; The.NgayLapThe = lblNgayLap.Text; Class.XuLyThuVien KiemTra = new Class.XuLyThuVien(); KiemTra.SuaTheDocGia(The, IdDocGia_FormMain); MetroFramework.MetroMessageBox.Show(this, string.Format("Sửa Thẻ Thành Công Cho Độc Giả :{0} ", The.HoTen)); this.Close(); } }