예제 #1
0
 //Add From "LoaiSach"
 public bool AddFromLoaiSach(LoaiSachDtos LS)
 {
     try
     {
         using (var db = new QuanLyThuVienEntities())
         {
             int ID = LoaiSachDAO.Instance.IDPlus();
             db.LOAISACHes.Add(new LOAISACH()
             {
                 IDLoaiSach  = ID,
                 TenLoaiSach = LS.TenLoaiSach,
             });
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #2
0
 private void bt_CNDL_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tb_ThemTheLoaiSach.Text))
     {
         MessageBox.Show("Không được để trống thể loại sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_ThemTheLoaiSach.Focus();
     }
     else
     {
         try
         {
             LoaiSachService sv  = new LoaiSachService();
             LoaiSachDtos    tdg = new LoaiSachDtos();
             TenLoaiSach     = tb_ThemTheLoaiSach.Text;
             tdg.TenLoaiSach = TenLoaiSach;
             sv.AddFromLoaiSach(tdg);
             MessageBox.Show("Thêm thành công");
             HelperGUI.ResetAllControls(groupControl_ThemTheLoai);
         }
         catch
         {
         }
     }
 }
예제 #3
0
 //add Form "LoaiSach"
 public void AddFromLoaiSach(LoaiSachDtos LS)
 {
     this._LoaiSachBUS.AddFromLoaiSach(LS);
 }