private void UpdateFormArc(int popositionInlistView, int SortColumnId) { try { CIncidents Incidents = new CIncidents(); Incidents.GetListFromDir(new CConfig().ArchivesDirName); Incidents.SortIncidents(SortColumnId); var Re = Incidents.Incidents.Where( p => DateTime.ParseExact(p.DateExec, "yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("ru-RU")) >= DateTime.ParseExact(dateTimePickerBeginArc.Text, "yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("ru-RU"))).Where( p => DateTime.ParseExact(p.DateExec, "yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("ru-RU")) <= DateTime.ParseExact(dateTimePickerEndArc.Text, "yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("ru-RU"))); CIncidents Inc2 = new CIncidents(); foreach (CIncident R1 in Re) { CIncident ii = new CIncident(); ii = R1; Inc2.Incidents.Add(ii); } UdeteeveryForm(popositionInlistView, SortColumnId, listViewIncidentsArc, Inc2); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void UpdateFormSearchInArc(int popositionInlistView, int SortColumnId) { try { CIncidents Incidents = new CIncidents(); Incidents.GetListFromDir(new CConfig().ArchivesDirName); Incidents.GetSearchList(textBoxsearch.Text); UdeteeveryForm(popositionInlistView, SortColumnId, listViewIncidentsArc, Incidents); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void UpdateForm(int popositionInlistView, int SortColumnId, ListView lVIncidents) { try { CIncidents Incidents = new CIncidents(); Incidents.GetListFromDir(new CConfig().WorkDirName); Incidents.SortIncidents(SortColumnId); UdeteeveryForm(popositionInlistView, SortColumnId, lVIncidents, Incidents); SetInterfaceElements(lVIncidents, new CConfig().WorkDirName); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void UdeteeveryForm(int popositionInlistView, int SortColumnId, ListView lVIncidents, CIncidents Incidents) { try { lVIncidents.Clear(); lVIncidents.View = View.Details; lVIncidents.Columns.Add("Date", 150); lVIncidents.Columns.Add("user", 250); lVIncidents.Columns.Add("problem", 250); lVIncidents.Columns.Add("solution", 450); lVIncidents.Columns.Add("executor", 150); lVIncidents.Columns.Add("storage time", 150); lVIncidents.FullRowSelect = true; lVIncidents.GridLines = true; lVIncidents.MultiSelect = false; foreach (CIncident incident in Incidents.Incidents) { lVIncidents.Items.Add(new ListViewItem(new[] { incident.DateExec, incident.Initiator, incident.Problem, incident.Solution, incident.Executor, incident.DateWithTime })); } if (lVIncidents.Items.Count != 0) { if (lVIncidents.Items.Count <= popositionInlistView) { popositionInlistView--; } lVIncidents.Select(); lVIncidents.Items[popositionInlistView].Focused = true; lVIncidents.Items[popositionInlistView].Selected = true; lVIncidents.FocusedItem = lVIncidents.Items[popositionInlistView]; lVIncidents.EnsureVisible(popositionInlistView); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }