private void FormAudit_Load(object sender, System.EventArgs e) { textDateFrom.Text = DateTime.Today.AddDays(-10).ToShortDateString(); textDateTo.Text = DateTime.Today.ToShortDateString(); for (int i = 0; i < permissionsAlphabetic.Count; i++) { if (i == 0) { comboPermission.Items.Add(Lan.g(this, "All")); //None } else { comboPermission.Items.Add(Lan.g("enumPermissions", permissionsAlphabetic[i])); } } comboPermission.SelectedIndex = 0; _listUserods = Userods.GetDeepCopy(); comboUser.Items.Add(Lan.g(this, "All")); comboUser.SelectedIndex = 0; for (int i = 0; i < _listUserods.Count; i++) { comboUser.Items.Add(_listUserods[i].UserName); } PatNum = CurPatNum; if (PatNum == 0) { textPatient.Text = ""; } else { textPatient.Text = Patients.GetLim(PatNum).GetNameLF(); } textRows.Text = PrefC.GetString(PrefName.AuditTrailEntriesDisplayed); FillGrid(); }
private void FormJobNew_Load(object sender, EventArgs e) { textSearch.Text = InitialSearchString; listBoxUsers.Items.Add("Any"); _listUsers = Userods.GetDeepCopy(true); _listUsers.ForEach(x => listBoxUsers.Items.Add(x.UserName)); //Statuses listBoxStatus.Items.Add("Any"); _listJobStatuses = Enum.GetValues(typeof(JobPhase)).Cast <JobPhase>().ToList(); _listJobStatuses.ForEach(x => listBoxStatus.Items.Add(x.ToString())); //Categories listBoxCategory.Items.Add("Any"); _listJobCategory = Enum.GetValues(typeof(JobCategory)).Cast <JobCategory>().ToList(); _listJobCategory.ForEach(x => listBoxCategory.Items.Add(x.ToString())); ODThread thread = new ODThread((o) => { //We can reduce these calls to DB by passing in more data from calling class. if available. if (_listJobsAll == null) { _listJobsAll = Jobs.GetAll(); Jobs.FillInMemoryLists(_listJobsAll); } try { _listFeatureRequestsAll = FeatureRequests.GetAll(); } catch (Exception ex) { ex.DoNothing(); _listFeatureRequestsAll = new List <FeatureRequest>(); } _listBugsAll = Bugs.GetAll(); this.Invoke((Action)ReadyForSearch); }); thread.AddExceptionHandler((ex) => { /*todo*/ }); thread.Start(); }
private void FormRpTreatPlanPresenter_Load(object sender, EventArgs e) { date1.SelectionStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(-1); date2.SelectionStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddDays(-1); _listUsers = Userods.GetDeepCopy(true); listUser.Items.AddRange(_listUsers.Select(x => x.UserName).ToArray()); checkAllUsers.Checked = true; if (PrefC.HasClinicsEnabled) { if (!Security.CurUser.ClinicIsRestricted) { listClin.Items.Add(Lan.g(this, "Unassigned")); } _listClinics = Clinics.GetForUserod(Security.CurUser); listClin.Items.AddRange(_listClinics.Select(x => x.Abbr).ToArray()); checkAllClinics.Checked = true; } else { listClin.Visible = false; checkAllClinics.Visible = false; labelClin.Visible = false; groupGrossNet.Location = new Point(185, 225); groupOrder.Location = new Point(185, 295); groupUser.Location = new Point(185, 365); listUser.Width += 30; } }
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; } _tableTasks = Tasks.GetDataSet(userNum, new List <long>(), 0, " ", " ", " ", " ", textDescription.Text, 0, 0, checkBoxIncludesTaskNotes.Checked, checkBoxIncludeCompleted.Checked, true, checkReportServer.Checked); FillGrid(); }
private void butUserPicker_Click(object sender, EventArgs e) { FormUserPick FormUP = new FormUserPick(); FormUP.ListUserodsFiltered = Userods.GetDeepCopy(); if (FormUP.ShowDialog() == DialogResult.OK) { comboUsers.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == FormUP.SelectedUserNum) + 2; } }
private void FormTaskInboxSetup_Load(object sender, EventArgs e) { UserList = Userods.GetDeepCopy(true); UserListOld = Userods.GetDeepCopy(true); TrunkList = TaskLists.RefreshMainTrunk(Security.CurUser.UserNum, TaskType.All); listMain.Items.Add(Lan.g(this, "none")); for (int i = 0; i < TrunkList.Count; i++) { listMain.Items.Add(TrunkList[i].Descript); } FillGrid(); }
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 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 FillGrid() { List <PhoneConf> listPhoneConfs = PhoneConfs.GetAll(); listPhoneConfs = listPhoneConfs.OrderBy(x => x.Extension).ToList(); if (checkHideEmpty.Checked) { listPhoneConfs.RemoveAll(x => x.Occupants == 0); } List <Site> listSites = Sites.GetDeepCopy(); List <Userod> listUserods = Userods.GetDeepCopy(); gridConfRoom.BeginUpdate(); gridConfRoom.ListGridColumns.Clear(); //No translations due to HQ only. gridConfRoom.ListGridColumns.Add(new GridColumn("Extension", 70, HorizontalAlignment.Center, GridSortingStrategy.AmountParse)); gridConfRoom.ListGridColumns.Add(new GridColumn("MsgBtn", 60, HorizontalAlignment.Center, GridSortingStrategy.AmountParse)); gridConfRoom.ListGridColumns.Add(new GridColumn("Site", 100)); gridConfRoom.ListGridColumns.Add(new GridColumn("UserReserved", 100)); gridConfRoom.ListGridColumns.Add(new GridColumn("DateTimeReserved", 110, HorizontalAlignment.Center, GridSortingStrategy.DateParse)); gridConfRoom.ListGridColumns.Add(new GridColumn("Occupants", 0, HorizontalAlignment.Center, GridSortingStrategy.AmountParse)); gridConfRoom.ListGridRows.Clear(); GridRow row; foreach (PhoneConf conf in listPhoneConfs) { row = new GridRow(); Site site = listSites.FirstOrDefault(x => x.SiteNum == conf.SiteNum); Userod user = listUserods.FirstOrDefault(x => x.UserNum == conf.UserNum); row.Cells.Add(conf.Extension.ToString()); row.Cells.Add((conf.ButtonIndex < 0) ? "" : conf.ButtonIndex.ToString()); row.Cells.Add((site == null) ? "" : site.Description); row.Cells.Add((user == null) ? "" : user.UserName); row.Cells.Add((conf.DateTimeReserved.Year < 1880) ? "" : conf.DateTimeReserved.ToShortDateString() + " " + conf.DateTimeReserved.ToShortTimeString()); row.Cells.Add((conf.Occupants < 1) ? "" : conf.Occupants.ToString()); row.Tag = conf; gridConfRoom.ListGridRows.Add(row); } gridConfRoom.EndUpdate(); }
private void FormTaskSendUser_Load(object sender, EventArgs e) { List <Userod> UserList = Userods.GetDeepCopy(true); List <TaskList> TrunkList = TaskLists.RefreshMainTrunk(Security.CurUser.UserNum, TaskType.All); FilteredList = new List <TaskList>(); for (int i = 0; i < UserList.Count; i++) { if (UserList[i].TaskListInBox == 0) { continue; } for (int t = 0; t < TrunkList.Count; t++) { if (TrunkList[t].TaskListNum == UserList[i].TaskListInBox) { FilteredList.Add(TrunkList[t]); listMain.Items.Add(TrunkList[t].Descript); } } } }
private void FormJobSearch_Load(object sender, EventArgs e) { if (_isMultiSelect) { gridMain.SelectionMode = GridSelectionMode.MultiExtended; } _listJobPriorities = Defs.GetDefsForCategory(DefCat.JobPriorities); textSearch.Text = InitialSearchString; listBoxUsers.Items.Add("Any"); _listUsers = Userods.GetDeepCopy(true); _listUsers.ForEach(x => listBoxUsers.Items.Add(x.UserName)); listBoxUsers.SetSelected(0, true); //Statuses listBoxPhases.Items.Add("Any"); _listJobPhases = Enum.GetValues(typeof(JobPhase)).Cast <JobPhase>().ToList(); foreach (JobPhase phase in _listJobPhases) { listBoxPhases.Items.Add(phase.ToString()); if (!phase.In(JobPhase.Cancelled, JobPhase.Complete)) { listBoxPhases.SetSelected(listBoxPhases.Items.Count - 1, true); } } //Categories listBoxCategory.Items.Add("Any"); _listJobCategory = Enum.GetValues(typeof(JobCategory)).Cast <JobCategory>().ToList(); _listJobCategory.ForEach(x => listBoxCategory.Items.Add(x.ToString())); listBoxCategory.SetSelected(0, true); //Priorities listBoxPriorities.Items.Add(new ODBoxItem <Def>("Any", null)); listBoxPriorities.SelectedIndices.Add(0); foreach (Def def in Defs.GetDefsForCategory(DefCat.JobPriorities, true).OrderBy(x => x.ItemOrder).ToList()) { listBoxPriorities.Items.Add(new ODBoxItem <Def>(def.ItemName, def)); } }
private void FormJobNew_Load(object sender, EventArgs e) { textSearch.Text = InitialSearchString; listBoxUsers.Items.Add("Any"); _listUsers = Userods.GetDeepCopy(true); _listUsers.ForEach(x => listBoxUsers.Items.Add(x.UserName)); //Statuses listBoxStatus.Items.Add("Any"); _listJobStatuses = Enum.GetValues(typeof(JobPhase)).Cast <JobPhase>().ToList(); _listJobStatuses.ForEach(x => listBoxStatus.Items.Add(x.ToString())); //Categories listBoxCategory.Items.Add("Any"); _listJobCategory = Enum.GetValues(typeof(JobCategory)).Cast <JobCategory>().ToList(); _listJobCategory.ForEach(x => listBoxCategory.Items.Add(x.ToString())); ODThread thread = new ODThread((o) => { //We can reduce these calls to DB by passing in more data from calling class. if available. _listJobsAll = Jobs.GetAll(); Jobs.FillInMemoryLists(_listJobsAll); _listTasksAll = Tasks.GetMany(_listJobsAll.SelectMany(x => x.ListJobLinks).Where(x => x.LinkType == JobLinkType.Task).Select(x => x.FKey).Distinct().ToList()); _listTaskNotesAll = TaskNotes.GetForTasks(_listTasksAll.Select(x => x.TaskNum).ToList()); _listPatientAll = Patients.GetMultPats(_listJobsAll.SelectMany(x => x.ListJobQuotes).Select(x => x.PatNum).Distinct().ToList()).ToList(); _listPatientAll.AddRange(Patients.GetMultPats(_listTasksAll.FindAll(x => x.ObjectType == TaskObjectType.Patient).Select(x => x.KeyNum).ToList())); try { _listFeatureRequestsAll = FeatureRequests.GetAll(); } catch (Exception ex) { ex.DoNothing(); _listFeatureRequestsAll = new List <FeatureRequest>(); } _listBugsAll = Bugs.GetAll(); this.Invoke((Action)ReadyForSearch); }); thread.AddExceptionHandler((ex) => { /*todo*/ }); thread.Start(); }
///<summary>Returns a filtered list of userods that should be displayed. Returns all users when IsCEMT is true.</summary> private List <Userod> GetFilteredUsersHelper() { List <Userod> retVal = Userods.GetDeepCopy(); if (IsForCEMT) { return(retVal); } if (_dictProvNumProvs == null) //fill the dictionary if needed { _dictProvNumProvs = Providers.GetMultProviders(Userods.GetDeepCopy().Select(x => x.ProvNum).ToList()).ToDictionary(x => x.ProvNum, x => x); } retVal.RemoveAll(x => x.UserNumCEMT > 0); //NEVER show CEMT users when not in the CEMT tool. if (!checkShowHidden.Checked) { retVal.RemoveAll(x => x.IsHidden); } long classNum = 0; if (comboSchoolClass.Visible && comboSchoolClass.SelectedIndex > 0) { classNum = ((ODBoxItem <SchoolClass>)comboSchoolClass.SelectedItem).Tag.SchoolClassNum; } switch (((ODBoxItem <UserFilters>)comboShowOnly.SelectedItem).Tag) { case UserFilters.Employees: retVal.RemoveAll(x => x.EmployeeNum == 0); break; case UserFilters.Providers: retVal.RemoveAll(x => x.ProvNum == 0); break; case UserFilters.Students: //might not count user as student if attached to invalid providers. retVal.RemoveAll(x => !_dictProvNumProvs.ContainsKey(x.ProvNum) || _dictProvNumProvs[x.ProvNum].IsInstructor); if (classNum > 0) { retVal.RemoveAll(x => _dictProvNumProvs[x.ProvNum].SchoolClassNum != classNum); } break; case UserFilters.Instructors: retVal.RemoveAll(x => !_dictProvNumProvs.ContainsKey(x.ProvNum) || !_dictProvNumProvs[x.ProvNum].IsInstructor); if (classNum > 0) { retVal.RemoveAll(x => _dictProvNumProvs[x.ProvNum].SchoolClassNum != classNum); } break; case UserFilters.Other: retVal.RemoveAll(x => x.EmployeeNum != 0 || x.ProvNum != 0); break; case UserFilters.AllUsers: default: break; } if (comboClinic.SelectedIndex > 0) { retVal.RemoveAll(x => x.ClinicNum != ((ODBoxItem <Clinic>)comboClinic.SelectedItem).Tag.ClinicNum); } if (comboGroups.SelectedIndex > 0) { retVal.RemoveAll(x => !x.IsInUserGroup(((ODBoxItem <UserGroup>)comboGroups.SelectedItem).Tag.UserGroupNum)); } if (!string.IsNullOrWhiteSpace(textPowerSearch.Text)) { switch (((ODBoxItem <UserFilters>)comboShowOnly.SelectedItem).Tag) { case UserFilters.Employees: retVal.RemoveAll(x => !Employees.GetNameFL(x.EmployeeNum).ToLower().Contains(textPowerSearch.Text.ToLower())); break; case UserFilters.Providers: case UserFilters.Students: case UserFilters.Instructors: retVal.RemoveAll(x => !_dictProvNumProvs[x.ProvNum].GetLongDesc().ToLower().Contains(textPowerSearch.Text.ToLower())); break; case UserFilters.AllUsers: case UserFilters.Other: default: retVal.RemoveAll(x => !x.UserName.ToLower().Contains(textPowerSearch.Text.ToLower())); break; } } return(retVal); }
///<summary>Actually creates the GridRows and returns them in a list. Takes care of linking dropdown rows.</summary> private List <ODGridRow> ConstructGridRows() { DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); dateTo = (dateTo == DateTime.MinValue ? DateTime.Now : dateTo); ODGridRow row; List <ODGridRow> listRows = new List <ODGridRow>(); Dictionary <long, Userod> dictUsers = Userods.GetDeepCopy().ToDictionary(x => x.UserNum, x => x); foreach (InsEditLog logCur in _listLogs) { if (!logCur.DateTStamp.Between(dateFrom, dateTo)) { continue; } row = new ODGridRow(); row.Cells.Add(""); row.Cells.Add(logCur.DateTStamp.ToString()); row.Cells.Add(dictUsers[logCur.UserNum].UserName); row.Cells.Add(logCur.LogType.ToString()); row.Cells.Add(logCur.FKey.ToString()); row.Cells.Add(logCur.Description); row.Cells.Add(logCur.FieldName); row.Cells.Add(logCur.OldValue); row.Cells.Add(logCur.NewValue); row.Tag = logCur; listRows.Add(row); } //link drop down rows to drop down parents. listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName == "BenefitNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName != "BenefitNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName == "CarrierNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName != "CarrierNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName == "EmployerNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName != "EmployerNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName == "PlanNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName != "PlanNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); return(listRows); }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col; col = new GridColumn("User Name", 120); gridMain.ListGridColumns.Add(col); col = new GridColumn("Group Name", 120); gridMain.ListGridColumns.Add(col); col = new GridColumn("Show CDS", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Show i", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Edit CDS", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Source", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Problem", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Medication", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Allergy", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Demographic", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Labs", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn("Vitals", 80, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; List <Userod> ListUsers = Userods.GetDeepCopy(true); UserGroup[] ArrayGroups = UserGroups.GetDeepCopy().ToArray(); //if(radioUser.Checked) {//by user for (int i = 0; i < ListUsers.Count; i++) { row = new GridRow(); row.Cells.Add(ListUsers[i].UserName); for (int g = 0; g < ArrayGroups.Length; g++) //group name. { if (!ListUsers[i].IsInUserGroup(ArrayGroups[g].UserGroupNum)) { continue; } row.Cells.Add(ArrayGroups[g].Description); break; } for (int p = 0; p < _listCdsPermissions.Count; p++) { if (ListUsers[i].UserNum != _listCdsPermissions[p].UserNum) { continue; } row.Cells.Add((_listCdsPermissions[p].ShowCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].SetupCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].ShowInfobutton ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].EditBibliography ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].ProblemCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].MedicationCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].AllergyCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].DemographicCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].LabTestCDS ?"X":"")); //"X" if user has permission row.Cells.Add((_listCdsPermissions[p].VitalCDS ?"X":"")); //"X" if user has permission row.Tag = _listCdsPermissions[p].CDSPermissionNum; //used to edit correct permission. break; } gridMain.ListGridRows.Add(row); } //} //else {//by user group // for(int g=0;g<ArrayGroups.Length;g++) { // row=new ODGridRow(); // row.Cells.Add("");//No User Name // row.Cells.Add(ArrayGroups[g].Description); //TODO: Later. No time now for group level permission editing. // gridMain.Rows.Add(row); // } //} gridMain.EndUpdate(); }
///<summary>Actually creates the GridRows and returns them in a list. Takes care of linking dropdown rows.</summary> private List <ODGridRow> ConstructGridRows(bool refreshFromDb) { if (_listLogs == null || refreshFromDb) { _listLogs = InsEditLogs.GetLogsForPlan(_insPlan.PlanNum, _insPlan.CarrierNum, _insPlan.EmployerNum, PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text)); } ODGridRow row; List <ODGridRow> listRows = new List <ODGridRow>(); Dictionary <long, Userod> dictUsers = Userods.GetDeepCopy().ToDictionary(x => x.UserNum, x => x); TranslateBeforeAndAfter(); foreach (InsEditLog logCur in _listLogs) { row = new ODGridRow(); row.Cells.Add(""); row.Cells.Add(logCur.DateTStamp.ToString()); row.Cells.Add(dictUsers[logCur.UserNum].UserName); row.Cells.Add(logCur.LogType.ToString()); row.Cells.Add(logCur.FKey.ToString()); row.Cells.Add(logCur.Description); row.Cells.Add(logCur.FieldName); row.Cells.Add(logCur.OldValue); row.Cells.Add(logCur.NewValue); row.Tag = logCur; listRows.Add(row); } //link drop down rows to drop down parents. listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName == "BenefitNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName != "BenefitNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName == "CarrierNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName != "CarrierNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName == "EmployerNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName != "EmployerNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName == "PlanNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { y.DropDownState = ODGridDropDownState.Up; listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName != "PlanNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); return(listRows); }
///<summary>Actually creates the GridRows and returns them in a list. Takes care of linking dropdown rows.</summary> private List <GridRow> ConstructGridRows() { DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); dateTo = (dateTo == DateTime.MinValue ? DateTime.Now : dateTo); GridRow row; List <GridRow> listRows = new List <GridRow>(); Dictionary <long, Userod> dictUsers = Userods.GetDeepCopy().ToDictionary(x => x.UserNum, x => x); foreach (InsEditLog logCur in _listLogs) { if (!logCur.DateTStamp.Between(dateFrom, dateTo)) { continue; } row = new GridRow(); row.Cells.Add(""); row.Cells.Add(logCur.DateTStamp.ToString()); if (dictUsers.TryGetValue(logCur.UserNum, out Userod user)) { row.Cells.Add(user.UserName); } else { row.Cells.Add(Lan.g(this, "Unknown") + "(" + POut.Long(logCur.UserNum) + ")"); //Unable to find the corresponding user. } row.Cells.Add(logCur.LogType.ToString()); row.Cells.Add(logCur.FKey.ToString()); row.Cells.Add(logCur.Description); row.Cells.Add(logCur.FieldName); row.Cells.Add(logCur.OldValue); row.Cells.Add(logCur.NewValue); row.Tag = logCur; listRows.Add(row); } //link drop down rows to drop down parents. listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName == "BenefitNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit && ((InsEditLog)x.Tag).FieldName != "BenefitNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; //child x, parent y }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName == "CarrierNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier && ((InsEditLog)x.Tag).FieldName != "CarrierNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName == "EmployerNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer && ((InsEditLog)x.Tag).FieldName != "EmployerNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName == "PlanNum" && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList() .ForEach(y => { listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan && ((InsEditLog)x.Tag).FieldName != "PlanNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey && ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => { x.DropDownParent = y; }); }); return(listRows); }
///<summary>Returns a list of TaskList inboxes for non hidden users with an inbox setup.</summary> private List <TaskList> GetUserInboxTaskLists() { List <TaskList> listUserInboxTaskLists = TaskLists.GetMany(Userods.GetDeepCopy(true).Select(x => x.TaskListInBox).ToList()); return(listUserInboxTaskLists.OrderBy(x => x.Descript).ThenBy(x => x.DateTimeEntry).ToList()); }