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

Insert() private method

private Insert ( global OrderID, int ProductID, decimal UnitPrice, short Quantity, float Discount, global CreateID, string CreateUser, global ModifyID, string ModifyUser ) : int
OrderID global
ProductID int
UnitPrice decimal
Quantity short
Discount float
CreateID global
CreateUser string
ModifyID global
ModifyUser string
return int
        public virtual int Insert(global::System.Nullable<int> OrderID, int ProductID, decimal UnitPrice, short Quantity, float Discount, global::System.Nullable<int> CreateID, string CreateUser, global::System.Nullable<int> ModifyID, string ModifyUser) {
            if ((OrderID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[0].Value = ((int)(OrderID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[0].Value = global::System.DBNull.Value;
            }
            this.Adapter.InsertCommand.Parameters[1].Value = ((int)(ProductID));
            this.Adapter.InsertCommand.Parameters[2].Value = ((decimal)(UnitPrice));
            this.Adapter.InsertCommand.Parameters[3].Value = ((short)(Quantity));
            this.Adapter.InsertCommand.Parameters[4].Value = ((float)(Discount));
            if ((CreateID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[5].Value = ((int)(CreateID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value;
            }
            if ((CreateUser == null)) {
                this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[6].Value = ((string)(CreateUser));
            }
            if ((ModifyID.HasValue == true)) {
                this.Adapter.InsertCommand.Parameters[7].Value = ((int)(ModifyID.Value));
            }
            else {
                this.Adapter.InsertCommand.Parameters[7].Value = global::System.DBNull.Value;
            }
            if ((ModifyUser == null)) {
                this.Adapter.InsertCommand.Parameters[8].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[8].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();
                }
            }
        }