📄 datamodule1.java
字号:
* @param variant Variant
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void productDataSet_editError(DataSet dataSet, Column column, Variant variant, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during adding.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void productDataSet_addError(DataSet dataSet, ReadWriteRow readWriteRow, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during updating.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void productDataSet_updateError(DataSet dataSet, ReadWriteRow readWriteRow, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
// Customer DataSet EditEvents
/**
* Before adding a new customer record, get the Order ID from the
* Server. We want the ID upfront for the Order Item records.
* Also, copy the customer info into the ShipTo info for the
* customer if the ShipName column is NULL.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @throws Exception exception
*
*/
void customerDataSet_adding(DataSet dataSet, ReadWriteRow readWriteRow) throws Exception{
validateCustomerRow();
// Call the stored procedure to get a new Customer ID
int customerID = getNextCustomerID();
readWriteRow.setInt("ID", customerID);
// Copy customer info into shipto info columns
if (readWriteRow.isNull("SHIPNAME")) {
String custName = formatCustomerName( readWriteRow.getString("FIRSTNAME"),
readWriteRow.getString("MI"),
readWriteRow.getString("LASTNAME") );
readWriteRow.setString("SHIPNAME", custName);
readWriteRow.setString("SHIPADDR1", readWriteRow.getString("ADDR1"));
readWriteRow.setString("SHIPADDR2", readWriteRow.getString("ADDR2"));
readWriteRow.setString("SHIPCITY", readWriteRow.getString("CITY"));
readWriteRow.setString("SHIPSTATE", readWriteRow.getString("STATE"));
readWriteRow.setString("SHIPPOSTALCODE", readWriteRow.getString("POSTALCODE"));
readWriteRow.setString("SHIPCOUNTRY", readWriteRow.getString("COUNTRY"));
}
}
/**
* Method to get the next customer ID. This calls a stored procedure on the
* database server spNextCustomerID that returns a single row with the next
* Customer ID generated by the server.
*
* @throws Exception exception
* @return int
*/
private int getNextCustomerID() throws Exception {
int result = 0;
try {
nextCustomerIDDataSet.open();
nextCustomerIDDataSet.refresh();
result = nextCustomerIDDataSet.getInt("NEXTID");
nextCustomerIDDataSet.close();
}
catch (Exception ex) {
ex.printStackTrace();
throw ex;
}
return result;
}
/**
* Before updating a customer row, do row-level validation.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param readRow ReadRow
* @throws Exception exception
*
*/
void customerDataSet_updating(DataSet dataSet, ReadWriteRow readWriteRow, ReadRow readRow) throws Exception{
validateCustomerRow();
}
/**
* Before deleting a Customer record, prompt the user to confirm delete.
* @param dataSet DataSet
* @throws Exception exception
*
*/
void customerDataSet_deleting(DataSet dataSet) throws Exception{
confirmDelete(res.getString("DM_Delete_this_customer?"));
}
/**
* When a new record is added, resolve new record to the database.
* @param dataSet DataSet
* @throws DataSetException datasetexception
*
*/
void customerDataSet_added(DataSet dataSet) throws DataSetException{
dataSet.saveChanges();
}
/**
* When a record is updated, resolve updated record to the database.
* @param dataSet DataSet
* @throws DataSetException datasetexception
*
*/
void customerDataSet_updated(DataSet dataSet) throws DataSetException{
dataSet.saveChanges();
}
/**
* When a record is deleted, resolve to the database.
* @param dataSet DataSet
* @throws DataSetException datasetexception
*
*/
void customerDataSet_deleted(DataSet dataSet) throws DataSetException{
dataSet.saveChanges();
}
/**
* When canceling an edit or insert, clear the messages from
* all status bar controls
* @param dataSet DataSet
* @throws Exception exception
*
*/
void customerDataSet_canceling(DataSet dataSet) throws Exception{
dataSet.clearStatus();
}
/**
* Show an error dialog if error occurs during editing.
* @param dataSet DataSet
* @param column Column
* @param variant Variant
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void customerDataSet_editError(DataSet dataSet, Column column, Variant variant, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during adding.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void customerDataSet_addError(DataSet dataSet, ReadWriteRow readWriteRow, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during updating.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void customerDataSet_updateError(DataSet dataSet, ReadWriteRow readWriteRow, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
// Order DataSet EditEvents
/**
* When adding a new order record, get the Order ID from the
* Server. We want the ID upfront for the Order Item records.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @throws Exception exception
*
*/
void orderDataSet_adding(DataSet dataSet, ReadWriteRow readWriteRow) throws Exception{
validateOrderRow();
// call the stored procedure to get a new Order ID
int orderID = getNextOrderID();
readWriteRow.setInt("ID", orderID);
}
/**
* Method to get the next order ID. This calls a stored procedure on the
* database server spNextOrderID that returns a single row with the next Order
* ID generated by the server.
*
* @throws Exception exception
* @return int
*/
private int getNextOrderID() throws Exception {
int result = 0;
try {
nextOrderIDDataSet.open();
nextOrderIDDataSet.refresh();
result = nextOrderIDDataSet.getInt("NEXTID");
nextOrderIDDataSet.close();
}
catch (Exception ex) {
ex.printStackTrace();
throw ex;
}
return result;
}
/**
* Before updating an order row, do row-level validation.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param readRow ReadRow
* @throws Exception exception
*
*/
void orderDataSet_updating(DataSet dataSet, ReadWriteRow readWriteRow, ReadRow readRow) throws Exception{
validateOrderRow();
}
/**
* When canceling an edit or insert, clear the messages from
* all status bar controls
* @param dataSet DataSet
* @throws Exception exception
*
*/
void orderDataSet_canceling(DataSet dataSet) throws Exception{
dataSet.clearStatus();
}
/**
* Before deleting an Order record, prompt the user to confirm delete.
* @param dataSet DataSet
* @throws Exception exception
*
*/
void orderDataSet_deleting(DataSet dataSet) throws Exception{
confirmDelete(res.getString("DM_Delete_this_order?"));
}
/**
* Show an error dialog if error occurs during editing.
* @param dataSet DataSet
* @param column Column
* @param variant Variant
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void orderDataSet_editError(DataSet dataSet, Column column, Variant variant, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during adding.
* @param dataSet DataSet
* @param readWriteRow ReadWriteRow
* @param dataSetException DataSetException
* @param errorResponse ErrorResponse
* @throws DataSetException datasetexception
*
*/
void orderDataSet_addError(DataSet dataSet, ReadWriteRow readWriteRow, DataSetException dataSetException, ErrorResponse errorResponse) throws DataSetException{
showErrorMsg(dataSetException.getMessage());
}
/**
* Show an error dialog if error occurs during updating.
* @param dataSet DataSet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -