Exemplo n.º 1
0
        private void avButtonAddCheck_Click(object sender, EventArgs e)
        {
            var newMTOP = new MTOPCheck {
                ParentAircraftId = _currentAircraft.ItemId
            };

            var form = new MTOPEditForm(newMTOP);

            if (form.ShowDialog() == DialogResult.OK)
            {
                _animatedThreadWorker.RunWorkerAsync();
            }
        }
Exemplo n.º 2
0
        public MTOPComplainceForm(MTOPCheck check, Aircraft aircraft, AverageUtilization averageUtilization) : this()
        {
            if (check == null)
            {
                return;
            }
            _aircraft           = aircraft;
            _averageUtilization = averageUtilization;

            _checkRecord = new MTOPCheckRecord
            {
                RecordDate = DateTime.Today,
                CheckName  = check.Name,
                GroupName  = check.Group,
                CalculatedPerformanceSource = check.NextPerformance.PerformanceSource,
                ParentId = check.ItemId
            };

            UpdateInformation();
        }
Exemplo n.º 3
0
        private void UpdateSchedule(List <MTOPCheck> maintenanceChecks, Dictionary <int, Lifelength> groupLifelengths)
        {
            listViewSchedule.Items.Clear();
            listViewSchedule.Columns.Clear();

            int       from;
            int       to;
            MTOPCheck firstCheck;
            MTOPCheck secondCheck = null;


            if (maintenanceChecks.Count > 1)
            {
                firstCheck  = maintenanceChecks.First();
                secondCheck = maintenanceChecks.Last();

                from = firstCheck.NextPerformance?.Group ?? groupLifelengths.Count;
                to   = secondCheck.NextPerformance?.Group ?? groupLifelengths.Count;
            }
            else if (maintenanceChecks.Count == 1)
            {
                firstCheck = maintenanceChecks.First();
                if (firstCheck.PerformanceRecords.Any())
                {
                    from = firstCheck.PerformanceRecords.OrderBy(i => i.GroupName).First().GroupName;
                    to   = firstCheck.NextPerformance?.Group ?? groupLifelengths.Count;
                }
                else
                {
                    from = firstCheck.NextPerformance?.Group ?? groupLifelengths.Count;
                    to   = firstCheck.NextPerformances.Count > 0 ? firstCheck.NextPerformances[1].Group : groupLifelengths.Count;
                }
            }
            else
            {
                return;
            }


            listViewSchedule.Columns.Add("Group", 60);
            listViewSchedule.Columns.Add("Repeat", 120);

            foreach (var lifelength in groupLifelengths)
            {
                string header;

                if (lifelength.Key < from)
                {
                    continue;
                }

                if (lifelength.Key > to)
                {
                    continue;
                }

                if (lifelength.Key == from)
                {
                    header = $"{firstCheck.Name}({lifelength.Key}) {firstCheck.NextPerformance?.PerformanceSource.Hours}FH";
                }
                else if (secondCheck != null && lifelength.Key == secondCheck.Group)
                {
                    header = $"{secondCheck.Name}({lifelength.Key}) {lifelength.Value.Hours}FH";
                }
                else
                {
                    header = $"{firstCheck.Name}({lifelength.Key}) {lifelength.Value.Hours}FH";
                }


                listViewSchedule.Columns.Add(header, 120);
            }

            foreach (var item in maintenanceChecks)
            {
                var subItems = new List <ListViewItem.ListViewSubItem>();

                var startFrom = item.NextPerformance?.Group ?? groupLifelengths.Count;
                var tempHours = groupLifelengths.ContainsKey(startFrom) ? groupLifelengths[startFrom].Days : groupLifelengths[item.Group].Days;

                var subItem = new ListViewItem.ListViewSubItem {
                    Text = item.Name
                };
                subItems.Add(subItem);

                subItem = new ListViewItem.ListViewSubItem {
                    Text = item.Repeat.ToRepeatIntervalsFormat()
                };
                subItems.Add(subItem);

                foreach (var lifelength in groupLifelengths)
                {
                    if (lifelength.Key < from)
                    {
                        continue;
                    }

                    if (lifelength.Key > to)
                    {
                        continue;
                    }

                    if (tempHours == lifelength.Value.Days)
                    {
                        if (item.PhaseRepeat != null && !item.PhaseRepeat.IsNullOrZero())
                        {
                            tempHours += item.PhaseRepeat.Days;
                        }
                        else
                        {
                            tempHours += item.PhaseThresh.Days;
                        }

                        subItem = new ListViewItem.ListViewSubItem {
                            Text = "x", Tag = ""
                        };
                    }
                    else
                    {
                        subItem = new ListViewItem.ListViewSubItem {
                            Text = "", Tag = ""
                        }
                    };

                    subItems.Add(subItem);
                }

                listViewSchedule.Groups.Add(item.CheckType.FullName, item.CheckType.FullName);
                var newItem = new ListViewItem(subItems.ToArray(), null)
                {
                    Group = listViewSchedule.Groups[item.CheckType.FullName]
                };

                listViewSchedule.Items.Add(newItem);
            }
        }
Exemplo n.º 4
0
        public MTOPEditForm(MTOPCheck check) : this()
        {
            _currentCheck = check;

            UpdateInformation();
        }