private void btnSave_Click(object sender, EventArgs e) { if (m_DeliveryNoteDetailData.Rows.Count != 0) { m_DeliveryNoteObject = new CDeliveryNoteDTO("HD00000000", lkCustomerName.EditValue.ToString(), DateTime.ParseExact(labDeliveryDateValue.Text, "dd/MM/yyyy", null), "NV0000001", 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); } } } else { XtraMessageBox.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", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool DeleteDeliveryNoteDetailToDatabase(CDeliveryNoteDetailDTO _DeliveryNoteDetailObject) { m_cmd = new SqlCommand(); m_cmd.CommandType = CommandType.StoredProcedure; m_cmd.CommandText = "DeleteDeliveryNoteDetailDataToDatabase"; m_cmd.Parameters.Add("MaHD", SqlDbType.NVarChar).Value = _DeliveryNoteDetailObject.soHoaDon; return(m_DeliveryNoteDetailExecute.updateData(m_cmd) > 0); }
public bool UpdateDeliveryNoteDetailToDatabase(CDeliveryNoteDetailDTO _DeliveryNoteDetailObject) { m_cmd = new SqlCommand(); m_cmd.CommandType = CommandType.StoredProcedure; m_cmd.CommandText = "UpdateDeliveryNoteDetailDataToDatabase"; m_cmd.Parameters.Add("MaHD", SqlDbType.NVarChar).Value = _DeliveryNoteDetailObject.soHoaDon; m_cmd.Parameters.Add("MaSach", SqlDbType.NVarChar).Value = _DeliveryNoteDetailObject.maSach; m_cmd.Parameters.Add("DonGia", SqlDbType.Money).Value = _DeliveryNoteDetailObject.giaBan; m_cmd.Parameters.Add("SoLuong", SqlDbType.Int).Value = _DeliveryNoteDetailObject.soLuong; m_cmd.Parameters.Add("ThanhTien", SqlDbType.Money).Value = _DeliveryNoteDetailObject.thanhTien; return(m_DeliveryNoteDetailExecute.updateData(m_cmd) > 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); } }
public CDeliveryNoteDetailDAL() { m_DeliveryNoteDetailObject = null; m_DeliveryNoteDetailExecute = new CDataExecute(); m_cmd = new SqlCommand(); }
public CDeliveryNoteDetailDAL(CDeliveryNoteDetailDTO _DeliveryNoteDetailObject) { m_DeliveryNoteDetailObject = _DeliveryNoteDetailObject; m_DeliveryNoteDetailExecute = new CDataExecute(); m_cmd = new SqlCommand(); }
public bool UpdateDeliveryNoteDetailToDatabase(CDeliveryNoteDetailDTO _DeliveryNoteDetailObject) { return(m_DeliveryNoteDetailDAL.UpdateDeliveryNoteDetailToDatabase(_DeliveryNoteDetailObject)); }