Ejemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     if (m_IsAdd)
     {
         try
         {
             m_BookObject = new CBookDTO("SA0000000",
                                         lkBookTitlesName.EditValue.ToString(),
                                         lkPublisherName.EditValue.ToString(),
                                         int.Parse(txtBookRealeaseYear.Text),
                                         0, 0);
             if (m_BookExecute.AddBookToDatabase(m_BookObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
         }
         catch (System.Exception)
         {
             XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
         }
     }
     else
     {
         try
         {
             m_BookObject = new CBookDTO(txtBookId.Text,
                                         lkBookTitlesName.EditValue.ToString(),
                                         lkPublisherName.EditValue.ToString(),
                                         int.Parse(txtBookRealeaseYear.Text),
                                         int.Parse(txtBookPrices.Text), int.Parse(txtBookCount.Text));
             if (!m_BookExecute.UpdateBookToDatabase(m_BookObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
         }
         catch (System.Exception)
         {
         }
     }
     updateEnableButtonAndResetValueOfControl(ref btnSave);
 }
 private void spPayment_Validated(object sender, EventArgs e)
 {
     if (m_CashReceiptVoucherExecute.checkRegulation())
     {
         if (spPayment.Value > spMoneyShouldPay.Value)
         {
             XtraCustomMessageBox.Show("Số tiền thu không được vượt quá số tiền đang nợ!", "Thông báo", true);
             spRemain.EditValue = 0;
             spPayment.Value    = spMoneyShouldPay.Value;
         }
     }
 }
Ejemplo n.º 3
0
 private void ucLogin_Load(object sender, EventArgs e)
 {
     if (m_loginExecute.getEmployeeDataFromDatabase().Rows.Count > 0)
     {
         m_checkTypeLogin = true;
     }
     else
     {
         m_checkTypeLogin = false;
         XtraCustomMessageBox.Show("Chưa có nhân viên nào trong cơ sở dữ liệu.\nVui lòng đăng nhập với tài khoản 'admin'!", "Thông báo!", true);
         txtUser.Text = "admin";
     }
 }
Ejemplo n.º 4
0
 private void bbtnLogOut_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (xtraTabbedMdiManagerMenu.FloatForms.Count != 0)
     {
         XtraCustomMessageBox.Show("Xin vui lòng đóng tất cả các của sổ trước khi đăng xuất!", "Thông báo", true);
     }
     else
     {
         _loginShow(null, null);
         this.Dispose();
         this.Close();
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     //_sotienthu = 0;
     if (lkCustomerName.Text == "")
     {
         XtraCustomMessageBox.Show("Thông tin khách hàng không được trống!", "Thông báo", true);
         return;
     }
     if (spMoneyShouldPay.Value == 0)
     {
         XtraCustomMessageBox.Show("Khách hàng không còn nợ!\nXin vui lòng chọn khách hàng khác!", "Thông báo", true);
         return;
     }
     try
     {
         m_saveCashReceiptVoucher = false;
         _sotienthu = spPayment.Value;
         m_CashReceiptVoucherObject = new CCashReceiptVoucherDTO("PT00000000",
                                                                 lkCustomerName.EditValue.ToString(),
                                                                 ucLogin.m_EmployeeObject.maNhanVien,
                                                                 DateTime.ParseExact(labCRVDateValue.Text, "dd/MM/yyyy", null),
                                                                 (int)_sotienthu);
         m_CashReceiptVoucherExecute.AddCashReceiptVoucherToDatabase(m_CashReceiptVoucherObject);
         //
         if (spRemain.Value < 0)
         {
             _sotienno = -(spRemain.Value);
         }
         m_CustomerObject              = new CCustomerDTO();
         m_CustomerObject.maKhachHang  = lkCustomerName.EditValue.ToString();
         m_CustomerObject.tenKhachHang = lkCustomerName.Text;
         m_CustomerObject.diaChi       = txtCustomerAddress.Text;
         m_CustomerObject.soDienThoai  = txtCustomerPhone.Text;
         m_CustomerObject.Email        = txtCustomerEmail.Text;
         m_CustomerObject.tienNo       = (int)_sotienno;
         m_CustomerExecute.UpdateLiabilitiesDataToDataBase(m_CustomerObject.maKhachHang, (int)_sotienno, DateTime.ParseExact(labCRVDateValue.Text, "dd/MM/yyyy", null));
         if (m_CustomerExecute.UpdateDebitOfCustomerDataToDatabase(m_CustomerObject))
         {
             XtraCustomMessageBox.Show("Lưu dữ liệu thành công!", "Thông báo", true);
             btnView.Enabled = true;
         }
         else
         {
             XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true);
     }
 }
Ejemplo n.º 6
0
 private void btnAddInListBookDetail_Click(object sender, EventArgs e)
 {
     if (lkCustomerName.Text == "")
     {
         XtraCustomMessageBox.Show("Thông tin khách hàng khồng thể để trống!", "Lỗi", true);
         lkCustomerName.Focus();
         return;
     }
     if (spQuantity.Value == 0)
     {
         XtraCustomMessageBox.Show("Số lượng bán phải lớn hơn 0", "Lỗi", true);
         spQuantity.Focus();
         return;
     }
     try
     {
         if (m_DeliveryNoteDetailExecute.checkQuantityDelivery((int)spQuantity.Value, txtBookId.Text))
         {
             DataRow _rowValue = m_DeliveryNoteDetailData.NewRow();
             _rowValue["MaSach"]    = txtBookId.Text;
             _rowValue["TenSach"]   = txtBookName.Text;
             _rowValue["TenTL"]     = txtBookGenre.Text;
             _rowValue["TenNXB"]    = txtPublisherName.Text;
             _rowValue["NhomTG"]    = txtAuthorName.Text;
             _rowValue["SoLuong"]   = spQuantity.Value;
             _rowValue["DonGia"]    = spPrices.Value;
             _rowValue["ThanhTien"] = spAmount.Value;
             if (m_DeliveryNoteDetailData.Rows.Count != 0)
             {
                 if (m_DeliveryNoteDetailData.Rows.Contains(txtBookId.Text))
                 {
                     if (XtraMessageBox.Show("Cuốn sách này đã tồn tại trong danh sách!\nBạn có muốn cập nhật thông tin hay không?",
                                             "Thông báo",
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Warning).Equals(DialogResult.Yes))
                     {
                         m_DeliveryNoteDetailData.Rows.Remove(m_DeliveryNoteDetailData.Rows.Find(txtBookId.Text));
                     }
                     else
                     {
                         return;
                     }
                 }
             }
             m_DeliveryNoteDetailData.Rows.Add(_rowValue);
             grdListDeliveryBook.DataSource = m_DeliveryNoteDetailData;
             updateEnableButtonAndResetValueOfControl(ref btnAddInListBookDetail);
         }
     }
     catch (System.Exception) { }
 }
Ejemplo n.º 7
0
 private void btnAddInListBookDetail_Click(object sender, EventArgs e)
 {
     if (spPrices.Value == 0)
     {
         XtraCustomMessageBox.Show("Giá nhập không hợp lệ!", "Lỗi", true);
         spPrices.Focus();
         return;
     }
     if (!m_ReceiptNoteDetailExecute.checkQuantityReceipt((int)spQuantity.Value, txtBookId.Text))
     {
         spQuantity.EditValue = 0;
         spQuantity.Focus();
         return;
     }
     try
     {
         DataRow _rowValue = m_ReceiptNoteDetailData.NewRow();
         _rowValue["MaSach"]    = txtBookId.Text;
         _rowValue["TenSach"]   = txtBookName.Text;
         _rowValue["TenTL"]     = txtBookGenre.Text;
         _rowValue["TenNXB"]    = txtPublisherName.Text;
         _rowValue["NhomTG"]    = txtAuthorName.Text;
         _rowValue["SoLuong"]   = spQuantity.Value;
         _rowValue["DonGia"]    = spPrices.Value;
         _rowValue["ThanhTien"] = spAmount.Value;
         if (m_ReceiptNoteDetailData.Rows.Count != 0)
         {
             if (m_ReceiptNoteDetailData.Rows.Contains(txtBookId.Text))
             {
                 if (XtraCustomMessageBox.Show("Cuốn sách này đã tồn tại trong danh sách!\nBạn có muốn cập nhật thông tin hay không?", "Thông báo", false).Equals(DialogResult.Yes))
                 {
                     m_ReceiptNoteDetailData.Rows.Remove(m_ReceiptNoteDetailData.Rows.Find(txtBookId.Text));
                 }
                 else
                 {
                     return;
                 }
             }
         }
         m_ReceiptNoteDetailData.Rows.Add(_rowValue);
         grdListReceiptBook.DataSource = m_ReceiptNoteDetailData;
     }
     catch (System.Exception)
     {
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnAddInListBookDetail);
     }
 }
Ejemplo n.º 8
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);
     }
 }
Ejemplo n.º 9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             String _user = createUserName(txtEmployeeName.Text, dateBirthDay.DateTime.ToString());
             String _pass = CodeDTO.getMD5Hash("123456789");
             m_EmployeeObject = new CEmployeeDTO("NV0000000", txtEmployeeName.Text, cmbEmployeeGender.Text,
                                                 dateBirthDay.DateTime, txtEmployeePhone.Text, txtEmployeeAddress.Text, dateToWork.DateTime,
                                                 lkEmployeeCharge.EditValue.ToString(), _user, _pass, txtEmployeeEmail.Text);
             if (m_EmployeeExecute.AddEmployeeToDatabase(m_EmployeeObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
         }
         else
         {
             m_EmployeeObject = new CEmployeeDTO(txtEmployeeId.Text, txtEmployeeName.Text, cmbEmployeeGender.Text,
                                                 dateBirthDay.DateTime, txtEmployeePhone.Text, txtEmployeeAddress.Text,
                                                 dateToWork.DateTime, lkEmployeeCharge.EditValue.ToString(), txtEmployeeName.Text, null, txtEmployeeEmail.Text);
             if (m_EmployeeExecute.UpdateEmployeeToDatabase(m_EmployeeObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
Ejemplo n.º 10
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listBookTitleObjectInDelibility = new ArrayList();
         foreach (object _rowObjectItem in m_BookTitlesMulitSelect.Selection)
         {
             grdvListBookTitles.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_BookTitlesObject             = new CBookTitlesDTO();
             m_BookTitlesObject.maDauSach   = _rowObjectDetail["MaDauSach"].ToString();
             m_AuthorDetailObject           = new CAuthorDetailDTO();
             m_AuthorDetailObject.maDauSach = _rowObjectDetail["MaDauSach"].ToString();
             if (m_AuthorDetailExecute.DeleteAuthorDetailToDatabase(m_AuthorDetailObject))
             {
                 if (!m_BookTitlesExecute.DeleteBookTitlesToDatabase(m_BookTitlesObject))
                 {
                     _listBookTitleObjectInDelibility.Add(_rowObjectDetail["MaDauSach"]);
                 }
             }
             else
             {
                 _listBookTitleObjectInDelibility.Add(_rowObjectDetail["MaDauSach"]);
             }
         }
         if (_listBookTitleObjectInDelibility.Count != 0)
         {
             String _erroContent = "Không thể xóa các cuốn sách có mã: \n";
             foreach (var item in _listBookTitleObjectInDelibility)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraMessageBox.Show(_erroContent);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 11
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (m_DeliveryNoteDetailData.Rows.Count != 0)
     {
         if (!m_Saved)
         {
             if (XtraCustomMessageBox.Show("Dữ liệu chưa được lưu!\nBạn có muốn lưu dữ liệu trước khi tạo mới hay không?", "Thông báo", false) == DialogResult.Yes)
             {
                 btnWrite_Click(null, null);
             }
         }
         m_DeliveryNoteDetailData.Rows.Clear();
         grdListDeliveryBook.DataSource = m_DeliveryNoteDetailData;
     }
     updateEnableButtonAndResetValueOfControl(ref btnAdd);
 }
Ejemplo n.º 12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             m_CustomerObject = new CCustomerDTO("KH0000000", txtCustomerName.Text, cmbCustomerGender.Text,
                                                 dateBirthDay.DateTime, txtCustomerAddress.Text,
                                                 txtCustomerPhone.Text, txtCustomerEmail.Text, 0);
             if (m_CustomerExecute.AddCustomerToDatabase(m_CustomerObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
         }
         else
         {
             m_CustomerObject = new CCustomerDTO(txtCustomerId.Text, txtCustomerName.Text, cmbCustomerGender.Text,
                                                 dateBirthDay.DateTime, txtCustomerAddress.Text, txtCustomerPhone.Text,
                                                 txtCustomerEmail.Text, (int)spCustomerDebit.Value);
             if (m_CustomerExecute.UpdateCustomerToDatabase(m_CustomerObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
 private void addDecentralization()
 {
     try
     {
         if (m_DecentralizationExecute.AddDecentralizationToDatabase(m_DecentralizationObj))
         {
             InitDecentralizationObect(m_DecentralizationObj.maChucVu);
         }
         else
         {
             XtraCustomMessageBox.Show("Thêm mới thất bại!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
     }
 }
Ejemplo n.º 14
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!CheckInformationEntered.checkDataInput(txtChargeName, "Không thể để trống dữ liệu!", ref dxErrorProvider))
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             m_Charge = new CChargeDTO("CV0000000", txtChargeName.Text);
             if (m_ChargeBus.AddChargeToDatabase(m_Charge))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
         }
         else
         {
             m_Charge          = new CChargeDTO(txtChargeId.Text, txtChargeName.Text);
             m_Charge.maChucVu = txtChargeId.Text;
             if (m_ChargeBus.UpdateChargeToDatabase(m_Charge))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu thất bại", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
Ejemplo n.º 15
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);
     }
 }
Ejemplo n.º 16
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             m_AuthorObject = new CAuthorDTO("TG000000", txtAuthorName.Text, txtAuthorAddress.Text);
             if (m_AuthorExecute.AddAuthorToDatabase(m_AuthorObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
         }
         else
         {
             m_AuthorObject = new CAuthorDTO(txtAuthorId.Text, txtAuthorName.Text, txtAuthorAddress.Text);
             if (m_AuthorExecute.UpdateAuthorToDatabase(m_AuthorObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
         }
     }
     catch (System.Exception ex)
     {
         XtraMessageBox.Show(ex.ToString(), "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
Ejemplo n.º 17
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             m_PublisherObject = new CPublisherDTO("NXB000000", txtPublisherName.Text, txtPublisherAddress.Text);
             if (m_PublisherExecute.AddPublisherToDatabase(m_PublisherObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công !", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại !", "Lỗi", true);
             }
         }
         else
         {
             m_PublisherObject = new CPublisherDTO(txtPublisherId.Text, txtPublisherName.Text, txtPublisherAddress.Text);
             if (m_PublisherExecute.UpdatePublisherToDatabase(m_PublisherObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công !", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại !", "Lỗi", true);
             }
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }
Ejemplo n.º 18
0
 private bool checkData()
 {
     if (dateBirthDay.DateTime >= DateTime.Now)
     {
         XtraCustomMessageBox.Show("Ngày sinh không thể lớn hơn ngày hiện tại", "Lỗi", true);
         dateBirthDay.Focus();
         return(false);
     }
     if (CheckInformationEntered.checkDataInput(txtCustomerName, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtCustomerAddress, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtCustomerEmail, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtCustomerPhone, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(dateBirthDay, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(cmbCustomerGender, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(spCustomerDebit, "Dữ liệu không thể để trống", ref dxErrorProvider))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 19
0
 private bool checkData()
 {
     try
     {
         if (int.Parse(txtBookRealeaseYear.Text) > DateTime.Now.Year)
         {
             XtraCustomMessageBox.Show("Năm xuất bản không thể lớn hơn năm hiện tại", "Lỗi", true);
             txtBookRealeaseYear.ResetText();
             txtBookRealeaseYear.Focus();
             return(false);
         }
     }
     catch (System.Exception) { }
     if (CheckInformationEntered.checkDataInput(lkBookTitlesName, "Dữ liệu không được để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(lkPublisherName, "Dữ liệu không được để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtBookRealeaseYear, "Dữ liệu không được để trống", ref dxErrorProvider))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 20
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listBookObject = new ArrayList();
         foreach (object _rowObjectItem in m_BookMultiSelect.Selection)
         {
             grdvListBook.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_BookObject        = new CBookDTO();
             m_BookObject.maSach = _rowObjectDetail["MaSach"].ToString();
             //m_BookObject = new CBookDTO(txtBookId.Text, lkBookTitlesName.EditValue.ToString(), lkPublisherName.EditValue.ToString(), (int)spBookRealeaseYear.Value, spBookPrices.Value, (int)spBookCount.Value);
             if (!m_BookExecute.DeleteBookToDatabase(m_BookObject))
             {
                 _listBookObject.Add(_rowObjectDetail.Row["MaSach"]);
             }
         }
         if (_listBookObject.Count != 0)
         {
             String _erroContent = "Không thể xóa các cuốn sách có mã sau: \n";
             foreach (var item in _listBookObject)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại!", "Thông báo", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 21
0
 private void btnWrite_Click(object sender, EventArgs e)
 {
     try
     {
         if (m_DeliveryNoteDetailData.Rows.Count != 0)
         {
             m_DeliveryNoteObject = new CDeliveryNoteDTO("HD00000000", lkCustomerName.EditValue.ToString(),
                                                         DateTime.ParseExact(labDeliveryDateValue.Text, "dd/MM/yyyy", null), ucLogin.m_EmployeeObject.maNhanVien,
                                                         int.Parse(grdvDeliveryBook.Columns["SoLuong"].SummaryItem.SummaryValue.ToString()),
                                                         int.Parse(grdvDeliveryBook.Columns["ThanhTien"].SummaryItem.SummaryValue.ToString()));
             _soHoaDon = m_DeliveryNoteExecute.getDeliveryNoteMaxIdFromDatabase();
             if (m_DeliveryNoteExecute.AddDeliveryNoteToDatabase(m_DeliveryNoteObject))
             {
                 foreach (DataRow _rowValue in m_DeliveryNoteDetailData.Select())
                 {
                     m_DeliveryNoteDetailObject           = new CDeliveryNoteDetailDTO();
                     m_DeliveryNoteDetailObject.soHoaDon  = _soHoaDon;
                     m_DeliveryNoteDetailObject.maSach    = _rowValue["MaSach"].ToString();
                     m_DeliveryNoteDetailObject.soLuong   = int.Parse(_rowValue["SoLuong"].ToString());
                     m_DeliveryNoteDetailObject.thanhTien = int.Parse(_rowValue["ThanhTien"].ToString());
                     m_DeliveryNoteDetailObject.giaBan    = int.Parse(_rowValue["DonGia"].ToString());
                     m_DeliveryNoteDetailExecute.AddDeliveryNoteDetailToDatabase(m_DeliveryNoteDetailObject);
                 }
             }
             updateEnableButtonAndResetValueOfControl(ref btnWrite);
             m_enableCashReceiptVoucher = true;
             XtraCustomMessageBox.Show("Ghi dữ liệu thành công!", "Thông báo", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Không có cuốn sách nào được bán!\nXin vui lòng kiểm tra lại",
                                       "Thông báo",
                                       true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Không thể ghi dữ liệu!", "Lỗi", true);
     }
 }
Ejemplo n.º 22
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         System.Collections.ArrayList _listAuthorObjectInDelibility = new System.Collections.ArrayList();
         foreach (object _rowObjectItem in m_AuthorMulitSelect.Selection)
         {
             grdvListAuthor.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_AuthorObject = new CAuthorDTO(_rowObjectDetail.Row["MaTG"].ToString(), _rowObjectDetail.Row["TenTG"].ToString(), _rowObjectDetail.Row["DiaChi"].ToString());
             if (!m_AuthorExecute.DeleteAuthorToDatabase(m_AuthorObject))
             {
                 _listAuthorObjectInDelibility.Add(_rowObjectDetail.Row["MaTG"]);
             }
         }
         String _erroContent = "Không thể xóa thông tin các tác giả có mã số: \n";
         if (_listAuthorObjectInDelibility.Count != 0)
         {
             foreach (var item in _listAuthorObjectInDelibility)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 23
0
 private void btnWrite_Click(object sender, EventArgs e)
 {
     try
     {
         if (m_ReceiptNoteDetailData.Rows.Count != 0)
         {
             m_ReceiptNoteObject = new CReceiptNoteDTO("PN00000000",
                                                       DateTime.ParseExact(labReceiptDateValue.Text, "dd/MM/yyyy", null),
                                                       ucLogin.m_EmployeeObject.maNhanVien,
                                                       int.Parse(grdvReceiptBook.Columns["SoLuong"].SummaryItem.SummaryValue.ToString()),
                                                       int.Parse(grdvReceiptBook.Columns["ThanhTien"].SummaryItem.SummaryValue.ToString()));
             if (m_ReceiptNoteExecute.AddReceiptNoteToDatabase(m_ReceiptNoteObject))
             {
                 _maPhieuNhap = m_ReceiptNoteExecute.getReceiptNoteMaxIdFromDatabase();
                 foreach (DataRow _rowValue in m_ReceiptNoteDetailData.Select())
                 {
                     m_ReceiptNoteDetailObject             = new CReceiptNoteDetailDTO();
                     m_ReceiptNoteDetailObject.maPhieuNhap = _maPhieuNhap;
                     m_ReceiptNoteDetailObject.maSach      = _rowValue["MaSach"].ToString();
                     m_ReceiptNoteDetailObject.soLuong     = int.Parse(_rowValue["SoLuong"].ToString());
                     m_ReceiptNoteDetailObject.thanhTien   = int.Parse(_rowValue["ThanhTien"].ToString());
                     m_ReceiptNoteDetailObject.giaNhap     = int.Parse(_rowValue["DonGia"].ToString());
                     m_ReceiptNoteDetailExecute.AddReceiptNoteDetailToDatabase(m_ReceiptNoteDetailObject);
                 }
             }
             updateEnableButtonAndResetValueOfControl(ref btnWrite);
             XtraCustomMessageBox.Show("Ghi dữ liệu thành công!", "Thông báo", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Không có cuốn sách nào được nhập!\nXin vui lòng kiểm tra lại", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Không thể ghi dữ liệu!", "Lỗi", true);
     }
 }
Ejemplo n.º 24
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listEmployeeId = new ArrayList();
         grdvListEmployee.FocusedRowHandle -= 1;
         foreach (DataRowView _rowData in m_EmployeeMultiSelect.Selection)
         {
             m_EmployeeObject            = new CEmployeeDTO();
             m_EmployeeObject.maNhanVien = _rowData["MaNV"].ToString();
             if (m_EmployeeExecute.DeleteEmployeeToDatabase(m_EmployeeObject))
             {
                 _listEmployeeId.Add(_rowData["MaNV"]);
             }
         }
         if (_listEmployeeId.Count != 0)
         {
             String _erroContent = "Không thể xóa các nhân viên có mã: \n";
             foreach (var item in _listEmployeeId)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 25
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listPublisherId = new ArrayList();
         foreach (object _rowObjectItem in m_PublisherMulitSelect.Selection)
         {
             grdvListPublisher.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_PublisherObject = new CPublisherDTO(_rowObjectDetail.Row["MaNXB"].ToString(), _rowObjectDetail.Row["TenNXB"].ToString(), _rowObjectDetail.Row["DiaChi"].ToString());
             if (!m_PublisherExecute.DeletePublisherToDatabase(m_PublisherObject))
             {
                 _listPublisherId.Add(_rowObjectDetail.Row["MaNXB"]);
             }
         }
         if (_listPublisherId.Count != 0)
         {
             String _erroContent = "Không thể xóa các nhà xuất bản có mã: \n";
             foreach (var item in _listPublisherId)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 26
0
 //Xóa thông tin của thể loại
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _litsAuthorID = new ArrayList();
         foreach (object _rowObjectItem in m_ChargeMultiSelectItem.Selection)
         {
             grdvListCharge.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             m_Charge = new CChargeDTO(_rowObjectDetail.Row["MaCV"].ToString(), _rowObjectDetail.Row["TenCV"].ToString());
             if (!m_ChargeBus.DeleteChargeToDatabase(m_Charge))
             {
                 _litsAuthorID.Add(_rowObjectDetail.Row["MaCV"]);
             }
         }
         if (_litsAuthorID.Count != 0)
         {
             String _erroContent = "Không thể xóa các thể loại có mã: \n";
             foreach (var item in _litsAuthorID)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
Ejemplo n.º 27
0
 //Login neu chua co nhan vien nao trong co so du lieu
 private void loginWithAdmin(String _userName, String _passWord)
 {
     if (_userName.Equals("admin"))
     {
         if (_passWord.Equals("123456789"))
         {
             m_EmployeeObject.maNhanVien  = "NV0000000";
             m_EmployeeObject.tenNhanVien = "Admin";
             m_EmployeeObject.gioiTinh    = "";
             m_EmployeeObject.ngaySinh    = DateTime.Now;
             m_EmployeeObject.email       = "*****@*****.**";
             m_EmployeeObject.soDienThoai = "0993379109";
             m_EmployeeObject.diaChi      = "HCM city";
             m_EmployeeObject.ngayVaoLam  = DateTime.Now;
             m_EmployeeObject.maChucVu    = "CV0000003";
             m_EmployeeObject.tenDangNhap = "admin";
             m_EmployeeObject.matKhau     = "123456789";
             //
             frmMain _frmMain = new frmMain();
             _frmMain.WindowState = FormWindowState.Maximized;
             _frmMain.Show();
             _frmMain._loginShow = new frmMain.showLogin(loginShow);
             _loginHide();
         }
         else
         {
             txtPass.Text = null;
             XtraCustomMessageBox.Show("Sai mật khẩu. Vui lòng nhập lại!", "Thông báo", true);
         }
     }
     else
     {
         txtUser.Text = null;
         txtPass.Text = null;
         XtraCustomMessageBox.Show("Tên đăng nhập không đúng. Vui lòng nhập lại!", "Thông báo", true);
     }
 }
Ejemplo n.º 28
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!checkData())
     {
         return;
     }
     try
     {
         if (m_IsAdd)
         {
             m_BookTitlesObject = new CBookTitlesDTO("DS0000000", lkBookGenreName.EditValue.ToString(), txtBookTitlesName.Text);
             if (m_BookTitlesExecute.AddBookTitlesToDatabase(m_BookTitlesObject))
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true);
             }
             foreach (CheckedListBoxItem _authorName in chkCmbAuthorName.Properties.Items)
             {
                 if (_authorName.CheckState == CheckState.Checked)
                 {
                     m_AuthorDetailObject = new CAuthorDetailDTO(m_BookTitlesExecute.getBookTitlesMaxIdFromDatabase(),
                                                                 _authorName.Value.ToString());
                     m_AuthorDetailExecute.AddAuthorDetailToDatabase(m_AuthorDetailObject);
                 }
             }
         }
         else
         {
             m_BookTitlesObject = new CBookTitlesDTO(txtBookTitlesId.Text,
                                                     lkBookGenreName.EditValue.ToString(), txtBookTitlesName.Text);
             if (m_BookTitlesExecute.UpdateBookTitlesToDatabase(m_BookTitlesObject))
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true);
             }
             else
             {
                 XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true);
             }
             _listAuthorNameSecond = new ArrayList(chkCmbAuthorName.EditValue.ToString().Split(new string[] { ", " }, StringSplitOptions.None));
             foreach (object item in _listAuthorNameFirst)
             {
                 if (!_listAuthorNameSecond.Contains(item))
                 {
                     m_AuthorDetailExecute.DeleteAuthorDetailToDatabase(new CAuthorDetailDTO(txtBookTitlesId.Text, item.ToString()));
                 }
             }
             foreach (object item in _listAuthorNameSecond)
             {
                 if (!_listAuthorNameFirst.Contains(item))
                 {
                     m_AuthorDetailExecute.AddAuthorDetailToDatabase(new CAuthorDetailDTO(txtBookTitlesId.Text, item.ToString()));
                 }
             }
         }
         //m_AuthorDetailObject = new CAuthorDetailDTO(m_BookTitlesExecute.getBookTitlesMaxIdFromDatabase(),chkCmbAuthorName.)
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Lưu dữ liệu thất bại", "Thông báo", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnSave);
     }
 }