/// <summary> /// /// </summary> /// <param name="criteria"></param> /// <param name="connection"></param> /// <param name="transaction"></param> /// <returns></returns> public static int Delete(MembershipRolesCriteria criteria, DbConnection connection, DbTransaction transaction) { var command = KandaTableDataGateway._factory.CreateCommand(connection, transaction); command.CommandText = @"usp_DeleteMembershipRoles"; KandaDbDataMapper.MapToParameters(command, criteria); var result = KandaTableDataGateway._factory.CreateParameter(@"Result", DbType.Int32, sizeof(int), ParameterDirection.ReturnValue, DBNull.Value); command.Parameters.Add(result); command.ExecuteNonQuery(); return (int)result.Value; }
/// <summary> /// /// </summary> /// <param name="criteria"></param> /// <param name="connection"></param> /// <param name="transaction"></param> /// <returns></returns> public static KandaDbDataReader Select(MembershipRolesCriteria criteria, DbConnection connection, DbTransaction transaction) { var reader = KandaTableDataGateway._factory.CreateReader(connection, transaction); reader.CommandText = @"usp_SelectMembershipRoles"; KandaDbDataMapper.MapToParameters(reader, criteria); var result = KandaTableDataGateway._factory.CreateParameter(KandaTableDataGateway.RETURN_VALUE, DbType.Int32, sizeof(int), ParameterDirection.ReturnValue, DBNull.Value); reader.Parameters.Add(result); reader.ExecuteReader(); return reader; }
/// <summary> /// /// </summary> /// <param name="criteria"></param> /// <param name="connection"></param> /// <param name="transaction"></param> /// <returns></returns> public ICollection<long> Get(MembershipRolesCriteria criteria, DbConnection connection, DbTransaction transaction) { var reader = default(KandaDbDataReader); try { reader = MembershipRolesGateway.Select(criteria, connection, transaction); var roles = new Collection<long>(); while (reader.Read()) { roles.Add(reader.GetInt64(@"RoleID")); } return roles; } finally { if (reader != null) { reader.Close(); } } }
/// <summary> /// /// </summary> /// <param name="criteria"></param> /// <param name="connection"></param> /// <param name="transaction"></param> /// <returns></returns> internal bool Delete(MembershipRolesCriteria criteria, DbConnection connection, DbTransaction transaction) { var deleted = MembershipRolesGateway.Delete(criteria, connection, transaction); return (0 <= deleted); }