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); } }
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> /// Get the current DB data and fill /// the fields with them /// </summary> public void BindFields() { // // Retrieve the role data RoleData roleData = new Roles().GetRoleById(RoleId); RoleData.RolesRow role = roleData.Roles[0]; RoleNameTextBox.Text = role.RoleName; BindRights(); foreach (RoleData.SecurityRightsRow right in roleData.SecurityRights.Rows) { foreach (ListItem item in RightsCheckBoxList.Items) { if (item.Value == right.SecurityRightId.ToString()) { item.Selected = true; } } } }