private void bt_CNDL_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tb_TenTacGia.Text)) { MessageBox.Show("Không được để trống thể loại sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_TenTacGia.Focus(); } else { try { TacGiaService sv = new TacGiaService(); TacGiaDtos tdg = new TacGiaDtos(); TenTacGia = HelperGUI.Instance.KiemTraHoTen(tb_TenTacGia.Text); NgaySinh = dt_NgaySinh.Value; tdg.TenTacGia = TenTacGia; tdg.NgaySinh = NgaySinh; sv.AddFormTacGia(tdg); MessageBox.Show("Thêm thành công!"); HelperGUI.ResetAllControls(groupControl_ThemTacGia); } catch { } } }
private void toolStripBt_XuatCSV_Click(object sender, EventArgs e) { try { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "csv File (.csv)|.csv|All files (.)|*.*"; sfd.Title = "Save an Excel File"; sfd.ShowDialog(); string DuongDan; DuongDan = sfd.FileName; List <TacGiaDtos> ls = new List <TacGiaDtos>(); TacGiaService pro = new TacGiaService(); ls = pro.getAllFormTacGia(); DialogResult dlg = MessageBox.Show("Bạn có chắc chắn xuất CSV!!", "Thông báo!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dlg.Equals(DialogResult.OK)) { pro.ExportToCsvFile(ls, DuongDan); MessageBox.Show("Xuất thành công!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch { } }
public void fillAllDataFromTableTacGia() { List <TacGiaDtos> ls = new List <TacGiaDtos>(); TacGiaService TDGsv = new TacGiaService(); ls = TDGsv.getAllFormTacGia(); dgv_DuLieu.DataSource = ls; }
public SachController() { _context = new WebDbContext(); _bookService = new BookService(_context); _nhaXuatBanService = new NhaXuatBanService(_context); _tacGiaService = new TacGiaService(_context); _bookCategoriesService = new BookCategoriesService(_context); }
private void bt_TimKiem_Click(object sender, EventArgs e) { TacGiaService sv = new TacGiaService(); List <TacGiaDtos> ls = new List <TacGiaDtos>(); if (cbb_ThongTinTimKiem.Text == "Họ và tên") { ls = sv.getFormTacGiaSearchTenTacGia(tb_NhapTT.Text); dgv_DuLieu.DataSource = ls; } }
private void bt_CNDL_Click(object sender, EventArgs e) { TacGiaService sv = new TacGiaService(); TacGiaDtos tdg = new TacGiaDtos(); TenTacGia = HelperGUI.Instance.KiemTraHoTen(tb_TenTacGia.Text); NgaySinh = dt_NgaySinh.Value; tdg.TenTacGia = TenTacGia; tdg.NgaySinh = NgaySinh; sv.AddFormTacGia(tdg); MessageBox.Show("Thêm thành công!"); fillAllDataFromTableTacGia(); HelperGUI.ResetAllControls(groupControl_TTTG); }
public TacGiaController() { _context = new WebDbContext(); _tacGiaService = new TacGiaService(_context); }