/// <summary></summary> private void FillGridMain() { gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridRows.Clear(); gridMain.ListGridColumns.AddRange(new[] { new GridColumn(Lan.g(this, "User"), 70), new GridColumn(Lan.g(this, "Saved"), 80) }); gridMain.ListGridRows.AddRange(WikiListHists.GetByNameNoContent(ListNameCur) .Select(x => new GridRow(Userods.GetName(x.UserNum), x.DateTimeSaved.ToString()) { Tag = x })); gridMain.EndUpdate(); }
private void FormTaskInboxSetup_Load(object sender, EventArgs e) { UserList = Userods.GetDeepCopy(true); UserListOld = Userods.GetDeepCopy(true); TrunkList = TaskLists.RefreshMainTrunk(Security.CurUser.UserNum, TaskType.All) .FindAll(x => x.TaskListStatus == TaskListStatusEnum.Active); listMain.Items.Add(Lan.g(this, "none")); for (int i = 0; i < TrunkList.Count; i++) { listMain.Items.Add(TrunkList[i].Descript); } FillGrid(); }
///<summary>Fills listAssociatedUsers, which displays the users that are currently associated to the selected usergroup. ///This also dynamically sets the height of the control.</summary> private void FillAssociatedUsers() { listAssociatedUsers.Items.Clear(); List <Userod> listUsers = Userods.GetForGroup(SelectedUserGroup.UserGroupNum); foreach (Userod userCur in listUsers) { listAssociatedUsers.Items.Add(new ODBoxItem <Userod>(userCur.UserName, userCur)); } if (listAssociatedUsers.Items.Count == 0) { listAssociatedUsers.Items.Add(new ODBoxItem <Userod>(Lan.g(this, "None"))); } }
private void listUser_DoubleClick(object sender, EventArgs e) { if (listUser.SelectedIndex == -1) { return; } if (!Security.IsAuthorized(Permissions.TaskEdit, true) && Userods.GetInbox(shortList[listUser.SelectedIndex].UserNum) != 0) { MsgBox.Show(this, "Please select a user that does not have an inbox."); return; } SelectedUserNum = shortList[listUser.SelectedIndex].UserNum; DialogResult = DialogResult.OK; }
private void butGiveAccess_Click(object sender, EventArgs e) { if (butGiveAccess.Text == "Provide Online Access") //When form open opens with a blank password { string error = ValidatePatientAccess(); if (error != "") { MessageBox.Show(error); return; } Cursor = Cursors.WaitCursor; //1. Fill password. string passwordGenerated = GenerateRandomPassword(8); textOnlinePassword.Text = passwordGenerated; //2. Make the password editable in case they want to change it. textOnlinePassword.ReadOnly = false; //3. Save password to db. // We only save the hash of the generated password. string passwordHashed = Userods.EncryptPassword(passwordGenerated, false); PatCur.OnlinePassword = passwordHashed; Patients.Update(PatCur, PatOld); PatOld.OnlinePassword = passwordHashed; //Update PatOld in case the user changes password manually. //4. Insert EhrMeasureEvent EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent(); newMeasureEvent.DateTEvent = DateTime.Now; newMeasureEvent.EventType = EhrMeasureEventType.OnlineAccessProvided; newMeasureEvent.PatNum = PatCur.PatNum; newMeasureEvent.MoreInfo = ""; EhrMeasureEvents.Insert(newMeasureEvent); //5. Rename button butGiveAccess.Text = "Remove Online Access"; Cursor = Cursors.Default; } else //remove access { Cursor = Cursors.WaitCursor; //1. Clear password textOnlinePassword.Text = ""; //2. Make in uneditable textOnlinePassword.ReadOnly = true; //3. Save password to db PatCur.OnlinePassword = textOnlinePassword.Text; Patients.Update(PatCur, PatOld); PatOld.OnlinePassword = textOnlinePassword.Text; //Update PatOld in case the user changes password manually. //4. Rename button butGiveAccess.Text = "Provide Online Access"; Cursor = Cursors.Default; } }
private void FormJobReviewEdit_Load(object sender, EventArgs e) { _listReviewers = Userods.GetUsersByJobRole(JobPerm.Writeup, false); _listReviewers.ForEach(x => comboReviewer.Items.Add(x.UserName)); comboReviewer.SelectedIndex = _listReviewers.FindIndex(x => x.UserNum == _jobReviewCur.ReviewerNum); Enum.GetNames(typeof(JobReviewStatus)).ToList().ForEach(x => comboStatus.Items.Add(x)); comboStatus.SelectedIndex = (int)_jobReviewCur.ReviewStatus; CheckPermissions(); if (!_jobReviewCur.IsNew) { textDateLastEdited.Text = _jobReviewCur.DateTStamp.ToShortDateString(); } textDescription.Text = _jobReviewCur.Description; textReviewTime.Text = _jobReviewCur._Minutes.ToString(); }
private void FormTaskListSelect_Load(object sender, System.EventArgs e) { _taskListList = TaskLists.GetForObjectType(OType); if (OType == TaskObjectType.Appointment) { List <TaskList> TrunkList = TaskLists.RefreshMainTrunk(Security.CurUser.UserNum, TaskType.All) .FindAll(x => x.ObjectType != TaskObjectType.Appointment);//TaskListList already contains all appt type tasklists List <long> listUserInboxNums = Userods.GetDeepCopy(true).Select(x => x.TaskListInBox).ToList(); _taskListList.AddRange(TrunkList.FindAll(x => listUserInboxNums.Contains(x.TaskListNum))); } for (int i = 0; i < _taskListList.Count; i++) { listMain.Items.Add(_taskListList[i].Descript); } }
private void FormTaskSearch_Load(object sender, EventArgs e) { if (IsSelectionMode) { butClose.Text = "Cancel"; } //Note: DateTime strings that are empty actually are " " due to how the empty datetime control behaves. _listTaskPriorities = Defs.GetDefsForCategory(DefCat.TaskPriorities); long userNum = 0; comboUsers.Items.Add(Lan.g(this, "All")); comboUsers.Items.Add(Lan.g(this, "Me")); comboUsers.SelectedIndex = 0; //Always default to All. _listUsers = Userods.GetDeepCopy(); //List of all users for searching. I figure we don't want to exclude hidden ones for searching. _listUsers.ForEach(x => comboUsers.Items.Add(x.UserName)); comboPriority.Items.Add(Lan.g(this, "All")); for (int i = 0; i < _listTaskPriorities.Count; i++) { comboPriority.Items.Add(_listTaskPriorities[i].ItemName); } comboPriority.SelectedIndex = 0; checkLimit.Checked = true; if (PrefC.HasReportServer) { checkReportServer.Checked = true; } else { checkReportServer.Visible = false; } List <long> listTaskNums = new List <long>() { }; if (_listPreLoadedTaskNums != null) { listTaskNums = _listPreLoadedTaskNums; textTaskNum.Text = string.Join(",", listTaskNums); //Reflect taskNums in UI } if (!string.IsNullOrEmpty(TaskNum)) { listTaskNums.Add(PIn.Long(TaskNum)); textTaskNum.Text = string.Join(",", listTaskNums); } _tableTasks = Tasks.GetDataSet(userNum, new List <long>(), listTaskNums, " ", " ", " ", " ", textDescription.Text, 0, 0, checkBoxIncludesTaskNotes.Checked, checkBoxIncludeCompleted.Checked, true, checkReportServer.Checked); FillGrid(); }
/*private void butDelete_Click(object sender, System.EventArgs e) { * if(IsNew){ * DialogResult=DialogResult.Cancel; * return; * } * try{ * UserCur.Delete(); * } * catch(Exception ex){ * MessageBox.Show(ex.Message); * return; * } * DialogResult=DialogResult.OK; * }*/ private void butOK_Click(object sender, System.EventArgs e) { if (textUserName.Text == "") { MsgBox.Show(this, "Please enter a username."); return; } if (listEmployee.SelectedIndex > 0 && listProv.SelectedIndex > 0) { MsgBox.Show(this, "Cannot set an employee and a provider for the same user."); return; } UserCur.IsHidden = checkIsHidden.Checked; UserCur.UserName = textUserName.Text; UserCur.UserGroupNum = UserGroups.List[listUserGroup.SelectedIndex].UserGroupNum; if (listEmployee.SelectedIndex == 0) { UserCur.EmployeeNum = 0; } else { UserCur.EmployeeNum = Employees.ListShort[listEmployee.SelectedIndex - 1].EmployeeNum; } if (listProv.SelectedIndex == 0) { UserCur.ProvNum = 0; } else { UserCur.ProvNum = Providers.List[listProv.SelectedIndex - 1].ProvNum; } if (PrefB.GetBool("EasyNoClinics") || listClinic.SelectedIndex == 0) { UserCur.ClinicNum = 0; } else { UserCur.ClinicNum = Clinics.List[listClinic.SelectedIndex - 1].ClinicNum; } try{ Userods.InsertOrUpdate(IsNew, UserCur); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } DialogResult = DialogResult.OK; }
private void FormTaskNoteEdit_Load(object sender, EventArgs e) { textDateTime.Text = TaskNoteCur.DateTimeNote.ToString(); textUser.Text = Userods.GetName(TaskNoteCur.UserNum); textNote.Text = TaskNoteCur.Note; this.Top += 150; if (TaskNoteCur.IsNew) { textDateTime.ReadOnly = true; } else if (!Security.IsAuthorized(Permissions.TaskEdit)) //Tasknotes are not editable unless user has TaskEdit permission. { butOK.Enabled = false; butDelete.Enabled = false; } }
private void FormWebChatSurveys_Load(object sender, EventArgs e) { SetFilterControlsAndAction(() => { FillGridWebChatSurveys(); }, textSessionNum, textSurveyTextContains, dateRangeWebChat, comboUsers); dateRangeWebChat.SetDateTimeFrom(DateTime.Now.AddDays(-7)); dateRangeWebChat.SetDateTimeTo(DateTime.Now); comboUsers.Items.Clear(); foreach (Userod user in Userods.GetUsers()) { comboUsers.Items.Add(new ODBoxItem <Userod>(user.UserName, user)); if (Security.CurUser.UserNum == user.UserNum) //Select the current user by default. { comboUsers.SetSelected(comboUsers.Items.Count - 1, true); } } FillGridWebChatSurveys(); }
/// <summary></summary> private void FillGrid() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col=new ODGridColumn(Lan.g(this,"User"),70); gridMain.Columns.Add(col); col=new ODGridColumn(Lan.g(this,"Last Saved"),80); gridMain.Columns.Add(col); gridMain.Rows.Clear(); _listWikiPage=WikiPages.GetDraftsByTitle(OwnerForm.WikiPageCur.PageTitle); for(int i=0;i<_listWikiPage.Count;i++) { ODGridRow row=new ODGridRow(); row.Cells.Add(Userods.GetName(_listWikiPage[i].UserNum)); row.Cells.Add(_listWikiPage[i].DateTimeSaved.ToString()); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FormJobReviewEdit_Load(object sender, EventArgs e) { _listReviewers = Userods.GetUsersByJobRole(JobPerm.Writeup, false); _listReviewers.ForEach(x => comboReviewer.Items.Add(x.UserName)); comboReviewer.SelectedIndex = _listReviewers.FindIndex(x => x.UserNum == _jobReviewCur.ReviewerNum); //TimeLogs are used for storing job time rather than reviews so we remove it as an option here. _listReviewStatusNames = Enum.GetNames(typeof(JobReviewStatus)).Where(x => x != "TimeLog").ToList(); _listReviewStatusNames.ForEach(x => comboStatus.Items.Add(x)); comboStatus.SelectedIndex = (int)_jobReviewCur.ReviewStatus; CheckPermissions(); if (!_jobReviewCur.IsNew) { textDateLastEdited.Text = _jobReviewCur.DateTStamp.ToShortDateString(); } textDescription.Text = _jobReviewCur.Description; textReviewTime.Text = _jobReviewCur.TimeReview.TotalMinutes.ToString(); }
private void FormProcBroken_Load(object sender, EventArgs e) { textDateEntry.Text = _procCur.DateEntryC.ToShortDateString(); textProcDate.Text = _procCur.ProcDate.ToShortDateString(); textAmount.Text = _procCur.ProcFee.ToString("f"); comboClinic.SelectedClinicNum = _procCur.ClinicNum; fillComboProv(); comboProv.SetSelectedProvNum(_procCur.ProvNum); textUser.Text = Userods.GetName(_procCur.UserNum); textChartNotes.Text = _procCur.Note; textAccountNotes.Text = _procCur.BillingNote; labelAmountDescription.Text = ""; if (_isNonRefundable) { labelAmountDescription.Text = AmountTotal.ToString("c") + ": Non-Refundable portion"; } }
private void butUnlock_Click(object sender, EventArgs e) { if (!MsgBox.Show(this, true, "Users can become locked when invalid credentials have been entered several times in a row.\r\n" + "Unlock this user so that more log in attempts can be made?")) { return; } UserCur.DateTFail = DateTime.MinValue; UserCur.FailedAttempts = 0; try { Userods.Update(UserCur); MsgBox.Show(this, "User has been unlocked."); } catch (Exception) { MsgBox.Show(this, "There was a problem unlocking this user. Please call support or wait the allotted lock time."); } }
private void FillGrid() { try { LogList = SecurityLogs.Refresh(PatNum, PermTypes, FKey); } catch (Exception ex) { FriendlyException.Show(Lan.g(this, "There was a problem refreshing the Audit Trail with the current filters."), ex); LogList = new SecurityLog[0]; } grid.BeginUpdate(); grid.ListGridColumns.Clear(); GridColumn col; col = new GridColumn(Lan.g("TableAudit", "Date Time"), 120); grid.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableAudit", "User"), 70); grid.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableAudit", "Permission"), 170); grid.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableAudit", "Log Text"), 510); grid.ListGridColumns.Add(col); grid.ListGridRows.Clear(); GridRow row; Userod user; foreach (SecurityLog logCur in LogList) { row = new GridRow(); row.Cells.Add(logCur.LogDateTime.ToShortDateString() + " " + logCur.LogDateTime.ToShortTimeString()); user = Userods.GetUser(logCur.UserNum); if (user == null) //Will be null for audit trails made by outside entities that do not require users to be logged in. E.g. Web Sched. { row.Cells.Add("unknown"); } else { row.Cells.Add(user.UserName); } row.Cells.Add(logCur.PermType.ToString()); row.Cells.Add(logCur.LogText); grid.ListGridRows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private void listUser_DoubleClick(object sender, EventArgs e) { if (listUser.SelectedIndex == -1) { return; } if (!Security.IsAuthorized(Permissions.TaskEdit, true) && Userods.GetInbox(ListUserodsShowing[listUser.SelectedIndex].UserNum) != 0 && !IsSelectionmode) { MsgBox.Show(this, "Please select a user that does not have an inbox."); return; } SelectedUserNum = ListUserodsShowing[listUser.SelectedIndex].UserNum; foreach (int index in listUser.SelectedIndices) { ListSelectedUserNums.Add(ListUserodsShowing[index].UserNum); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { bool changed = false; for (int i = 0; i < UserList.Count; i++) { if (UserList[i].TaskListInBox != UserListOld[i].TaskListInBox) { Userods.Update(UserList[i]); changed = true; } } if (changed) { DataValid.SetInvalid(InvalidType.Security); } DialogResult = DialogResult.OK; }
private void FormEmailAddress_Load(object sender, System.EventArgs e) { if (_emailAddressCur != null) { textSMTPserver.Text = _emailAddressCur.SMTPserver; textUsername.Text = _emailAddressCur.EmailUsername; if (!String.IsNullOrEmpty(_emailAddressCur.EmailPassword)) //can happen if creating a new user email. { textPassword.Text = MiscUtils.Decrypt(_emailAddressCur.EmailPassword); } textPort.Text = _emailAddressCur.ServerPort.ToString(); checkSSL.Checked = _emailAddressCur.UseSSL; textSender.Text = _emailAddressCur.SenderAddress; textSMTPserverIncoming.Text = _emailAddressCur.Pop3ServerIncoming; textPortIncoming.Text = _emailAddressCur.ServerPortIncoming.ToString(); //Both EmailNotifyAddressNum and EmailDefaultAddressNum could be 0 (unset), in which case we still may want to display the user. List <long> listDefaultAddressNums = new List <long>() { PrefC.GetLong(PrefName.EmailNotifyAddressNum), PrefC.GetLong(PrefName.EmailDefaultAddressNum) }; if (_isNew || !_emailAddressCur.EmailAddressNum.In(listDefaultAddressNums)) { Userod user = Userods.GetUser(_emailAddressCur.UserNum); textUserod.Tag = user; textUserod.Text = user?.UserName; } else { groupUserod.Visible = false; } textAccessToken.Text = _emailAddressCur.AccessToken; textRefreshToken.Text = _emailAddressCur.RefreshToken; } groupGoogleAuth.Visible = !textAccessToken.Text.IsNullOrEmpty(); if (groupGoogleAuth.Visible) { groupAuthentication.Location = new Point(_groupAuthLocationXAuthorized, groupAuthentication.Location.Y); } else { groupAuthentication.Location = new Point(_groupAuthLocationXNotAuthorized, groupAuthentication.Location.Y); } }
private void FillGrid() { SecurityLog[] logList = SecurityLogs.Refresh(PatNum, PermTypes); grid.BeginUpdate(); grid.Rows.Clear(); ODGridRow row; for (int i = 0; i < logList.Length; i++) { row = new ODGridRow(); row.Cells.Add(logList[i].LogDateTime.ToShortDateString() + " " + logList[i].LogDateTime.ToShortTimeString()); row.Cells.Add(Userods.GetUser(logList[i].UserNum).UserName); row.Cells.Add(logList[i].PermType.ToString()); row.Cells.Add(logList[i].LogText); grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private void butGenerate_Click(object sender, EventArgs e) { if (textOnlinePassword.ReadOnly) { MessageBox.Show("Please use the Provide Online Access button first."); return; } Cursor = Cursors.WaitCursor; string passwordGenerated = UserWebs.GenerateRandomPassword(8); textOnlinePassword.Text = passwordGenerated; // We only save the hash of the generated password. string passwordHashed = Userods.HashPassword(passwordGenerated, false); _userWebCur.Password = passwordHashed; UserWebs.Update(_userWebCur, _userWebOld); _userWebOld.Password = passwordHashed; //Update PatOld in case the user changes password manually. Cursor = Cursors.Default; }
private void FillGrid() { //Fill the log if it wasn't filled outside of this window. if (LogList == null) { LogList = SecurityLogs.Refresh(PatNum, PermTypes, FKey, checkIncludeArchived.Checked); } grid.BeginUpdate(); grid.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TableAudit", "Date Time"), 120); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableAudit", "User"), 70); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableAudit", "Permission"), 170); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableAudit", "Log Text"), 510); grid.Columns.Add(col); grid.Rows.Clear(); ODGridRow row; Userod user; for (int i = 0; i < LogList.Length; i++) { row = new ODGridRow(); row.Cells.Add(LogList[i].LogDateTime.ToShortDateString() + " " + LogList[i].LogDateTime.ToShortTimeString()); user = Userods.GetUser(LogList[i].UserNum); if (user == null) //Will be null for audit trails made by outside entities that do not require users to be logged in. E.g. Web Sched. { row.Cells.Add("unknown"); } else { row.Cells.Add(user.UserName); } row.Cells.Add(LogList[i].PermType.ToString()); row.Cells.Add(LogList[i].LogText); grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private bool ValidateTitle() { //Key Hint: Nick Fury quote from Captain America Winter Soldier, 3 words, no spaces, CamelCased if (Userods.HashPassword(textTitle.Text) != KEY) { return(true); } butOK.Enabled = false; butCancel.Enabled = false; tabControlExtra.SelectedTab = tabConcept; tabConcept.BackColor = Color.Black; labelCategory.Text = "Protect"; labelPriority.Text = "The"; labelVersion.Text = "Program"; comboCategory.Visible = false; comboPriority.Visible = false; textVersion.Visible = false; butVersionPrompt.Visible = false; label1.Visible = false; textConcept.ReadOnly = true; textConcept.TextBox.BackColor = Color.Black; textConcept.TextBox.ForeColor = Color.White; tabControlExtra.TabPages.Remove(tabCustomers); tabControlExtra.TabPages.Remove(tabQuotes); tabControlExtra.TabPages.Remove(tabSubscribers); tabControlExtra.TabPages.Remove(tabRequests); tabControlExtra.TabPages.Remove(tabBugs); tabControlExtra.TabPages.Remove(tabTasks); BackColor = Color.Black; foreach (Control c in this.Controls) { c.BackColor = Color.Black; c.ForeColor = Color.White; } Text = "AVENGINEERS MODE ACTIVE"; string str = ""; CDT.Class1.Decrypt(MSG, out str); textTitle.Text = "Welcome Director Fury"; textConcept.MainText = str; return(false); }
private void FormPopupDisplay_Load(object sender, EventArgs e) { //This homogenizes the display because sometimes popups are stored with "\n" and sometimes they are saved with "\r\n" textDescription.Text = PopupCur.Description.Replace("\r\n", "\n").Replace("\n", "\r\n"); if (PopupCur.UserNum != 0) { //Display last user to edit PopupCur, or "Unknown(5)" if user not found. textUser.Text = Userods.GetUser(PopupCur.UserNum)?.UserName ?? (Lan.g(this, "Unknown") + $"({POut.Long(PopupCur.UserNum)})"); } textCreateDate.Text = ""; if (PopupCur.DateTimeEntry.Year > 1880) { textCreateDate.Text = PopupCur.DateTimeEntry.ToShortDateString() + " " + PopupCur.DateTimeEntry.ToShortTimeString(); } DateTime dateT = Popups.GetLastEditDateTimeForPopup(PopupCur.PopupNum); textEditDate.Text = ""; if (dateT.Year > 1880) { textEditDate.Text = dateT.ToShortDateString() + " " + dateT.ToShortTimeString(); //Sets the Edit date to the entry date of the last popup change that was archived for this popup. } for (int i = 1; i <= 4; i++) { comboMinutes.Items.Add(i.ToString()); } for (int i = 1; i <= 11; i++) { comboMinutes.Items.Add((i * 5).ToString()); } comboMinutes.Text = "10"; for (int i = 1; i <= 12; i++) { comboHours.Items.Add(i.ToString()); } comboHours.Text = "1"; MinutesDisabled = 0; if (PopupCur.UserNum != Security.CurUser.UserNum && !Security.IsAuthorized(Permissions.PopupEdit, true)) { textDescription.ReadOnly = true; } }
/// <summary></summary> private void FillGridMain() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g(this, "User"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Saved"), 80); gridMain.Columns.Add(col); gridMain.Rows.Clear(); _listWikiListHists = WikiListHists.GetByName(ListNameCur); for (int i = 0; i < _listWikiListHists.Count; i++) { ODGridRow row = new ODGridRow(); row.Cells.Add(Userods.GetName(_listWikiListHists[i].UserNum)); row.Cells.Add(_listWikiListHists[i].DateTimeSaved.ToString()); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FormLogOn_Load(object sender, EventArgs e) { TextBox textSelectOnLoad = textPassword; if (PrefC.GetBool(PrefName.UserNameManualEntry)) { listUser.Visible = false; textUser.Visible = true; textSelectOnLoad = textUser; //Focus should start with user name text box. } else //Show a list of users. //Only show the show CEMT user check box if not manually typing user names and there are CEMT users present in the db. { checkShowCEMTUsers.Visible = Userods.HasUsersForCEMTNoCache(); } FillListBox(); this.Focus(); //Attempted fix, customers had issue with UI not defaulting focus to this form on startup. textSelectOnLoad.Select(); //Give focus to appropriate text box. Plugins.HookAddCode(this, "FormLogOn.Load_end", _isSimpleSwitch); }
///<summary>Fills the User list with non-hidden, non-CEMT user names. Only shows non-hidden CEMT users if Show CEMT users is checked.</summary> private void FillListBox() { listUser.BeginUpdate(); listUser.Items.Clear(); List <string> listUserNames = Userods.GetUserNamesNoCache(checkShowCEMTUsers.Checked); foreach (string userName in listUserNames) { listUser.Items.Add(userName); if (_userNameAutoSelect != null && _userNameAutoSelect.Trim().ToLower() == userName.Trim().ToLower()) { listUser.SelectedIndex = listUser.Items.Count - 1; } } if (listUser.SelectedIndex == -1 && listUser.Items.Count > 0) //It is possible there are no users in the list if all users are CEMT users. { listUser.SelectedIndex = 0; } listUser.EndUpdate(); }
private void checkPasswordsMustBeStrong_Click(object sender, EventArgs e) { if (checkPasswordsMustBeStrong.Checked) { Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, true); DataValid.SetInvalid(InvalidType.Prefs); } else //unchecking the box { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning. If this box is unchecked, the strong password flag on all users will be reset. If strong passwords are again turned on later, then each users will have to edit their password in order to cause the strong password flag to be set again.")) { checkPasswordsMustBeStrong.Checked = true; //recheck it. return; } Userods.ResetStrongPasswordFlags(); Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, false); DataValid.SetInvalid(InvalidType.Security, InvalidType.Prefs); FillUsers(); FillTreePerm(); } }
private void FillList(List <Userod> listUserods) { if (listUserods == null) { listUserods = Userods.GetDeepCopy(true); } ListUserodsShowing = listUserods.Select(x => x.Copy()).ToList(); listUserods.ForEach(x => listUser.Items.Add(x)); if (_isMultiSelect) { foreach (long userNum in ListSuggestedUserNums) { int index = listUserods.FindIndex(x => x.UserNum == userNum); listUser.SetSelected(index, true); } } else { listUser.SelectedIndex = listUserods.FindIndex(x => x.UserNum == SuggestedUserNum); } }
private void butOK_Click(object sender, EventArgs e) { bool changed = false; Dictionary <string, List <Userod> > dictFailedUserUpdates = new Dictionary <string, List <Userod> >(); for (int i = 0; i < UserList.Count; i++) { if (UserList[i].TaskListInBox != UserListOld[i].TaskListInBox) { try { Userods.Update(UserList[i]); changed = true; } catch (Exception ex) { if (!dictFailedUserUpdates.ContainsKey(ex.Message)) { dictFailedUserUpdates.Add(ex.Message, new List <Userod>()); } dictFailedUserUpdates[ex.Message].Add(UserList[i]); } } } if (dictFailedUserUpdates.Count > 0) //Inform user that user inboxes could not be updated. { StringBuilder sb = new StringBuilder(); foreach (string exceptionMsgKey in dictFailedUserUpdates.Keys) { foreach (Userod user in dictFailedUserUpdates[exceptionMsgKey]) { sb.AppendLine(" " + user.UserName + " - " + exceptionMsgKey); } } MessageBox.Show(this, Lans.g(this, "The following users could not be updated:\r\n") + sb.ToString()); } if (changed) { DataValid.SetInvalid(InvalidType.Security); } DialogResult = DialogResult.OK; }