/// <summary> /// Adds a new role to the database /// </summary> public void AddRole(RoleData newRole) { SqlConnection connection = new SqlConnection(DbConnection.NewDbConnectionString); SqlCommand insertCommand = new SqlCommand("vts_spRoleAddNew", connection); insertCommand.CommandType = CommandType.StoredProcedure; insertCommand.Parameters.Add(new SqlParameter("@RoleName", SqlDbType.VarChar, 0xff, "RoleName")); insertCommand.Parameters.Add(new SqlParameter("@RoleId", SqlDbType.Int, 4, "RoleId")); insertCommand.Parameters["@RoleId"].Direction = ParameterDirection.Output; DbConnection.db.UpdateDataSet(newRole, "Roles", insertCommand, new SqlCommand(), new SqlCommand(), UpdateBehavior.Transactional); }
/// <summary> /// Retrieves role details from the database /// </summary> public RoleData GetRoleById(int roleId) { RoleData dataSet = new RoleData(); ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@RoleID", roleId).SqlValue); } DbConnection.db.LoadDataSet("vts_spRoleGetDetails", dataSet, new string[] { "Roles", "SecurityRights" }, commandParameters.ToArray()); return dataSet; }
/// <summary> /// Retrieves all roles from the database not assigned to a user /// </summary> public RoleData GetUnassignedRolesToUser(int userId) { RoleData dataSet = new RoleData(); ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@UserId", userId).SqlValue); } DbConnection.db.LoadDataSet("vts_spUserRoleGetUnAssignedList", dataSet, new string[] { "Roles" }, commandParameters.ToArray()); return dataSet; }
private void ApplyChangesButton_Click(object sender, System.EventArgs e) { if (ValidateFieldOptions()) { RoleData roleData = new RoleData(); RoleData.RolesRow newRole = roleData.Roles.NewRolesRow(); newRole.RoleId = RoleId; newRole.RoleName = RoleNameTextBox.Text; roleData.Roles.Rows.Add(newRole); new Role().UpdateRole(roleData); AddRightsToRole(RoleId); // // Notifiy containers that data has changed OnOptionChanged(); MessageLabel.Visible = true; ((PageBase)Page).ShowNormalMessage(MessageLabel,((PageBase)Page).GetPageResource("RoleUpdatedMessage")); } }
/// <summary> /// Retrieves all roles from the database /// </summary> public RoleData GetAllRolesList() { RoleData dataSet = new RoleData(); DbConnection.db.LoadDataSet("vts_spRoleGetList", dataSet, new string[] { "Roles" }); return dataSet; }
public SecurityRightsRowChangeEvent(RoleData.SecurityRightsRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
private void CreateNewRoleButton_Click(object sender, System.EventArgs e) { if (ValidateFieldOptions()) { RoleData roleData = new RoleData(); RoleData.RolesRow newRole = roleData.Roles.NewRolesRow(); newRole.RoleName = RoleNameTextBox.Text; roleData.Roles.Rows.Add(newRole); new Role().AddRole(roleData); AddRightsToRole(newRole.RoleId); UINavigator.NavigateToRoleManager(((PageBase)Page).getSurveyId(), ((PageBase)Page).MenuIndex); } }
public void AddSecurityRightsRow(RoleData.SecurityRightsRow row) { base.Rows.Add(row); }
public void RemoveSecurityRightsRow(RoleData.SecurityRightsRow row) { base.Rows.Remove(row); }
public RolesRowChangeEvent(RoleData.RolesRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveRolesRow(RoleData.RolesRow row) { base.Rows.Remove(row); }
public void AddRolesRow(RoleData.RolesRow row) { base.Rows.Add(row); }
/// <summary> /// Updates roles data /// </summary> public void UpdateRole(RoleData updatedRole) { RoleFactory.Create().UpdateRole(updatedRole); }
/// <summary> /// Adds a new role to the database /// </summary> public void AddRole(RoleData newRole) { RoleFactory.Create().AddRole(newRole); }