DateSetTableColumnNames
Describes DateSetTableColumnNames in Optimizely Configured Commerce.
Code Sample: JobPostprocessorProcessSubmitResponse Excerpt
protected virtual void ProcessCustomerSubmit(DataSet dataSet)
{
if (dataSet.Tables.Contains("CustomerSubmit"))
{
var customerNumber = dataSet.Tables["CustomerSubmit"].Rows[0]["CustomerNumber"].ToString();
var customerSequence = dataSet.Tables["CustomerSubmit"].Rows[0]["CustomerSequence"].ToString();
var erpCustomerNumber = dataSet.Tables["CustomerSubmit"].Rows[0]["ErpCustomerNumber"].ToString();
var erpCustomerSequence = dataSet.Tables["CustomerSubmit"].Rows[0]["ErpCustomerSequence"].ToString();
// if nothing on the customer table changed, no need to update
if (customerNumber.Equals(erpCustomerNumber, StringComparison.OrdinalIgnoreCase)
&& customerSequence.Equals(erpCustomerSequence, StringComparison.OrdinalIgnoreCase))
{
this.JobLogger.Info(LoggingMessages.CustomerInfoUnchanged.FormatWith(new { customerNumber, customerSequence }));
}
else
{
// find the customer on our tables via the CustomerNumber and CustomerSequence and Update its
// ErpNumber and CustomerSequence to what is returned from the Customer Submit.
var customer = this.UnitOfWork.GetRepository<Customer>().GetTable()
.FirstOrDefault(c => c.CustomerNumber.Equals(customerNumber, StringComparison.OrdinalIgnoreCase)
&& c.CustomerSequence.Equals(customerSequence, StringComparison.OrdinalIgnoreCase));
if (customer == null)
{
this.JobLogger.Info(LoggingMessages.InvalidCustomer.FormatWith(new { customerNumber, customerSequence }));
}
else
{
customer.ErpNumber = erpCustomerNumber;
customer.ErpSequence = erpCustomerSequence;
this.JobLogger.Info(LoggingMessages.UpdatingCustomer.FormatWith(new { customerNumber, customerSequence, erpCustomerNumber, erpCustomerSequence }));
}
}
}
}
All of the tables and column names shown above are used by the JobPostprocessorProcessSubmitResponse postprocessor when processing the response from an order submission. Below is an excerpt from that postprocessor that updates the Customer table within Optimizely Configured Commerce using the customer sequence and number from the ERP response.
Code Sample: Class Example Excerpt
public class Data
{
public static string CustomerSubmitTable = "CustomerSubmit";
public static string OrderSubmitTable = "OrderSubmit";
public static string ErpCustomerNumberColumn = "ErpCustomerNumber";
public static string ErpCustomerSequenceColumn = "ErpCustomerSequence";
// ...
}
Many times integration jobs will use a DataSet to store data in memory. These data sets are used for a variety of purposes, including to load data from Configured Commerce before a job begins and report data back to Configured Commerce from an external system, like an ERP. The processors that operate on this data rely on specific names for the tables and columns within the data sets. Configured Commerce provides a class that holds all of these table and column names so that processors don't need to repeat the same names and reference the correct tables and columns. Below is an excerpt from that class along with a few of the many properties that hold the table and column names.
Updated over 1 year ago