private void btnSave_Click(object sender, EventArgs e)
        {
            //_sotienthu = 0;
            if (spRemain.Value > 0)
            {
                _sotienthu = spPayment.Value;
            }
            else
            {
                _sotienthu = spMoneyShouldPay.Value;
            }
            m_CashReceiptVoucherObject = new CCashReceiptVoucherDTO("PT00000000",
                                                                    lkCustomerName.EditValue.ToString(),
                                                                    "NV0000001",
                                                                    DateTime.ParseExact(labCRVDateValue.Text, "dd/MM/yyyy", null),
                                                                    (int)_sotienthu);
            m_CashReceiptVoucherExecute.AddCashReceiptVoucherToDatabase(m_CashReceiptVoucherObject);
            //
            decimal _sotienno = 0;

            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.UpdateDebitOfCustomerDataToDatabase(m_CustomerObject);
        }
예제 #2
0
 public bool DeleteCustomerToDatabase(CCustomerDTO _CustomerObject)
 {
     m_cmd             = new SqlCommand();
     m_cmd.CommandType = CommandType.StoredProcedure;
     m_cmd.CommandText = "DeleteCustomerDataToDatabase";
     m_cmd.Parameters.Add("MaKH", SqlDbType.NVarChar).Value = _CustomerObject.maKhachHang;
     return(m_CustomerExecute.updateData(m_cmd) > 0);
 }
예제 #3
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     m_CustomerObject = new CCustomerDTO(txtCustomerId.Text, txtCustomerName.Text, cmbCustomerGender.Text,
                                         dateBirthDay.DateTime, txtCustomerAddress.Text, txtCustomerPhone.Text, txtCustomerEmail.Text, (int)spCustomerDebit.Value);
     m_CustomerExecute.UpdateCustomerToDatabase(m_CustomerObject);
     m_CustomerData             = m_CustomerExecute.getCustomerDataFromDatabase();
     grdListCustomer.DataSource = m_CustomerData;
 }
예제 #4
0
 public frmCustomer()
 {
     InitializeComponent();
     m_CustomerObject         = new CCustomerDTO();
     m_CustomerExecute        = new CCustomerBUS();
     m_CustomerData           = new DataTable();
     m_CustomerMultiSelect    = new GridCheckMarksSelection(grdvListCustomer);
     btnSave.Enabled          = false;
     CustomerSno.VisibleIndex = 1;
 }
예제 #5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     m_CustomerObject = new CCustomerDTO(txtCustomerId.Text, txtCustomerName.Text, cmbCustomerGender.Text,
                                         dateBirthDay.DateTime, txtCustomerAddress.Text, txtCustomerPhone.Text, txtCustomerEmail.Text, 0);
     m_CustomerExecute.AddCustomerToDatabase(m_CustomerObject);
     m_CustomerData             = m_CustomerExecute.getCustomerDataFromDatabase();
     grdListCustomer.DataSource = m_CustomerData;
     //
     btnDelete.Enabled = true;
     btnUpdate.Enabled = true;
     btnCancel.Visible = false;
 }
예제 #6
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     grdvListCustomer.FocusedRowHandle -= 1;
     foreach (DataRowView _rowData in m_CustomerMultiSelect.Selection)
     {
         m_CustomerObject             = new CCustomerDTO();
         m_CustomerObject.maKhachHang = _rowData["MaKH"].ToString();
         m_CustomerExecute.DeleteCustomerToDatabase(m_CustomerObject);
     }
     m_CustomerData             = m_CustomerExecute.getCustomerDataFromDatabase();
     grdListCustomer.DataSource = m_CustomerData;
 }
예제 #7
0
 public frmCustomer()
 {
     InitializeComponent();
     m_CustomerObject         = new CCustomerDTO();
     m_CustomerExecute        = new CCustomerBUS();
     m_CustomerData           = new DataTable();
     m_CustomerMultiSelect    = new GridCheckMarksSelection(grdvListCustomer);
     CustomerSno.VisibleIndex = 1;
     //dateBirthDay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
     //dateBirthDay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
     //dateBirthDay.Properties.Mask.EditMask = "dd/MM/yyyy";
 }
 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);
     }
 }
예제 #9
0
 public bool UpdateCustomerToDatabase(CCustomerDTO _CustomerObject)
 {
     m_cmd             = new SqlCommand();
     m_cmd.CommandType = CommandType.StoredProcedure;
     m_cmd.CommandText = "UpdateCustomerDataToDatabase";
     m_cmd.Parameters.Add("MaKH", SqlDbType.NVarChar).Value          = _CustomerObject.maKhachHang;
     m_cmd.Parameters.Add("TenKH", SqlDbType.NVarChar).Value         = _CustomerObject.tenKhachHang;
     m_cmd.Parameters.Add("GioiTinh", SqlDbType.NVarChar).Value      = _CustomerObject.gioiTinh;
     m_cmd.Parameters.Add("NgaySinh", SqlDbType.SmallDateTime).Value = _CustomerObject.ngaySinh;
     m_cmd.Parameters.Add("DiaChi", SqlDbType.NVarChar).Value        = _CustomerObject.diaChi;
     m_cmd.Parameters.Add("SoDienThoai", SqlDbType.NVarChar).Value   = _CustomerObject.soDienThoai;
     m_cmd.Parameters.Add("Email", SqlDbType.NVarChar).Value         = _CustomerObject.Email;
     m_cmd.Parameters.Add("TienNo", SqlDbType.Money).Value           = _CustomerObject.tienNo;
     return(m_CustomerExecute.updateData(m_cmd) > 0);
 }
예제 #10
0
        public frmDeliveryReport(DataTable _listBook, CCustomerDTO _customerObject, String _deliveryNoteId, decimal _totalAmount, decimal _totalQuantity)
        {
            InitializeComponent();
            rptDeliveryNote _rptDeliveryNote = new rptDeliveryNote();

            _rptDeliveryNote.LoadDataToReport(_customerObject.tenKhachHang,
                                              _customerObject.diaChi,
                                              _totalAmount.ToString(),
                                              _totalQuantity.ToString(),
                                              _deliveryNoteId,
                                              _customerObject.Email,
                                              _customerObject.soDienThoai);
            _rptDeliveryNote.DataSource        = _listBook;
            docDeliveryNoteView.PrintingSystem = _rptDeliveryNote.PrintingSystem;
            _rptDeliveryNote.CreateDocument();
        }
        public frmCashReceiptVoucherReport(CCustomerDTO _customerObject, String _ReceiptNoteId, decimal _totalPayment, String _totalPaymentWord)
        {
            rptCashReceiptVoucher _rptCashReceiptVoucher = new rptCashReceiptVoucher();

            InitializeComponent();
            _rptCashReceiptVoucher.LoadDataToReport(
                _customerObject.tenKhachHang,
                _customerObject.diaChi,
                _totalPayment.ToString(),
                _totalPaymentWord.ToString(),
                _ReceiptNoteId,
                _customerObject.Email,
                _customerObject.soDienThoai);
            docCRVView.PrintingSystem = _rptCashReceiptVoucher.PrintingSystem;
            _rptCashReceiptVoucher.CreateDocument();
        }
예제 #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);
     }
 }
예제 #13
0
 private void btnView_Click(object sender, EventArgs e)
 {
     try
     {
         CCustomerDTO _CustomerObject = new CCustomerDTO();
         DataRowView  _rowValue       = lkCustomerName.Properties.GetDataSourceRowByKeyValue(lkCustomerName.EditValue) as DataRowView;
         _CustomerObject.tenKhachHang = _rowValue["TenKH"].ToString();
         _CustomerObject.diaChi       = _rowValue["DiaChi"].ToString();
         _CustomerObject.Email        = _rowValue["Email"].ToString();
         _CustomerObject.soDienThoai  = _rowValue["SoDienThoai"].ToString();
         //
         frmDeliveryReport m_deliveryReportForm = new frmDeliveryReport(m_DeliveryNoteDetailData,
                                                                        _CustomerObject,
                                                                        _soHoaDon,
                                                                        decimal.Parse(grdvDeliveryBook.Columns["SoLuong"].SummaryItem.SummaryValue.ToString()),
                                                                        decimal.Parse(grdvDeliveryBook.Columns["ThanhTien"].SummaryItem.SummaryValue.ToString()));
         m_deliveryReportForm.ShowDialog();
     }
     catch (System.Exception)
     {
     }
 }
예제 #14
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listCustomerId = new ArrayList();
         grdvListCustomer.FocusedRowHandle -= 1;
         foreach (DataRowView _rowData in m_CustomerMultiSelect.Selection)
         {
             m_CustomerObject             = new CCustomerDTO();
             m_CustomerObject.maKhachHang = _rowData["MaKH"].ToString();
             if (m_CustomerExecute.DeleteCustomerToDatabase(m_CustomerObject))
             {
                 _listCustomerId.Add(_rowData["MaKH"]);
             }
         }
         if (_listCustomerId.Count != 0)
         {
             String _erroContent = "Không thể xóa các khách hàng có mã: \n";
             foreach (var item in _listCustomerId)
             {
                 _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);
     }
 }
예제 #15
0
 public bool DeleteCustomerToDatabase(CCustomerDTO _CustomerObject)
 {
     return(m_CustomerDAL.DeleteCustomerToDatabase(_CustomerObject));
 }
예제 #16
0
 public bool AddCustomerToDatabase(CCustomerDTO _CustomerObject)
 {
     return(m_CustomerDAL.AddCustomerToDatabase(_CustomerObject));
 }
예제 #17
0
 public CCustomerDAL(CCustomerDTO _CustomerObject)
 {
     m_CustomerObject  = _CustomerObject;
     m_CustomerExecute = new CDataExecute();
     m_cmd             = new SqlCommand();
 }
예제 #18
0
 public bool UpdateDebitOfCustomerDataToDatabase(CCustomerDTO _CustomerObject)
 {
     return(m_CustomerDAL.UpdateDebitOfCustomerDataToDatabase(_CustomerObject));
 }
예제 #19
0
 public CCustomerDAL()
 {
     m_CustomerObject  = null;
     m_CustomerExecute = new CDataExecute();
     m_cmd             = new SqlCommand();
 }