Exemple #1
0
            private static NullResponse InsertSalesTransactionTables(InsertSalesTransactionTablesDataRequest request)
            {
                var procedure = new InsertSalesTransactionTablesProcedure(request);

                procedure.Execute();

                return(new NullResponse());
            }
Exemple #2
0
            private static NullResponse InsertSalesTransactionTables(InsertSalesTransactionTablesDataRequest request)
            {
                ParameterSet parameters = new ParameterSet();

                parameters[DatabaseAccessor.ChannelIdVariableName] = request.RequestContext.GetPrincipal().ChannelId;
                parameters["@tvp_Transaction"]                 = request.TransactionTable;
                parameters["@tvp_SalesTrans"]                  = request.LinesTable;
                parameters["@tvp_IncomeExpense"]               = request.IncomeExpenseTable;
                parameters["@tvp_MarkupTrans"]                 = request.MarkupTable;
                parameters["@tvp_PaymentTrans"]                = request.PaymentTable;
                parameters["@tvp_TaxTrans"]                    = request.TaxTable;
                parameters["@tvp_AttributeTrans"]              = request.AttributeTable;
                parameters["@tvp_AddressTrans"]                = request.AddressTable;
                parameters["@tvp_DiscountTrans"]               = request.DiscountTable;
                parameters["@tvp_InfoCodeTrans"]               = request.ReasonCodeTable;
                parameters["@tvp_SalesProperties"]             = request.PropertiesTable;
                parameters["@tvp_RewardPointTrans"]            = request.RewardPointTable;
                parameters["@tvp_AffiliationTrans"]            = request.AffiliationsTable;
                parameters["@tvp_CustomerOrderTrans"]          = request.CustomerOrderTable;
                parameters["@tvp_InvoiceTrans"]                = request.InvoiceTable;
                parameters["@tvp_CustomerAccountDepositTrans"] = request.CustomerAccountDepositTable;

                int errorCode;

                using (var databaseContext = new SqlServerDatabaseContext(request))
                {
                    errorCode = databaseContext.ExecuteStoredProcedureNonQuery("INSERTSALESORDER", parameters);
                }

                if (errorCode != (int)DatabaseErrorCodes.Success)
                {
                    throw new StorageException(StorageErrors.Microsoft_Dynamics_Commerce_Runtime_CriticalStorageError, errorCode, "Unable to save sales order.");
                }

                return(new NullResponse());
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="InsertSalesTransactionTablesProcedure"/> class.
 /// </summary>
 /// <param name="request">The request message.</param>
 public InsertSalesTransactionTablesProcedure(InsertSalesTransactionTablesDataRequest request)
 {
     this.request = request;
 }