///<Summary> ///Insert a new row ///This method saves a new object to the table IdentityUserLogin ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Insert() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserLogin_InsertOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@LoginProvider", SqlDbType.NVarChar, 128, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_loginProvider ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ProviderKey", SqlDbType.NVarChar, 128, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_providerKey ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_userId ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _loginProvider = Convert.IsDBNull(command.Parameters["@LoginProvider"].Value) ? null : (string)command.Parameters["@LoginProvider"].Value; _providerKey = Convert.IsDBNull(command.Parameters["@ProviderKey"].Value) ? null : (string)command.Parameters["@ProviderKey"].Value; _userId = Convert.IsDBNull(command.Parameters["@UserId"].Value) ? (Int32?)null : (Int32?)command.Parameters["@UserId"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Delete one row by primary key(s) ///this method allows the object to delete itself from the table CustomerDemographics based on its primary key ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Delete() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerDemographics_DeleteOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)_customerTypeID ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Delete all by foreign key ///This method deletes all rows in the table CustomerCustomerDemo with a given foreign key ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///IzNorthwindRestApiConn_TxConnectionProvider connectionProvider, string customerTypeID ///</parameters> public static void DeleteAllByCustomerTypeID(IzNorthwindRestApiConn_TxConnectionProvider connectionProvider, string customerTypeID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerCustomerDemo_DeleteAllByCustomerTypeID; command.CommandType = CommandType.Text; command.Connection = connectionProvider.Connection; command.Transaction = connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)customerTypeID ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(null); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); } finally { command.Dispose(); } }
///<Summary> ///Update one row by primary key(s) ///This method allows the object to update itself in the table IdentityRole based on its primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Update() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityRole_UpdateOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@Id", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ıd ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Name", SqlDbType.NVarChar, 256, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_name ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ctrVersion ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _ıd = Convert.IsDBNull(command.Parameters["@Id"].Value) ? (Int32?)null : (Int32?)command.Parameters["@Id"].Value; _name = Convert.IsDBNull(command.Parameters["@Name"].Value) ? null : (string)command.Parameters["@Name"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Delete all by foreign key ///This method deletes all rows in the table IdentityUserClaim with a given foreign key ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///IzNorthwindRestApiConn_TxConnectionProvider connectionProvider, Int32? userId ///</parameters> public static void DeleteAllByUserId(IzNorthwindRestApiConn_TxConnectionProvider connectionProvider, Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserClaim_DeleteAllByUserId; command.CommandType = CommandType.Text; command.Connection = connectionProvider.Connection; command.Transaction = connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(null); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); } finally { command.Dispose(); } }
///<Summary> ///Delete one row by primary key(s) ///this method allows the object to delete itself from the table IdentityUserRole based on its primary key ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Delete() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserRole_DeleteOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)_userId ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@RoleId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)_roleId ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Insert a new row ///This method saves a new object to the table Categories ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Insert() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCategories_InsertOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@Description", SqlDbType.NText, 8000, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)_description ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Picture", SqlDbType.Image, 16, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)_picture ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@CategoryID", SqlDbType.Int, 4, ParameterDirection.Output, false, 10, 0, "", DataRowVersion.Proposed, _categoryID)); command.Parameters.Add(CtSqlParameter.Get("@CategoryName", SqlDbType.NVarChar, 15, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_categoryName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.Output, false, 10, 0, "", DataRowVersion.Proposed, _ctrVersion)); command.ExecuteNonQuery(); Done(this); _categoryID = Convert.IsDBNull(command.Parameters["@CategoryID"].Value) ? (Int32?)null : (Int32?)command.Parameters["@CategoryID"].Value; _categoryName = Convert.IsDBNull(command.Parameters["@CategoryName"].Value) ? null : (string)command.Parameters["@CategoryName"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Insert a new row ///This method saves a new object to the table EmployeeTerritories ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Insert() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprEmployeeTerritories_InsertOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@EmployeeID", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_employeeID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@TerritoryID", SqlDbType.NVarChar, 20, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_territoryID ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _employeeID = Convert.IsDBNull(command.Parameters["@EmployeeID"].Value) ? (Int32?)null : (Int32?)command.Parameters["@EmployeeID"].Value; _territoryID = Convert.IsDBNull(command.Parameters["@TerritoryID"].Value) ? null : (string)command.Parameters["@TerritoryID"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///</Summary> ///<returns> ///Int32 ///</returns> ///<parameters> ///Int32? userId ///</parameters> public static Int32 SelectAllByUserIdCount(Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserClaim_SelectAllByUserIdCount; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); staticConnection.Open(); Int32 retCount = (Int32)command.ExecuteScalar(); Done(null); return(retCount); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(-1); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Update one row by primary key(s) ///This method allows the object to update itself in the table CustomerDemographics based on its primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Update() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerDemographics_UpdateOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@CustomerDesc", SqlDbType.NText, 8000, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)_customerDesc ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_customerTypeID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ctrVersion ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _customerTypeID = Convert.IsDBNull(command.Parameters["@CustomerTypeID"].Value) ? null : (string)command.Parameters["@CustomerTypeID"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///</Summary> ///<returns> ///Int32 ///</returns> ///<parameters> ///string customerTypeID ///</parameters> public static Int32 SelectAllByCustomerTypeIDCount(string customerTypeID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerCustomerDemo_SelectAllByCustomerTypeIDCount; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; try { command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)customerTypeID ?? (object)DBNull.Value)); staticConnection.Open(); Int32 retCount = (Int32)command.ExecuteScalar(); Done(null); return(retCount); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(-1); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table Suppliers based on the primary key(s) ///</Summary> ///<returns> ///IDAOSuppliers ///</returns> ///<parameters> ///Int32? supplierID ///</parameters> public static IDAOSuppliers SelectOne(Int32?supplierID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprSuppliers_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("Suppliers"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@SupplierID", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)supplierID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOSuppliers retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOSuppliers(); retObj._supplierID = Convert.IsDBNull(dt.Rows[0]["SupplierID"]) ? (Int32?)null : (Int32?)dt.Rows[0]["SupplierID"]; retObj._companyName = Convert.IsDBNull(dt.Rows[0]["CompanyName"]) ? null : (string)dt.Rows[0]["CompanyName"]; retObj._contactName = Convert.IsDBNull(dt.Rows[0]["ContactName"]) ? null : (string)dt.Rows[0]["ContactName"]; retObj._contactTitle = Convert.IsDBNull(dt.Rows[0]["ContactTitle"]) ? null : (string)dt.Rows[0]["ContactTitle"]; retObj._address = Convert.IsDBNull(dt.Rows[0]["Address"]) ? null : (string)dt.Rows[0]["Address"]; retObj._city = Convert.IsDBNull(dt.Rows[0]["City"]) ? null : (string)dt.Rows[0]["City"]; retObj._region = Convert.IsDBNull(dt.Rows[0]["Region"]) ? null : (string)dt.Rows[0]["Region"]; retObj._postalCode = Convert.IsDBNull(dt.Rows[0]["PostalCode"]) ? null : (string)dt.Rows[0]["PostalCode"]; retObj._country = Convert.IsDBNull(dt.Rows[0]["Country"]) ? null : (string)dt.Rows[0]["Country"]; retObj._phone = Convert.IsDBNull(dt.Rows[0]["Phone"]) ? null : (string)dt.Rows[0]["Phone"]; retObj._fax = Convert.IsDBNull(dt.Rows[0]["Fax"]) ? null : (string)dt.Rows[0]["Fax"]; retObj._homePage = Convert.IsDBNull(dt.Rows[0]["HomePage"]) ? null : (string)dt.Rows[0]["HomePage"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? (Int32?)null : (Int32?)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table IdentityUser based on the primary key(s) ///</Summary> ///<returns> ///IDAOIdentityUser ///</returns> ///<parameters> ///Int32? userId ///</parameters> public static IDAOIdentityUser SelectOne(Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUser_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUser"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOIdentityUser retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOIdentityUser(); retObj._userId = Convert.IsDBNull(dt.Rows[0]["UserId"]) ? (Int32?)null : (Int32?)dt.Rows[0]["UserId"]; retObj._email = Convert.IsDBNull(dt.Rows[0]["Email"]) ? null : (string)dt.Rows[0]["Email"]; retObj._emailConfirmed = Convert.IsDBNull(dt.Rows[0]["EmailConfirmed"]) ? (bool?)null : (bool?)dt.Rows[0]["EmailConfirmed"]; retObj._passwordHash = Convert.IsDBNull(dt.Rows[0]["PasswordHash"]) ? null : (string)dt.Rows[0]["PasswordHash"]; retObj._securityStamp = Convert.IsDBNull(dt.Rows[0]["SecurityStamp"]) ? null : (string)dt.Rows[0]["SecurityStamp"]; retObj._phoneNumber = Convert.IsDBNull(dt.Rows[0]["PhoneNumber"]) ? null : (string)dt.Rows[0]["PhoneNumber"]; retObj._phoneNumberConfirmed = Convert.IsDBNull(dt.Rows[0]["PhoneNumberConfirmed"]) ? (bool?)null : (bool?)dt.Rows[0]["PhoneNumberConfirmed"]; retObj._twoFactorEnabled = Convert.IsDBNull(dt.Rows[0]["TwoFactorEnabled"]) ? (bool?)null : (bool?)dt.Rows[0]["TwoFactorEnabled"]; retObj._lockoutEndDateUtc = Convert.IsDBNull(dt.Rows[0]["LockoutEndDateUtc"]) ? (DateTime?)null : (DateTime?)dt.Rows[0]["LockoutEndDateUtc"]; retObj._lockoutEnabled = Convert.IsDBNull(dt.Rows[0]["LockoutEnabled"]) ? (bool?)null : (bool?)dt.Rows[0]["LockoutEnabled"]; retObj._accessFailedCount = Convert.IsDBNull(dt.Rows[0]["AccessFailedCount"]) ? (Int32?)null : (Int32?)dt.Rows[0]["AccessFailedCount"]; retObj._username = Convert.IsDBNull(dt.Rows[0]["Username"]) ? null : (string)dt.Rows[0]["Username"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? (Int32?)null : (Int32?)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Update one row by primary key(s) ///This method allows the object to update itself in the table IdentityUser based on its primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Update() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUser_UpdateOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_userId ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Email", SqlDbType.NVarChar, 256, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_email ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@EmailConfirmed", SqlDbType.Bit, 1, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_emailConfirmed ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@PasswordHash", SqlDbType.NVarChar, -1, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_passwordHash ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@SecurityStamp", SqlDbType.NVarChar, -1, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_securityStamp ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@PhoneNumber", SqlDbType.NVarChar, -1, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_phoneNumber ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@PhoneNumberConfirmed", SqlDbType.Bit, 1, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_phoneNumberConfirmed ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@TwoFactorEnabled", SqlDbType.Bit, 1, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_twoFactorEnabled ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@LockoutEndDateUtc", SqlDbType.DateTime, 8, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_lockoutEndDateUtc ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@LockoutEnabled", SqlDbType.Bit, 1, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_lockoutEnabled ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@AccessFailedCount", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_accessFailedCount ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Username", SqlDbType.NVarChar, 256, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_username ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ctrVersion ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _userId = Convert.IsDBNull(command.Parameters["@UserId"].Value) ? (Int32?)null : (Int32?)command.Parameters["@UserId"].Value; _email = Convert.IsDBNull(command.Parameters["@Email"].Value) ? null : (string)command.Parameters["@Email"].Value; _emailConfirmed = Convert.IsDBNull(command.Parameters["@EmailConfirmed"].Value) ? (bool?)null : (bool?)command.Parameters["@EmailConfirmed"].Value; _passwordHash = Convert.IsDBNull(command.Parameters["@PasswordHash"].Value) ? null : (string)command.Parameters["@PasswordHash"].Value; _securityStamp = Convert.IsDBNull(command.Parameters["@SecurityStamp"].Value) ? null : (string)command.Parameters["@SecurityStamp"].Value; _phoneNumber = Convert.IsDBNull(command.Parameters["@PhoneNumber"].Value) ? null : (string)command.Parameters["@PhoneNumber"].Value; _phoneNumberConfirmed = Convert.IsDBNull(command.Parameters["@PhoneNumberConfirmed"].Value) ? (bool?)null : (bool?)command.Parameters["@PhoneNumberConfirmed"].Value; _twoFactorEnabled = Convert.IsDBNull(command.Parameters["@TwoFactorEnabled"].Value) ? (bool?)null : (bool?)command.Parameters["@TwoFactorEnabled"].Value; _lockoutEndDateUtc = Convert.IsDBNull(command.Parameters["@LockoutEndDateUtc"].Value) ? (DateTime?)null : (DateTime?)command.Parameters["@LockoutEndDateUtc"].Value; _lockoutEnabled = Convert.IsDBNull(command.Parameters["@LockoutEnabled"].Value) ? (bool?)null : (bool?)command.Parameters["@LockoutEnabled"].Value; _accessFailedCount = Convert.IsDBNull(command.Parameters["@AccessFailedCount"].Value) ? (Int32?)null : (Int32?)command.Parameters["@AccessFailedCount"].Value; _username = Convert.IsDBNull(command.Parameters["@Username"].Value) ? null : (string)command.Parameters["@Username"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Update one row by primary key(s) ///This method allows the object to update itself in the table Suppliers based on its primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Update() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprSuppliers_UpdateOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@HomePage", SqlDbType.NText, 8000, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)_homePage ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@SupplierID", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_supplierID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@CompanyName", SqlDbType.NVarChar, 40, ParameterDirection.InputOutput, false, 0, 0, "", DataRowVersion.Proposed, (object)_companyName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ContactName", SqlDbType.NVarChar, 30, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_contactName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ContactTitle", SqlDbType.NVarChar, 30, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_contactTitle ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Address", SqlDbType.NVarChar, 60, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_address ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@City", SqlDbType.NVarChar, 15, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_city ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Region", SqlDbType.NVarChar, 15, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_region ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@PostalCode", SqlDbType.NVarChar, 10, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_postalCode ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Country", SqlDbType.NVarChar, 15, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_country ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Phone", SqlDbType.NVarChar, 24, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_phone ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Fax", SqlDbType.NVarChar, 24, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_fax ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ctrVersion ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _supplierID = Convert.IsDBNull(command.Parameters["@SupplierID"].Value) ? (Int32?)null : (Int32?)command.Parameters["@SupplierID"].Value; _companyName = Convert.IsDBNull(command.Parameters["@CompanyName"].Value) ? null : (string)command.Parameters["@CompanyName"].Value; _contactName = Convert.IsDBNull(command.Parameters["@ContactName"].Value) ? null : (string)command.Parameters["@ContactName"].Value; _contactTitle = Convert.IsDBNull(command.Parameters["@ContactTitle"].Value) ? null : (string)command.Parameters["@ContactTitle"].Value; _address = Convert.IsDBNull(command.Parameters["@Address"].Value) ? null : (string)command.Parameters["@Address"].Value; _city = Convert.IsDBNull(command.Parameters["@City"].Value) ? null : (string)command.Parameters["@City"].Value; _region = Convert.IsDBNull(command.Parameters["@Region"].Value) ? null : (string)command.Parameters["@Region"].Value; _postalCode = Convert.IsDBNull(command.Parameters["@PostalCode"].Value) ? null : (string)command.Parameters["@PostalCode"].Value; _country = Convert.IsDBNull(command.Parameters["@Country"].Value) ? null : (string)command.Parameters["@Country"].Value; _phone = Convert.IsDBNull(command.Parameters["@Phone"].Value) ? null : (string)command.Parameters["@Phone"].Value; _fax = Convert.IsDBNull(command.Parameters["@Fax"].Value) ? null : (string)command.Parameters["@Fax"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table Order Details based on a foreign key ///</Summary> ///<returns> ///IList-IDAOOrderDetails. ///</returns> ///<parameters> ///Int32? productID ///</parameters> public static IList <IDAOOrderDetails> SelectAllByProductID(Int32?productID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprOrderDetails_SelectAllByProductID; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("Order Details"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@ProductID", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)productID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOOrderDetails> objList = new List <IDAOOrderDetails>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOOrderDetails retObj = new DAOOrderDetails(); retObj._orderID = Convert.IsDBNull(row["OrderID"]) ? (Int32?)null : (Int32?)row["OrderID"]; retObj._productID = Convert.IsDBNull(row["ProductID"]) ? (Int32?)null : (Int32?)row["ProductID"]; retObj._unitPrice = Convert.IsDBNull(row["UnitPrice"]) ? (decimal?)null : (decimal?)row["UnitPrice"]; retObj._quantity = Convert.IsDBNull(row["Quantity"]) ? (Int16?)null : (Int16?)row["Quantity"]; retObj._discount = Convert.IsDBNull(row["Discount"]) ? (float?)null : (float?)row["Discount"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table IdentityUserClaim based on a foreign key ///</Summary> ///<returns> ///IList-IDAOIdentityUserClaim. ///</returns> ///<parameters> ///Int32? userId ///</parameters> public static IList <IDAOIdentityUserClaim> SelectAllByUserId(Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserClaim_SelectAllByUserId; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUserClaim"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOIdentityUserClaim> objList = new List <IDAOIdentityUserClaim>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOIdentityUserClaim retObj = new DAOIdentityUserClaim(); retObj._ıd = Convert.IsDBNull(row["Id"]) ? (Int32?)null : (Int32?)row["Id"]; retObj._userId = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"]; retObj._claimType = Convert.IsDBNull(row["ClaimType"]) ? null : (string)row["ClaimType"]; retObj._claimValue = Convert.IsDBNull(row["ClaimValue"]) ? null : (string)row["ClaimValue"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table Territories based on a foreign key ///</Summary> ///<returns> ///IList-IDAOTerritories. ///</returns> ///<parameters> ///Int32? regionID ///</parameters> public static IList <IDAOTerritories> SelectAllByRegionID(Int32?regionID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprTerritories_SelectAllByRegionID; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("Territories"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@RegionID", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)regionID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOTerritories> objList = new List <IDAOTerritories>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOTerritories retObj = new DAOTerritories(); retObj._territoryID = Convert.IsDBNull(row["TerritoryID"]) ? null : (string)row["TerritoryID"]; retObj._territoryDescription = Convert.IsDBNull(row["TerritoryDescription"]) ? null : (string)row["TerritoryDescription"]; retObj._regionID = Convert.IsDBNull(row["RegionID"]) ? (Int32?)null : (Int32?)row["RegionID"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table CustomerCustomerDemo based on a foreign key ///</Summary> ///<returns> ///IList-IDAOCustomerCustomerDemo. ///</returns> ///<parameters> ///string customerTypeID ///</parameters> public static IList <IDAOCustomerCustomerDemo> SelectAllByCustomerTypeID(string customerTypeID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerCustomerDemo_SelectAllByCustomerTypeID; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("CustomerCustomerDemo"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)customerTypeID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOCustomerCustomerDemo> objList = new List <IDAOCustomerCustomerDemo>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOCustomerCustomerDemo retObj = new DAOCustomerCustomerDemo(); retObj._customerID = Convert.IsDBNull(row["CustomerID"]) ? null : (string)row["CustomerID"]; retObj._customerTypeID = Convert.IsDBNull(row["CustomerTypeID"]) ? null : (string)row["CustomerTypeID"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table Categories based on the primary key(s) ///</Summary> ///<returns> ///IDAOCategories ///</returns> ///<parameters> ///Int32? categoryID ///</parameters> public static IDAOCategories SelectOne(Int32?categoryID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCategories_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("Categories"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@CategoryID", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)categoryID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOCategories retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOCategories(); retObj._categoryID = Convert.IsDBNull(dt.Rows[0]["CategoryID"]) ? (Int32?)null : (Int32?)dt.Rows[0]["CategoryID"]; retObj._categoryName = Convert.IsDBNull(dt.Rows[0]["CategoryName"]) ? null : (string)dt.Rows[0]["CategoryName"]; retObj._description = Convert.IsDBNull(dt.Rows[0]["Description"]) ? null : (string)dt.Rows[0]["Description"]; retObj._picture = Convert.IsDBNull(dt.Rows[0]["Picture"]) ? null : (byte[])dt.Rows[0]["Picture"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? (Int32?)null : (Int32?)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table IdentityUserLogin based on the primary key(s) ///</Summary> ///<returns> ///IDAOIdentityUserLogin ///</returns> ///<parameters> ///string loginProvider, string providerKey, Int32? userId ///</parameters> public static IDAOIdentityUserLogin SelectOne(string loginProvider, string providerKey, Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserLogin_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUserLogin"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@LoginProvider", SqlDbType.NVarChar, 128, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)loginProvider ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ProviderKey", SqlDbType.NVarChar, 128, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)providerKey ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOIdentityUserLogin retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOIdentityUserLogin(); retObj._loginProvider = Convert.IsDBNull(dt.Rows[0]["LoginProvider"]) ? null : (string)dt.Rows[0]["LoginProvider"]; retObj._providerKey = Convert.IsDBNull(dt.Rows[0]["ProviderKey"]) ? null : (string)dt.Rows[0]["ProviderKey"]; retObj._userId = Convert.IsDBNull(dt.Rows[0]["UserId"]) ? (Int32?)null : (Int32?)dt.Rows[0]["UserId"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table IdentityUserClaim based on the primary key(s) ///</Summary> ///<returns> ///IDAOIdentityUserClaim ///</returns> ///<parameters> ///Int32? ıd ///</parameters> public static IDAOIdentityUserClaim SelectOne(Int32?ıd) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserClaim_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUserClaim"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@Id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)ıd ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOIdentityUserClaim retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOIdentityUserClaim(); retObj._ıd = Convert.IsDBNull(dt.Rows[0]["Id"]) ? (Int32?)null : (Int32?)dt.Rows[0]["Id"]; retObj._userId = Convert.IsDBNull(dt.Rows[0]["UserId"]) ? (Int32?)null : (Int32?)dt.Rows[0]["UserId"]; retObj._claimType = Convert.IsDBNull(dt.Rows[0]["ClaimType"]) ? null : (string)dt.Rows[0]["ClaimType"]; retObj._claimValue = Convert.IsDBNull(dt.Rows[0]["ClaimValue"]) ? null : (string)dt.Rows[0]["ClaimValue"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? (Int32?)null : (Int32?)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table EmployeeTerritories based on the primary key(s) ///</Summary> ///<returns> ///IDAOEmployeeTerritories ///</returns> ///<parameters> ///Int32? employeeID, string territoryID ///</parameters> public static IDAOEmployeeTerritories SelectOne(Int32?employeeID, string territoryID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprEmployeeTerritories_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("EmployeeTerritories"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@EmployeeID", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)employeeID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@TerritoryID", SqlDbType.NVarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)territoryID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOEmployeeTerritories retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOEmployeeTerritories(); retObj._employeeID = Convert.IsDBNull(dt.Rows[0]["EmployeeID"]) ? (Int32?)null : (Int32?)dt.Rows[0]["EmployeeID"]; retObj._territoryID = Convert.IsDBNull(dt.Rows[0]["TerritoryID"]) ? null : (string)dt.Rows[0]["TerritoryID"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Update one row by primary key(s) ///This method allows the object to update itself in the table Order Details based on its primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Update() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprOrderDetails_UpdateOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@OrderID", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_orderID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ProductID", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_productID ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@UnitPrice", SqlDbType.Money, 8, ParameterDirection.InputOutput, false, 19, 4, "", DataRowVersion.Proposed, (object)_unitPrice ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Quantity", SqlDbType.SmallInt, 2, ParameterDirection.InputOutput, false, 5, 0, "", DataRowVersion.Proposed, (object)_quantity ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@Discount", SqlDbType.Real, 4, ParameterDirection.InputOutput, false, 24, 0, "", DataRowVersion.Proposed, (object)_discount ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_ctrVersion ?? (object)DBNull.Value)); command.ExecuteNonQuery(); Done(this); _orderID = Convert.IsDBNull(command.Parameters["@OrderID"].Value) ? (Int32?)null : (Int32?)command.Parameters["@OrderID"].Value; _productID = Convert.IsDBNull(command.Parameters["@ProductID"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ProductID"].Value; _unitPrice = Convert.IsDBNull(command.Parameters["@UnitPrice"].Value) ? (decimal?)null : (decimal?)command.Parameters["@UnitPrice"].Value; _quantity = Convert.IsDBNull(command.Parameters["@Quantity"].Value) ? (Int16?)null : (Int16?)command.Parameters["@Quantity"].Value; _discount = Convert.IsDBNull(command.Parameters["@Discount"].Value) ? (float?)null : (float?)command.Parameters["@Discount"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }
///<Summary> ///Insert a new row ///This method saves a new object to the table IdentityUserProfile ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Insert() { Doing(this); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserProfile_InsertOne; command.CommandType = CommandType.Text; command.Connection = _connectionProvider.Connection; command.Transaction = _connectionProvider.CurrentTransaction; try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.InputOutput, false, 10, 0, "", DataRowVersion.Proposed, (object)_userId ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@FirstName", SqlDbType.VarChar, 50, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_firstName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@LastName", SqlDbType.VarChar, 50, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_lastName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@FullName", SqlDbType.VarChar, 100, ParameterDirection.InputOutput, true, 0, 0, "", DataRowVersion.Proposed, (object)_fullName ?? (object)DBNull.Value)); command.Parameters.Add(CtSqlParameter.Get("@ctr_version", SqlDbType.Int, 4, ParameterDirection.Output, false, 10, 0, "", DataRowVersion.Proposed, _ctrVersion)); command.ExecuteNonQuery(); Done(this); _userId = Convert.IsDBNull(command.Parameters["@UserId"].Value) ? (Int32?)null : (Int32?)command.Parameters["@UserId"].Value; _firstName = Convert.IsDBNull(command.Parameters["@FirstName"].Value) ? null : (string)command.Parameters["@FirstName"].Value; _lastName = Convert.IsDBNull(command.Parameters["@LastName"].Value) ? null : (string)command.Parameters["@LastName"].Value; _fullName = Convert.IsDBNull(command.Parameters["@FullName"].Value) ? null : (string)command.Parameters["@FullName"].Value; _ctrVersion = Convert.IsDBNull(command.Parameters["@ctr_version"].Value) ? (Int32?)null : (Int32?)command.Parameters["@ctr_version"].Value; } catch (Exception ex) { Failed(this, ex); Handle(this, ex); } finally { command.Dispose(); } }