/// <summary> /// Gets a list of business units for a user and tasks /// </summary> /// <param name="userId"></param> /// <param name="channelId"></param> /// <returns></returns> protected AuthorizationUserSchema.BusinessUnitDataTable GetBusinessUnitsForUser(string userId, int channelId) { try { using (SqlConnection connection = new SqlConnection(_connectionString)) { try { connection.Open(); } catch { throw new LogonException(); } using (SqlCommand command = new SqlCommand("spGetBusinessUnitsForUser", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@login", SqlDbType.VarChar, 100).Value = userId; command.Parameters.Add("@channelId", SqlDbType.Int).Value = channelId; using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { AuthorizationUserSchema authorizationUserSchema = new AuthorizationUserSchema(); adapter.Fill(authorizationUserSchema.BusinessUnit); return(authorizationUserSchema.BusinessUnit); } } } } catch (LogonException) { throw; } catch (Exception ex) { throw new DataSourceException(ex); } }
public override DataSet Clone() { AuthorizationUserSchema cln = ((AuthorizationUserSchema)(base.Clone())); cln.InitVars(); return(cln); }
/// <summary> /// Gets a list roles for a channel, and business unit (site for now) /// </summary> /// <param name="channelId"></param> /// <param name="businessUnit"></param> /// <returns></returns> public AuthorizationUserSchema.RoleDataTable GetRoles(int channelId, int businessUnit) { try { using (SqlConnection connection = new SqlConnection(_connectionString)) { try { connection.Open(); } catch { throw new LogonException(); } using (SqlCommand command = new SqlCommand("spGetRoles", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@channelId", SqlDbType.Int).Value = channelId; command.Parameters.Add("@businessUnitId", SqlDbType.Int).Value = businessUnit; using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { AuthorizationUserSchema authorizationUserSchema = new AuthorizationUserSchema(); adapter.Fill(authorizationUserSchema.Role); return(authorizationUserSchema.Role); } } } } catch (LogonException) { throw; } catch (Exception ex) { throw new DataSourceException(ex); } }