Ejemplo n.º 1
0
        public ICollection <long> Get(MembershipAuthorizationsCriteria criteria, DbConnection connection, DbTransaction transaction)
        {
            var reader = default(IDataReader);

            try
            {
                reader = MembershipAuthorizationsGateway.Select(criteria, connection, transaction);

                var authorizations = new Collection <long>();

                while (reader.Read())
                {
                    authorizations.Add(reader.GetInt64(@"AuthorizationID"));
                }

                return(authorizations);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="criteria"></param>
        /// <param name="connection"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public static long Delete(MembershipAuthorizationsCriteria criteria, DbConnection connection, DbTransaction transaction)
        {
            var command = KandaTableDataGateway._factory.CreateCommand(connection, transaction);

            command.CommandText = @"usp_DeleteMembershipAuthorizations";

            KandaDbDataMapper.MapToParameters(command, criteria);

            var result = KandaTableDataGateway._factory.CreateParameter(MembershipAuthorizationsGateway.TABLE_NAME, 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(MembershipAuthorizationsCriteria criteria, DbConnection connection, DbTransaction transaction)
        {
            var reader = KandaTableDataGateway._factory.CreateReader(connection, transaction);

            reader.CommandText = @"usp_SelectMembershipAuthorizations";

            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);
        }
Ejemplo n.º 4
0
        public bool Delete(MembershipAuthorizationsCriteria criteria, DbConnection connection, DbTransaction transaction)
        {
            var deleted = MembershipAuthorizationsGateway.Delete(criteria, connection, transaction);

            return(0 <= deleted);
        }