/// <summary> /// Opens a blank PermissionEditView window to create a new role permission /// </summary> public void CreateRolePermission() { PermissionEditView window = new PermissionEditView(); window.DataContext = new PermissionEditViewModel("CreateRP", new PermissionObj()); if (window.ShowDialog() == true) { String string1 = (window.DataContext as PermissionEditViewModel).Field1; String string2 = (window.DataContext as PermissionEditViewModel).Field2; OptionService.InsertRolePermission(string2, string1); PermissionRoleList = OptionService.RetrieveRolePermissionList(); } }
/// <summary> /// Opens a blank PermissionEditView window to create a new user role /// </summary> public void CreateUserRole() { PermissionEditView window = new PermissionEditView(); window.DataContext = new PermissionEditViewModel("CreateUR", new PermissionObj()); if (window.ShowDialog() == true) { String string1 = (window.DataContext as PermissionEditViewModel).Field1; String string2 = (window.DataContext as PermissionEditViewModel).Field2; OptionService.InsertUserRole(string1, string2); MessageBox.Show("User/Role created Successfully."); UserRoleList = OptionService.RetrieveUserRoleList(); } }
/// <summary> /// Opens a PermissionEditView window to edit the selected user role /// </summary> public void EditUserRole() { if (SelectedUserRole != null) { PermissionEditView window = new PermissionEditView(); window.DataContext = new PermissionEditViewModel("EditUR", SelectedUserRole); if (window.ShowDialog() == true) { String string1 = (window.DataContext as PermissionEditViewModel).Field1; String string2 = (window.DataContext as PermissionEditViewModel).Field2; OptionService.UpdateUserRole(string1, string2); MessageBox.Show("User/Role updated Successfully."); UserRoleList = OptionService.RetrieveUserRoleList(); } } else { MessageBox.Show("Please select a User/Role to edit"); } }