Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.OrderTableAdapters.OrdersTableAdapter.Insert C# (CSharp) Method

Insert() private method

private Insert ( string CustomerID, global EmployeeID, global OrderDate, global RequiredDate, global ShippedDate, global ShipVia, global Freight, string ShipName, string ShipAddress, string ShipCity, string ShipRegion, string ShipPostalCode, string ShipCountry, global CreateID, string CreateUser, global ModifyID, string ModifyUser ) : int
CustomerID string
EmployeeID global
OrderDate global
RequiredDate global
ShippedDate global
ShipVia global
Freight global
ShipName string
ShipAddress string
ShipCity string
ShipRegion string
ShipPostalCode string
ShipCountry string
CreateID global
CreateUser string
ModifyID global
ModifyUser string
return int
        public virtual int Insert(
                    string CustomerID, 
                    global::System.Nullable<int> EmployeeID, 
                    global::System.Nullable<global::System.DateTime> OrderDate, 
                    global::System.Nullable<global::System.DateTime> RequiredDate, 
                    global::System.Nullable<global::System.DateTime> ShippedDate, 
                    global::System.Nullable<int> ShipVia, 
                    global::System.Nullable<decimal> Freight, 
                    string ShipName, 
                    string ShipAddress, 
                    string ShipCity, 
                    string ShipRegion, 
                    string ShipPostalCode, 
                    string ShipCountry, 
                    global::System.Nullable<int> CreateID, 
                    string CreateUser, 
                    global::System.Nullable<int> ModifyID, 
                    string ModifyUser) {
            if ((CustomerID == null)) {
                this.Adapter.InsertCommand.Parameters[0].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[0].Value = ((string)(CustomerID));
            }
            if ((EmployeeID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[1].Value = ((int)(EmployeeID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value;
            }
            if ((OrderDate.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[2].Value = ((System.DateTime)(OrderDate.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value;
            }
            if ((RequiredDate.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[3].Value = ((System.DateTime)(RequiredDate.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[3].Value = global::System.DBNull.Value;
            }
            if ((ShippedDate.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[4].Value = ((System.DateTime)(ShippedDate.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[4].Value = global::System.DBNull.Value;
            }
            if ((ShipVia.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[5].Value = ((int)(ShipVia.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value;
            }
            if ((Freight.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[6].Value = ((decimal)(Freight.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value;
            }
            if ((ShipName == null)) {
                this.Adapter.InsertCommand.Parameters[7].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[7].Value = ((string)(ShipName));
            }
            if ((ShipAddress == null)) {
                this.Adapter.InsertCommand.Parameters[8].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[8].Value = ((string)(ShipAddress));
            }
            if ((ShipCity == null)) {
                this.Adapter.InsertCommand.Parameters[9].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[9].Value = ((string)(ShipCity));
            }
            if ((ShipRegion == null)) {
                this.Adapter.InsertCommand.Parameters[10].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[10].Value = ((string)(ShipRegion));
            }
            if ((ShipPostalCode == null)) {
                this.Adapter.InsertCommand.Parameters[11].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[11].Value = ((string)(ShipPostalCode));
            }
            if ((ShipCountry == null)) {
                this.Adapter.InsertCommand.Parameters[12].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[12].Value = ((string)(ShipCountry));
            }
            if ((CreateID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[13].Value = ((int)(CreateID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[13].Value = global::System.DBNull.Value;
            }
            if ((CreateUser == null)) {
                this.Adapter.InsertCommand.Parameters[14].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[14].Value = ((string)(CreateUser));
            }
            if ((ModifyID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[15].Value = ((int)(ModifyID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[15].Value = global::System.DBNull.Value;
            }
            if ((ModifyUser == null)) {
                this.Adapter.InsertCommand.Parameters[16].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[16].Value = ((string)(ModifyUser));
            }
            global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
            if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) 
                        != global::System.Data.ConnectionState.Open)) {
                this.Adapter.InsertCommand.Connection.Open();
            }
            try {
                int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
                return returnValue;
            }
            finally {
                if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
                    this.Adapter.InsertCommand.Connection.Close();
                }
            }
        }