예제 #1
0
 public bool DeleteBookGenreToDatabase(CBookGenreDTO _bookGenreObject)
 {
     m_cmd             = new SqlCommand();
     m_cmd.CommandType = CommandType.StoredProcedure;
     m_cmd.CommandText = "DeleteBookGenreDataToDatabase";
     m_cmd.Parameters.Add("MaTL", SqlDbType.NVarChar).Value = _bookGenreObject.maTheLoai;
     return(m_BookGenreExecute.updateData(m_cmd) > 0);
 }
예제 #2
0
 public frmBookGenre()
 {
     InitializeComponent();
     m_bookGenre                = new CBookGenreDTO();
     m_bookGenreBus             = new CBookGenreBUS();
     m_bookGenreData            = new DataTable();
     m_bookGenreMultiSelectItem = new GridCheckMarksSelection(grdvListBookGenre);
     m_IsAdd         = false;
     btnSave.Enabled = false;
 }
예제 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!CheckInformationEntered.checkDataInput(txtBookGenreName, "Dữ liệu không thể để trống !", ref dxEPBookGenre))
     {
         txtBookGenreName.Focus();
         return;
     }
     try
     {
         DataRow _rowValue = m_bookGenreData.AsEnumerable().FirstOrDefault(tt => tt.Field <string>("TenTL") == txtBookGenreName.Text);
         if (_rowValue != null)
         {
             XtraCustomMessageBox.Show("Dữ liệu đã tồn tại", "Thông báo", true);
             return;
         }
         if (!m_IsAdd)
         {
             m_bookGenre           = new CBookGenreDTO(txtBookGenreName.Text);
             m_bookGenre.maTheLoai = txtBookGenreId.Text;
             if (!m_bookGenreBus.UpdateBookGenreToDatabase(m_bookGenre))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
         }
         else
         {
             m_bookGenre = new CBookGenreDTO("TL0000000", txtBookGenreName.Text);
             if (!m_bookGenreBus.AddBookGenreToDatabase(m_bookGenre))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Không thể lưu!\n", "Thông báo", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
예제 #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (m_bookGenreMultiSelectItem.Selection.Count == 0)
     {
         return;
     }
     try
     {
         ArrayList _listBookObjectInDelibility = new ArrayList();
         foreach (object _rowObjectItem in m_bookGenreMultiSelectItem.Selection)
         {
             grdvListBookGenre.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_bookGenre = new CBookGenreDTO(_rowObjectDetail.Row["MaTL"].ToString(), _rowObjectDetail.Row["TenTL"].ToString());
             if (!m_bookGenreBus.DeleteBookGenreToDatabase(m_bookGenre))
             {
                 _listBookObjectInDelibility.Add(_rowObjectDetail.Row["MaTL"]);
             }
         }
         if (_listBookObjectInDelibility.Count == 0)
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
         else
         {
             String _erroContent = "Không thể xóa thể loại có mã: \n";
             foreach (var item in _listBookObjectInDelibility)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
예제 #5
0
 public CBookGenreDAL()
 {
     m_BookGenreObject  = null;
     m_BookGenreExecute = new CDataExecute();
     m_cmd = new SqlCommand();
 }
예제 #6
0
 public CBookGenreDAL(CBookGenreDTO _bookGenreObject)
 {
     m_BookGenreObject  = _bookGenreObject;
     m_BookGenreExecute = new CDataExecute();
     m_cmd = new SqlCommand();
 }
예제 #7
0
 public bool UpdateBookGenreToDatabase(CBookGenreDTO _bookGenreObject)
 {
     return(m_BookGenreDAL.UpdateBookGenreToDatabase(_bookGenreObject));
 }
예제 #8
0
 public bool AddBookGenreToDatabase(CBookGenreDTO _bookGenreObject)
 {
     return(m_BookGenreDAL.AddBookGenreToDatabase(_bookGenreObject));
 }