void CheckListSummary() { NotamFilter filter = new NotamFilter(); filter.NotamFirFilter = (FIR == null) ? "" : FIR.Code; filter.NotamAeroFilter = (Aerodom == null) ? "" : Aerodom.Code; filter.TypeFilter = Type; filter.YearFilter = Year; filter.FromDateFilter = From; filter.ToDateFilter = To; List<IntlNotam> notamList = _notamService.GetFilterNotams(filter); if (notamList == null) return; if (notamList.Count == 0) { MessageBox.Show("No Result"); return; } try { var queryYear = notamList.GroupBy(item => item.Year).Select(group => new { Year = group.Key, nums = group.OrderBy(x => x.Number) }).OrderBy(group => group.Year); // newTable.Rows.Add(newTable.Rows[1]); int icol = 1; string strItemE = "CHECKLIST:"; foreach (var yearItem in queryYear) { strItemE += "\r\nYEAR 20" + yearItem.Year + ": "; foreach (var nt in yearItem.nums) { strItemE += nt.Number + " "; icol++; if (icol > 11) { icol = 1; strItemE += "\r\n "; } } icol = 1; } strItemE += "\r\nLATEST PUBLICATIONS: "; NOTAM.SERVICE.Model.Notam newNotam = NOTAM.SERVICE.Model.Notam.CreateNewRNotam(); newNotam.NotamCode = _notamcodeService.GetNotamCodes().Where(o => (o.Subject + o.Condition).Equals("KKKK")).FirstOrDefault(); List<Notam> AllNotams = _notamServiceLocal.GetAllNotams(); Notam ntm = AllNotams.Where(m => (m.NotamCode == newNotam.NotamCode)).OrderByDescending(x => x.Number).FirstOrDefault(); newNotam.Type = "A"; if (ntm != null) { newNotam.RefId = ntm.Id; newNotam.RefNum = ntm.Number; newNotam.RefYear = ntm.Year; newNotam.RefType = ntm.Type; newNotam.Type = ntm.Type; newNotam.FirAero = ntm.FirAero; } newNotam.EFreeText = strItemE; NotamViewModel workspace = new NotamViewModel(newNotam, _notamServiceLocal, parentWorkSpaces); parentWorkSpaces.Add(workspace); this.SetActiveWorkspace(workspace); } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message); } }
void CreateNewRNotam() { foreach (var obj in this.Workspaces) { if (obj.DisplayName == Entity.RNotamViewModel_DisplayName) { this.SetActiveWorkspace(obj); return; } } NOTAM.SERVICE.Model.Notam newNotam = NOTAM.SERVICE.Model.Notam.CreateNewRNotam(); NotamViewModel workspace = new NotamViewModel(newNotam, _notamService, Workspaces); this.Workspaces.Add(workspace); this.SetActiveWorkspace(workspace); }
void OnNotamAddedToRepository(object sender, EntityAddedEventArgs<Notam> e) { var viewModel = new NotamViewModel(e.NewEntity, _notamService); this.AllNotams.Add(viewModel); }
public MainWindowViewModel(NotamDataContext dataContext, Notam notam):this(dataContext) { NotamViewModel workspace = new NotamViewModel(notam, _notamService, Workspaces); this.Workspaces.Add(workspace); this.SetActiveWorkspace(workspace); }