コード例 #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            TheThuVienDTO theThuVienDTO = new TheThuVienDTO
            {
                SoThe      = txtMaThe.Text,
                NgayBatDau = dtmNgayBD.Value,
                TrangThai  = true
            };

            DocGiaDTO docGiaDTO = new DocGiaDTO
            {
                MaDocGia  = txtMaDocGia.Text,
                TenDocGia = txtTenDocGia.Text,
                CMND      = txtCMND.Text,
                DiaChi    = txtDiaChi.Text,
                SoThe     = txtMaThe.Text,
                TrangThai = true
            };

            if (theThuVienBUS.themTheTV(theThuVienDTO) && docGiaBUS.themDocGia(docGiaDTO))
            {
                MessageBox.Show(Constrant.ThemThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show(Constrant.ThemThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: frmDocGia.cs プロジェクト: BuiDinhDuc/DoAn
        private void btnSua_Click(object sender, EventArgs e)
        {
            DocGiaDTO docGiaDTO = new DocGiaDTO
            {
                MaDocGia  = txtMaDocGia.Text,
                TenDocGia = txtTenDocGia.Text,
                CMND      = txtCMND.Text,
                DiaChi    = txtDiaChi.Text
            };

            TheThuVienDTO theThuVienDTO = new TheThuVienDTO
            {
                SoThe      = txtMaThe.Text,
                NgayBatDau = dtmNgayBD.Value
            };

            if (docgiaBUS.suaDocGia(docGiaDTO) && theThuVienBUS.suaTheTV(theThuVienDTO))
            {
                MessageBox.Show(Constrant.SuaThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmReaders_Load(sender, e);
            }
            else
            {
                MessageBox.Show(Constrant.SuaThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
 public bool suaTheThuVien(TheThuVienDTO theThuVienDTO)
 {
     try
     {
         TheThuVien theThuVien = data.TheThuViens.SingleOrDefault(u => u.SoThe == theThuVienDTO.SoThe && u.TrangThai == true);
         theThuVien.NgayBatDau = theThuVienDTO.NgayBatDau;
         data.SaveChanges();
         return(true);
     } catch (Exception)
     {
         return(false);
     }
 }
コード例 #4
0
        public bool themTheTV(TheThuVienDTO theThuVienDTO)
        {
            try
            {
                TheThuVien theThuVien = new TheThuVien
                {
                    SoThe      = theThuVienDTO.SoThe,
                    NgayBatDau = theThuVienDTO.NgayBatDau,
                    TrangThai  = true
                };

                data.TheThuViens.Add(theThuVien);
                data.SaveChanges();

                return(true);
            } catch (Exception)
            {
                return(false);
            }
        }
コード例 #5
0
 public bool suaTheTV(TheThuVienDTO theThuVienDTO)
 {
     return(theThuVienDAL.suaTheThuVien(theThuVienDTO));
 }
コード例 #6
0
 public bool themTheTV(TheThuVienDTO theThuVienDTO)
 {
     return(theThuVienDAL.themTheTV(theThuVienDTO));
 }