private void CheckRolesForSelectedUser() { var name = Request.QueryString["NAME"]; var UsersRoleList = (Repeater)FormProfile.FindControl("UsersRoleList"); // Determine what roles the selected user belongs to var selectedUserName = name; var selectedUsersRoles = Roles.GetRolesForUser(selectedUserName); // Loop through the Repeater's Items and check or uncheck the checkbox as needed foreach (RepeaterItem ri in UsersRoleList.Items) { // Programmatically reference the CheckBox var RoleCheckBox = ri.FindControl("RoleCheckBox") as CheckBox; // See if RoleCheckBox.Text is in selectedUsersRoles if (selectedUsersRoles.Contains(RoleCheckBox.Text)) { RoleCheckBox.Checked = true; } else { RoleCheckBox.Checked = false; } } }
private void itemProfile_Click(object sender, EventArgs e) { FormProfile form = new FormProfile(); form.MdiParent = this; form.Show(); }
/// <summary> /// Activates the form network card. /// </summary> /// <param name="selectedNetworkCardForm">The selected network card form.</param> public static void ActivateFormProfile(FormProfile selectedProfileForm) { /* * // profili * ViewModel.MainView.rbtnProfileNew.Enabled = true; * ViewModel.MainView.rbtnProfileView.Enabled = true; * ViewModel.MainView.rbtnProfileDelete.Enabled = true; * * // profilo * ViewModel.MainView.rbtnProfileRun.Enabled = true; * ViewModel.MainView.rbtnProfileSave.Enabled = true; * * // documento * ViewModel.MainView.rbtnConfigSave.Enabled = true; * ViewModel.MainView.rbtnConfigLoad.Enabled = true; * * // networkcard * ViewModel.MainView.rbtnCardsRefresh.Enabled = false; * ViewModel.MainView.rbtnCardView.Enabled = false;*/ ViewModel.MainView.ribbon.ActiveTab = ViewModel.MainView.rtOperations; // form selezionati ViewModel.SelectedView = selectedProfileForm; }
private void BindRolesToList() { var UsersRoleList = (Repeater)FormProfile.FindControl("UsersRoleList"); // Get all of the roles var roles = Roles.GetAllRoles(); UsersRoleList.DataSource = roles; UsersRoleList.DataBind(); }
void pbAccountImage_Click(object sender, EventArgs e) { if (Program.empLogin != null) { FormProfile profile = new FormProfile(Program.empLogin); profile.FormClosed += profile_FormClosed; profile.ShowDialog(); } }
//Mở form con private void openChildForm(FormProfile childForm) { if (activeForm != null) { activeForm.Close(); } activeForm = childForm; childForm.FormBorderStyle = FormBorderStyle.FixedDialog; childForm.BringToFront(); childForm.ShowDialog(); }
/// <summary> /// Возвращает созданный профайл или null /// </summary> /// <returns>созданный профайл или null</returns> internal static UserConfig CreateNewConfig() { using (var formProfile = new FormProfile(null)) { if (formProfile.ShowDialog() == DialogResult.OK) { formProfile.SelectedUserConfig.Save(); return(formProfile.SelectedUserConfig); } return(null); } }
/// <summary> /// Saves the current profile. /// </summary> public static void SaveProfile(NetworkProfile profile = null) { if (profile == null) { FormProfile viewProfile = ViewModel.SelectedView as FormProfile; if (viewProfile == null) { MyMessageBox.ShowAlert("No profile selected!"); return; } // ANS-10: check if any nic is selected if (viewProfile.SelectedNetworkCard == null) { MyMessageBox.ShowAlert("No network card is selected, profile is not saved!"); return; } // check if it is possibile do operation if (UseCaseApplication.CheckIsOperationNotAllowedNow()) { return; } viewProfile.StoreFormOnData(); profile = viewProfile.Profile; } if (profile.IsNew) { profile.Id = CreateNewProfileId(); // if not exist add it DataModel.NetworkProfileList.Add(profile); } else { // save profile for (int i = 0; i < DataModel.NetworkProfileList.Count; i++) { if (profile.Id == DataModel.NetworkProfileList[i].Id) { // found e replace DataModel.NetworkProfileList[i] = profile; break; } } } // list refresh Refresh(); }
/// <summary> /// Shows the specified profile. /// </summary> /// <param name="profile">The profile.</param> public static void ShowProfile(NetworkProfile profile) { if (profile == null) { return; } NetworkProfile item; foreach (FormProfile itemForm in ViewModel.ProfileViewList) { if ((itemForm.Tag is NetworkProfile)) { item = (NetworkProfile)itemForm.Tag; if (item.Id.Equals(profile.Id)) { if (!itemForm.Visible) { itemForm.Show(ViewModel.MainView.Pannello); } itemForm.Focus(); //UseCaseView.ActivateFormProfile(itemForm); return; } } } FormProfile form = new FormProfile(); form.Profile = profile; // update networkcard for security //profile.NetworkCardInfo = DataModel.FindNetworkCard(profile.NetworkCardInfo.Id); form.ViewDataOnForm(); ViewModel.ProfileViewList.Add(form); form.Show(ViewModel.MainView.Pannello); form.DockState = DockState.Document; }
/// <summary> /// Возвращает исправленный профайл или null. Может потребовать ввести пароль. /// </summary> /// <param name="userConfig">Профайл для редактирования</param> /// <returns>исправленный профайл или null</returns> internal static UserConfig EditExistingConfig(UserConfig userConfig) { if (userConfig == null) { throw new ArgumentNullException("userConfig"); } userConfig = TryDecrypt(userConfig); if (userConfig == null) { return(null); } using (var formProfile = new FormProfile(userConfig)) { if (formProfile.ShowDialog() == DialogResult.OK) { formProfile.SelectedUserConfig.Save(); return(formProfile.SelectedUserConfig); } return(null); } }
/// <summary> /// Closes the form. /// </summary> /// <param name="formProfile">The form profile.</param> public static void Hide(FormProfile formProfile) { DataModel.SelectedNetworkProfile = null; ViewModel.ProfileViewList.Remove(formProfile); }