Ejemplo n.º 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
         {
         }
     }
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public bool AddFormTacGia(TacGiaDtos tacGia)
 {
     try
     {
         using (var db = new QuanLyThuVienEntities())
         {
             int ID = TacGiaDAO.Instance.IDPlus();
             db.TACGIAs.Add(new TACGIA()
             {
                 IDTacGia  = ID,
                 TenTacGia = tacGia.TenTacGia,
                 NgaySinh  = tacGia.NgaySinh,
             });
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool editFormTacGia(TacGiaDtos tacgia)
 {
     try
     {
         using (var db = new QuanLyThuVienEntities())
         {
             var EditTacGia = (from a in db.TACGIAs
                               where a.IDTacGia.Equals(tacgia.IDTacGia)
                               select a).FirstOrDefault();
             if (EditTacGia == null)
             {
                 return(false);
             }
             EditTacGia.TenTacGia = tacgia.TenTacGia;
             EditTacGia.NgaySinh  = tacgia.NgaySinh;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
 //Edit FormTacGia
 public void editFormTacGia(TacGiaDtos tacgia)
 {
     this._TacGia.editFormTacGia(tacgia);
 }
Ejemplo n.º 6
0
 //Add Form TacGia
 public void AddFormTacGia(TacGiaDtos tacGia)
 {
     this._TacGia.AddFormTacGia(tacGia);
 }