Пример #1
0
 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
         {
         }
     }
 }
Пример #2
0
        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
            {
            }
        }
Пример #3
0
        public void fillAllDataFromTableTacGia()
        {
            List <TacGiaDtos> ls    = new List <TacGiaDtos>();
            TacGiaService     TDGsv = new TacGiaService();

            ls = TDGsv.getAllFormTacGia();
            dgv_DuLieu.DataSource = ls;
        }
Пример #4
0
 public SachController()
 {
     _context = new WebDbContext();
     _bookService = new BookService(_context);
     _nhaXuatBanService = new NhaXuatBanService(_context);
     _tacGiaService = new TacGiaService(_context);
     _bookCategoriesService = new BookCategoriesService(_context);
 }
Пример #5
0
        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;
            }
        }
Пример #6
0
        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);
        }
Пример #7
0
 public TacGiaController()
 {
     _context       = new WebDbContext();
     _tacGiaService = new TacGiaService(_context);
 }