Ejemplo n.º 1
0
 private bool checkData()
 {
     if (dateBirthDay.DateTime < DateTime.Now && dateToWork.DateTime <= DateTime.Now)
     {
         if (!m_EmployeeExecute.checkAge(dateBirthDay.DateTime, dateToWork.DateTime))
         {
             dateBirthDay.Focus();
             dateToWork.EditValue   = null;
             dateBirthDay.EditValue = null;
             XtraCustomMessageBox.Show("Độ tuổi không phù hợp với quy định!\nXin vui lòng kiểm tra lại!", "Lỗi", true);
             return(false);
         }
     }
     else
     {
         XtraCustomMessageBox.Show("Ngày sinh hoặc ngày vào làm không thể lớn hơn ngày hiện tại", "Lỗi", true);
         return(false);
     }
     if (CheckInformationEntered.checkDataInput(txtEmployeeName, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtEmployeeAddress, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtEmployeeEmail, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(txtEmployeePhone, "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(cmbEmployeeGender, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(dateToWork, "Dữ liệu không thể để trống", ref dxErrorProvider) &&
         CheckInformationEntered.checkDataInput(lkEmployeeCharge, "Dữ liệu không thể để trống", ref dxErrorProvider))
     {
         return(true);
     }
     return(false);
 }
        private void lkCustomerName_EditValueChanged(object sender, EventArgs e)
        {
            if (lkCustomerName.EditValue != null)
            {
                DevExpress.XtraEditors.LookUpEdit lkCustomer = (sender as DevExpress.XtraEditors.LookUpEdit);
                DataRowView row = lkCustomer.Properties.GetDataSourceRowByKeyValue(lkCustomer.EditValue) as DataRowView;
                if (!m_CashReceiptVoucherExecute.checkDebitsQuantity(lkCustomer.EditValue.ToString()))
                {
                    txtCustomerAddress.Text = row["DiaChi"].ToString();
                    txtCustomerEmail.Text   = row["Email"].ToString();
                    txtCustomerPhone.Text   = row["SoDienThoai"].ToString();
                    spDebitOld.EditValue    = row["TienNo"];
                }
                else
                {
                    lkCustomerName.EditValue = null;
                    txtCRVId.Text            = null;
                    txtCustomerAddress.Text  = null;
                    txtCustomerEmail.Text    = null;
                    txtCustomerPhone.Text    = null;
                    txtPaymentWord.Text      = null;
                    //
                    spDebitOld.EditValue       = 0;
                    spMoneyShouldPay.EditValue = 0;
                    spPayment.EditValue        = 0;
                    spPurchases.EditValue      = 0;
                    spRemain.EditValue         = 0;

                    XtraCustomMessageBox.Show("Khách hàng này không có tiền nợ!\nXin vui lòng chọn khách hàng khác!", "Thông báo", true);
                }
            }
        }
Ejemplo n.º 3
0
 private void frmDeliveryNote_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (m_enableCashReceiptVoucher)
     {
         XtraCustomMessageBox.Show("Bạn chưa lập phiếu thu tiền!\nXin vui lòng lập phiếu thu trước khi thoát!", "Thông", true);
         e.Cancel = true;
     }
 }
 private void frmCashReceiptVoucher_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (m_saveCashReceiptVoucher)
     {
         XtraCustomMessageBox.Show("Dữ liệu chưa được lưu!\nVui lòng lưu dữ liêu trước khi thoát!", "Thông báo", true);
         e.Cancel = true;
     }
 }
Ejemplo n.º 5
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (m_DeliveryNoteDetailData.Rows.Count != 0)
     {
         if (XtraCustomMessageBox.Show("Bạn có muốn hủy bỏ hóa đơn này hay không?", "Thông báo", false) == DialogResult.Yes)
         {
             updateEnableButtonAndResetValueOfControl(ref btnCancel);
             m_DeliveryNoteDetailData.Clear();
         }
     }
 }
Ejemplo n.º 6
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.º 8
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.º 9
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.º 11
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.º 12
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.º 13
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.º 14
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.º 15
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.º 16
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);
 }
 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.º 18
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);
     }
 }
Ejemplo n.º 19
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.º 20
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.º 21
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.º 22
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.º 23
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.º 24
0
 public static DialogResult Show(String Text, String Caption, bool useDefault)
 {
     m_message = new XtraCustomMessageBox();
     m_message.labInfo.Text  = Text;
     m_message.StartPosition = FormStartPosition.CenterParent;
     if (m_message.labInfo.Location.Y + m_message.labInfo.Height > m_message.panelView.Location.Y + m_message.panelView.Height)
     {
         m_message.Height = m_message.Height + m_message.labInfo.Location.Y + m_message.labInfo.Height - m_message.panelView.Location.Y - m_message.panelView.Height;
     }
     m_message.Text = Caption;
     if (useDefault)
     {
         m_message.btnAccept.Location = m_message.btnOK.Location;
         m_message.btnCancel.Visible  = false;
         m_message.btnAccept.Text     = "Vâng";
         //m_message.btnAccept.Location = m_message.btnCancel.Location;
     }
     m_message.btnOK.Visible = false;
     m_message.ShowDialog();
     return(m_result);
 }
Ejemplo n.º 25
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.º 26
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.º 27
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.º 28
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.º 29
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.º 30
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);
     }
 }