Beispiel #1
0
        private void DateTimePickerLDGValueChanged(object sender, EventArgs e)
        {
            if (sender != dateTimePickerTakeOff && sender != dateTimePickerLDG)
            {
                return;
            }

            TimeSpan flightDifference =
                UsefulMethods.GetDifference(dateTimePickerLDG.Value.TimeOfDay,
                                            dateTimePickerTakeOff.Value.TimeOfDay);
            TimeSpan day =
                UsefulMethods.GetDifference(flightDifference,
                                            dateTimePickerNight.Value.TimeOfDay);

            textFlight.Text =
                UsefulMethods.TimeToString(flightDifference);
            textBoxDay.Text =
                UsefulMethods.TimeToString(day);

            if (sender == dateTimePickerTakeOff)
            {
                InvokeTakeOffTimeChanget(dateTimePickerTakeOff.Value);
            }
            if (sender == dateTimePickerLDG)
            {
                InvokeLDGTimeChanget(dateTimePickerLDG.Value);
            }
            InvokeFlightTimeChanget(flightDifference);
        }
Beispiel #2
0
        private void dateTimePickerTakeOffD_ValueChanged(object sender, EventArgs e)
        {
            if (sender != dateTimePickerTakeOffD && sender != dateTimePickerLDGD)
            {
                return;
            }

            var flightDifference = UsefulMethods.GetDifference(dateTimePickerLDGD.Value.TimeOfDay, dateTimePickerTakeOffD.Value.TimeOfDay);

            textFlightD.Text = UsefulMethods.TimeToString(flightDifference);
        }
Beispiel #3
0
 private void UpdateInformation()
 {
     Date             = currentAircraftFlight.FlightDate;
     FlightNo         = currentAircraftFlight.FlightNo;
     DirectionFrom    = currentAircraftFlight.StationFrom;
     DirectionTo      = currentAircraftFlight.StationTo;
     Reference        = currentAircraftFlight.Reference;
     FlightTimeFrom   = UsefulMethods.TimeToString(currentAircraftFlight.TakeOffTime);
     FlightTimeTo     = UsefulMethods.TimeToString(currentAircraftFlight.LdgTime);
     FlightTimePeriod = UsefulMethods.TimeToString(currentAircraftFlight.FlightTime);
     Correct          = currentAircraftFlight.Correct;
 }
Beispiel #4
0
        private void DateTimePickerNightValueChanged(object sender, EventArgs e)
        {
            TimeSpan flightDifference =
                UsefulMethods.GetDifference(dateTimePickerLDG.Value.TimeOfDay,
                                            dateTimePickerTakeOff.Value.TimeOfDay);
            TimeSpan day =
                UsefulMethods.GetDifference(flightDifference,
                                            dateTimePickerNight.Value.TimeOfDay);

            textBoxDay.Text =
                UsefulMethods.TimeToString(day);
        }
Beispiel #5
0
        /// <summary>
        /// Пользователь ввел изменения в интервал времени, изменяем разницу
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textTakeOffLDG_TextChanged(object sender, EventArgs e)
        {
            TimeSpan time1, time2;

            if (UsefulMethods.ParseTimePeriod(textTakeOffLDG.Text, out time1, out time2))
            {
                textFlight.Text = UsefulMethods.TimeToString(UsefulMethods.GetDifference(time2, time1));
            }
            else
            {
                textFlight.Text = "";
            }
        }
Beispiel #6
0
        private void textBoxFlightTime_LostFocus(object sender, EventArgs e)
        {
            TimeSpan time1;
            TimeSpan time2;

            if (TimeSpan.TryParse(textBoxFlightTimeFrom.Text, out time1) && TimeSpan.TryParse(textBoxFlightTimeTo.Text, out time2))
            {
                FlightTimePeriod = UsefulMethods.TimeToString(time2 - time1);
            }
            else
            {
                FlightTimePeriod = "";
            }
        }
        private string[] GetItemsString(AircraftFlight item)
        {
            Lifelength perMonth = GetPerMonth(sortedAircraftsFlights.IndexOf(item));
            Lifelength acTft    = GetAC_TFT(sortedAircraftsFlights.IndexOf(item));

            return(new[]
                   { item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()),
                     item.FlightNo,
                     item.StationFrom + " - " + item.StationTo,
                     "",
                     "",
                     UsefulMethods.TimeToString(item.FlightTime) + " (" + UsefulMethods.TimePeriodToString(item.TakeOffTime, item.LdgTime) + ")",
                     perMonth == null ? "" : perMonth.ToHoursMinutesAndCyclesFormat(),
                     acTft == null ? "" : acTft.ToHoursAndCyclesFormat("hrs", "cyc") });
        }
        protected override List <CustomCell> GetListViewSubItems(AircraftFlight item)
        {
            var subItems = new List <CustomCell>();

            var dateString = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var date       = item.FlightDate.Date.AddMinutes(item.OutTime);
            var aircraft   = $"{item.Aircraft} {item.Aircraft.Model.ShortName}";

            var route            = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
            var flightTimeString = UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)) + " (" +
                                   UsefulMethods.TimePeriodToString(new TimeSpan(0, 0, item.TakeOffTime, 0),
                                                                    new TimeSpan(0, 0, item.LDGTime, 0)) + ")";

            var perDaysFlight = Lifelength.Zero;
            var perDaysBlock  = Lifelength.Zero;
            var flights       = Flights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                              item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (var aircraftFlight in flights)
            {
                perDaysFlight.Add(aircraftFlight.FlightTimeLifelength);
                perDaysBlock.Add(aircraftFlight.BlockTimeLifelenght);
            }

            var author = GlobalObjects.CasEnvironment.GetCorrector(item);

            return(new List <CustomCell>
            {
                CreateRow(dateString, Tag = date),
                CreateRow(aircraft, item.Aircraft),
                CreateRow(item.Specialization.ToString(), item.Specialization),
                CreateRow(route, route),
                CreateRow(flightTimeString, item.FlightTime),
                CreateRow(UsefulMethods.TimeToString(item.BlockTime), item.BlockTime),
                CreateRow(perDaysFlight.ToHoursMinutesAndCyclesFormat("", ""), perDaysFlight),
                CreateRow(perDaysBlock.ToHoursMinutesAndCyclesFormat("", ""), perDaysBlock),
                CreateRow(item.NightTime.ToString(), item.NightTime),
                CreateRow(author, author)
            });
        }
Beispiel #9
0
        protected override List <CustomCell> GetListViewSubItems(AircraftFlight item)
        {
            var dateString = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());

            var timeString = "";

            if (item.AtlbRecordType != AtlbRecordType.Maintenance)
            {
                timeString = $"{UsefulMethods.TimeToString(TimeSpan.FromMinutes(item.OutTime))} - {UsefulMethods.TimeToString(TimeSpan.FromMinutes(item.InTime))}";
            }

            var date = item.FlightDate.Date;

            date = date.AddMinutes(item.OutTime);
            var author = GlobalObjects.CasEnvironment.GetCorrector(item);

            string route;

            if (item.AtlbRecordType != AtlbRecordType.Maintenance)
            {
                route = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
            }
            else
            {
                route = item.StationToId.ShortName;
            }


            return(new List <CustomCell>()
            {
                CreateRow(item.PageNo, item.PageNo),
                CreateRow(item.FlightNumber.ToString(), item.FlightNumber),
                CreateRow(dateString, item.FlightDate.Date),
                CreateRow(timeString, timeString),
                CreateRow(route, route),
                CreateRow(author, author),
            });
        }
Beispiel #10
0
        /*
         * События формы
         */

        #region private void TextOutInTextChanged(object sender, EventArgs e)
        ///// <summary>
        ///// Пользователь ввел изменения в интервал времени, изменяем разницу
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //private void TextOutInTextChanged(object sender, EventArgs e)
        //{
        //    TimeSpan time1, time2;
        //    if (UsefulMethods.ParseTimePeriod(textOutIn.Text, out time1, out time2))
        //    {
        //        textBlock.Text = UsefulMethods.TimeToString(UsefulMethods.GetDifference(time2, time1));
        //    }
        //    else
        //    {
        //        textBlock.Text = "";
        //    }
        //}
        #endregion

        #region private void TextTakeOffLDGTextChanged(object sender, EventArgs e)
        ///// <summary>
        ///// Пользователь ввел изменения в интервал времени, изменяем разницу
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //private void TextTakeOffLDGTextChanged(object sender, EventArgs e)
        //{
        //    TimeSpan time1, time2;
        //    if (UsefulMethods.ParseTimePeriod(textTakeOffLDG.Text, out time1, out time2))
        //    {
        //        textFlight.Text = UsefulMethods.TimeToString(UsefulMethods.GetDifference(time2, time1));
        //    }
        //    else
        //    {
        //        textFlight.Text = "";
        //    }
        //}
        #endregion

        #region private void TextOutInLeave(object sender, EventArgs e)
        ///// <summary>
        ///// Пользователь покидает поле ввода интервала, приводим к нужному формату
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //private void TextOutInLeave(object sender, EventArgs e)
        //{
        //    TimeSpan time1, time2;
        //    if (UsefulMethods.ParseTimePeriod(textOutIn.Text, out time1, out time2))
        //        textOutIn.Text = UsefulMethods.TimePeriodToString(time1, time2);
        //}
        #endregion

        #region private void TextTakeOffLDGLeave(object sender, EventArgs e)
        ///// <summary>
        ///// Пользователь покидает поле ввода интервала, приводим к нужному формату
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //private void TextTakeOffLDGLeave(object sender, EventArgs e)
        //{
        //    TimeSpan time1, time2;
        //    if (UsefulMethods.ParseTimePeriod(textTakeOffLDG.Text, out time1, out time2))
        //        textTakeOffLDG.Text = UsefulMethods.TimePeriodToString(time1, time2);
        //}
        #endregion

        /*
         * Реализация
         */

        #region private bool ValidateTimePeriod(TextBox textBox)
        ///// <summary>
        ///// Проверяем введенный интервал времени
        ///// </summary>
        ///// <returns></returns>
        //private bool ValidateTimePeriod(TextBox textBox)
        //{

        //    TimeSpan time1, time2;
        //    if (!UsefulMethods.ParseTimePeriod(textBox.Text, out time1, out time2))
        //    {

        //        SimpleBalloon.Show(textBox, ToolTipIcon.Warning, "Incorrect time format", "Please enter the time period in the following format:\nHH.MM - HH.MM");

        //        return false;
        //    }

        //    //
        //    return true;
        //}
        #endregion

        #region private void DateTimePickerOutValueChanged(object sender, EventArgs e)
        private void DateTimePickerOutValueChanged(object sender, EventArgs e)
        {
            if (sender != dateTimePickerIn && sender != dateTimePickerOut)
            {
                return;
            }
            textBlock.Text =
                UsefulMethods.TimeToString(UsefulMethods.GetDifference(dateTimePickerIn.Value.TimeOfDay,
                                                                       dateTimePickerOut.Value.TimeOfDay));

            if (sender == dateTimePickerOut)
            {
                InvokeOutTimeChanget(dateTimePickerOut.Value);

                dateTimePickerTakeOff.Value = dateTimePickerOut.Value;
            }
            if (sender == dateTimePickerIn)
            {
                InvokeInTimeChanget(dateTimePickerIn.Value);

                dateTimePickerLDG.Value = dateTimePickerIn.Value;
            }
        }
        protected override List <CustomCell> GetListViewSubItems(FlightPlanOpsRecords item)
        {
            var subItems = new List <CustomCell>();

            var ll = Lifelength.Null;

            var llColor = radGridView1.ForeColor;

            var flightNum          = item.FlightTrackRecord.FlightNo;
            var period             = item.FlightTrackRecord.FlightNumberPeriod;
            var aircraft           = item.Aircraft?.ToString() ?? "";
            var aircraftExchange   = item.AircraftExchange?.ToString() ?? "";
            var direction          = $"{period.StationFrom.ShortName} - {period.StationTo.ShortName}";
            var reasonDelay        = item.DelayReason?.ToString() ?? "";
            var reasonCansellation = item.CancelReason?.ToString() ?? "";
            var reason             = item.Reason?.ToString() ?? "";
            var status             = item.Status != OpsStatus.Unknown ? item.Status.ToString() : "";

            var depArrS           = $"{period.DepartureDate.Date.AddMinutes(period.PeriodFrom):HH:mm} - {period.DepartureDate.Date.AddMinutes(period.PeriodTo):HH:mm}";
            var flightDifferenceS = UsefulMethods.GetDifference(new TimeSpan(0, period.PeriodTo, 0), new TimeSpan(0, period.PeriodFrom, 0));
            var flightTimeS       = UsefulMethods.TimeToString(flightDifferenceS);

            var depArrD            = "";
            var flightTimeD        = "";
            var depDelayString     = "";
            var arrDelayString     = "";
            var arrEstimatedString = "";
            var author             = GlobalObjects.CasEnvironment.GetCorrector(item);

            if (item.IsDispatcherEdit && item.IsDispatcherEditLdg)
            {
                depArrD = $"{period.DepartureDate.Date.AddMinutes(item.PeriodFrom):HH:mm} - {period.DepartureDate.Date.AddMinutes(item.PeriodTo):HH:mm}";
                var flightDifferenceD = UsefulMethods.GetDifference(new TimeSpan(0, item.PeriodTo, 0), new TimeSpan(0, item.PeriodFrom, 0));
                flightTimeD = UsefulMethods.TimeToString(flightDifferenceD);


                if (item.PeriodFrom > period.PeriodFrom)
                {
                    var depDelay = UsefulMethods.GetDifference(new TimeSpan(0, item.PeriodFrom, 0), new TimeSpan(0, period.PeriodFrom, 0));
                    depDelayString = UsefulMethods.TimeToString(depDelay);

                    arrEstimatedString = UsefulMethods.TimeToString(new TimeSpan(0, period.PeriodTo, 0).Add(depDelay));
                }

                if (item.PeriodTo > period.PeriodTo)
                {
                    var arrDelay = UsefulMethods.GetDifference(new TimeSpan(0, item.PeriodTo, 0), new TimeSpan(0, period.PeriodTo, 0));
                    arrDelayString = UsefulMethods.TimeToString(arrDelay);
                }
            }
            else if (item.IsDispatcherEdit)
            {
                depArrD = $"{period.DepartureDate.Date.AddMinutes(item.PeriodFrom):HH:mm} - --:--";

                if (item.PeriodFrom > period.PeriodFrom)
                {
                    var depDelay = UsefulMethods.GetDifference(new TimeSpan(0, item.PeriodFrom, 0), new TimeSpan(0, period.PeriodFrom, 0));
                    depDelayString = UsefulMethods.TimeToString(depDelay);

                    arrEstimatedString = UsefulMethods.TimeToString(new TimeSpan(0, period.PeriodTo, 0).Add(depDelay));
                }
                else
                {
                    arrEstimatedString = UsefulMethods.TimeToString(period.DepartureDate.Date.AddMinutes(item.PeriodFrom).TimeOfDay.Add(flightDifferenceS));
                }
            }
            else if (item.ParentFlight != null)
            {
                if (item.ParentFlight.TakeOffTime > period.PeriodFrom)
                {
                    var depDelay = UsefulMethods.GetDifference(new TimeSpan(0, item.ParentFlight.TakeOffTime, 0), new TimeSpan(0, period.PeriodFrom, 0));
                    depDelayString = UsefulMethods.TimeToString(depDelay);
                }
            }

            var depArrF     = "";
            var flightTimeF = "";
            var flType      = item.FlightTrackRecord.FlightType.ToString();
            var flCat       = item.FlightTrackRecord.FlightCategory.ToString();

            if (item.ParentFlight != null)
            {
                flCat  = item.ParentFlight.FlightCategory.ToString();
                flType = item.FlightType.ToString();

                depArrF = $"{period.DepartureDate.Date.AddMinutes(item.ParentFlight.TakeOffTime):HH:mm} - {period.DepartureDate.Date.AddMinutes(item.ParentFlight.LDGTime):HH:mm}";
                var flightDifferenceF = UsefulMethods.GetDifference(new TimeSpan(0, item.ParentFlight.LDGTime, 0), new TimeSpan(0, item.ParentFlight.TakeOffTime, 0));
                flightTimeF = UsefulMethods.TimeToString(flightDifferenceF);

                if (_calculated)
                {
                    if (previousHasFlight)
                    {
                        previousHasFlight = true;
                        ll = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item.ParentFlight);
                    }
                    else
                    {
                        var lastll = _tempDict[item.ParentFlight.AircraftId].Last();
                        lastll.Add(new Lifelength(0, 1, (int)flightDifferenceF.TotalMinutes));
                        ll      = lastll;
                        llColor = Color.Orange;

                        previousHasFlight = false;
                    }

                    if (_tempDict.ContainsKey(item.ParentFlight.AircraftId))
                    {
                        _tempDict[item.ParentFlight.AircraftId].Add(ll);
                    }
                    else
                    {
                        _tempDict.Add(item.ParentFlight.AircraftId, new List <Lifelength> {
                            ll
                        });
                    }


                    _tempDict[item.ParentFlight.AircraftId].Add(ll);
                }
            }
            else
            {
                if (item.AircraftExchangeId > 0 || item.AircraftId > 0)
                {
                    var a = item.AircraftExchangeId > 0 ? item.AircraftExchange : item.Aircraft;
                    if (_tempDict.ContainsKey(a.ItemId))
                    {
                        var lastll = _tempDict[a.ItemId].Last();
                        lastll.Add(new Lifelength(0, 1, (int)flightDifferenceS.TotalMinutes));
                        ll = lastll;

                        _tempDict[a.ItemId].Add(ll);
                        llColor           = Color.Red;
                        previousHasFlight = false;
                    }
                    else
                    {
                        ll      = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnEndOfDay(a, item.Date);
                        llColor = Color.Red;
                        _tempDict.Add(a.ItemId, new List <Lifelength> {
                            ll
                        });
                    }
                }
            }

            var days = "";

            if (period.IsMonday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "1";
            }
            if (period.IsTuesday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "2";
            }
            if (period.IsWednesday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "3";
            }
            if (period.IsThursday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "4";
            }
            if (period.IsFriday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "5";
            }
            if (period.IsSaturday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "6";
            }
            if (period.IsSunday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "7";
            }

            subItems.Add(CreateRow(flightNum.ToString(), flightNum));
            subItems.Add(CreateRow(aircraft, item.Aircraft));
            subItems.Add(CreateRow(aircraftExchange, item.AircraftExchange));
            subItems.Add(CreateRow(status, item.Status));
            subItems.Add(CreateRow(reasonDelay, reasonDelay));
            subItems.Add(CreateRow(reasonCansellation, reasonCansellation));
            subItems.Add(CreateRow(reason, reason));
            subItems.Add(CreateRow(days, days));
            subItems.Add(CreateRow(direction, direction));
            subItems.Add(CreateRow(depArrS, depArrS));
            subItems.Add(CreateRow(flightTimeS, flightTimeS));
            subItems.Add(CreateRow(depArrD, depArrD));
            subItems.Add(CreateRow(flightTimeD, flightTimeD));
            subItems.Add(CreateRow(depDelayString, depDelayString));
            subItems.Add(CreateRow(arrEstimatedString, arrEstimatedString));
            subItems.Add(CreateRow(arrDelayString, arrDelayString));
            subItems.Add(CreateRow(depArrF, depArrF));
            subItems.Add(CreateRow(flightTimeF, flightTimeF));

            if (_calculated)
            {
                subItems.Add(CreateRow(ll.ToHoursMinutesAndCyclesFormat("", ""), ll, llColor));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
            }

            subItems.Add(CreateRow("", ""));
            subItems.Add(CreateRow("", ""));
            subItems.Add(CreateRow("", ""));
            subItems.Add(CreateRow("", ""));
            subItems.Add(CreateRow("", ""));
            subItems.Add(CreateRow(flType, flType));
            subItems.Add(CreateRow(flCat, flCat));
            subItems.Add(CreateRow(item.Remarks, item.Remarks));
            subItems.Add(CreateRow(item.HiddenRemarks, item.HiddenRemarks));
            subItems.Add(CreateRow(author, author));

            return(subItems);
        }
Beispiel #12
0
 private static string[] GetSubItemsString(AircraftFlight item)
 {
     return(new string[]
            { item.FlightNo, item.FlightDate.ToString(new TermsProvider()["DateFormat"].ToString()) + " " + UsefulMethods.TimeToString(item.OutTime) + " - " + UsefulMethods.TimeToString(item.InTime), item.StationFrom + " - " + item.StationTo, item.Discrepancies.Length > 0 ? "avaliable" : "" });
 }
Beispiel #13
0
        protected override List <CustomCell> GetListViewSubItems(IFlightNumberParams item)
        {
            var subItems = new List <CustomCell>();

            if (item is FlightNumber)
            {
                var flightNumber = item as FlightNumber;
                var author       = GlobalObjects.CasEnvironment.GetCorrector(flightNumber);

                subItems.Add(CreateRow(flightNumber.FlightNo.ToString(), Tag = flightNumber.FlightNo));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow(flightNumber.Description, flightNumber.Description));
                subItems.Add(CreateRow(flightNumber.Remarks, flightNumber.Remarks));
                subItems.Add(CreateRow(flightNumber.HiddenRemarks, flightNumber.HiddenRemarks));
                subItems.Add(CreateRow(author, author));
            }
            else
            {
                var    flightNumberPeriod = item as FlightNumberPeriod;
                var    author             = GlobalObjects.CasEnvironment.GetCorrector(flightNumberPeriod);
                string period;
                if (flightNumberPeriod.FlightType == FlightType.Schedule)
                {
                    period = $"{flightNumberPeriod.DepartureDate:dd-MMMM-yyyy} - {flightNumberPeriod.ArrivalDate:dd-MMMM-yyyy}";
                }
                else
                {
                    period = $"{flightNumberPeriod.DepartureDate:dd-MMMM-yyyy}";
                }

                var flightDifference = UsefulMethods.GetDifference(new TimeSpan(0, flightNumberPeriod.PeriodTo, 0), new TimeSpan(0, flightNumberPeriod.PeriodFrom, 0));
                var flightTime       = UsefulMethods.TimeToString(flightDifference);

                var aircrafts = "";

                foreach (var model in flightNumberPeriod.FlightNum.AircraftModels)
                {
                    aircrafts += $"{model.AircraftModel} ";
                }

                var days = "";
                if (flightNumberPeriod.IsMonday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "1";
                }
                if (flightNumberPeriod.IsTuesday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "2";
                }
                if (flightNumberPeriod.IsWednesday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "3";
                }
                if (flightNumberPeriod.IsThursday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "4";
                }
                if (flightNumberPeriod.IsFriday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "5";
                }
                if (flightNumberPeriod.IsSaturday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "6";
                }
                if (flightNumberPeriod.IsSunday)
                {
                    if (days != "")
                    {
                        days += " , ";
                    }
                    days += "7";
                }

                var departure = flightNumberPeriod.DepartureDate.Date.AddMinutes(flightNumberPeriod.PeriodFrom);
                var arrival   = flightNumberPeriod.DepartureDate.Date.AddMinutes(flightNumberPeriod.PeriodTo);

                var distance = $"{flightNumberPeriod.FlightNum.Distance} {flightNumberPeriod.FlightNum.DistanceMeasure}";

                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow(period, period));
                subItems.Add(CreateRow(days, days));
                subItems.Add(CreateRow(flightNumberPeriod.FlightNum.StationFrom.ToString(), flightNumberPeriod.FlightNum.StationFrom));
                subItems.Add(CreateRow(departure.ToString("HH:mm"), departure));
                subItems.Add(CreateRow(flightNumberPeriod.FlightNum.StationTo.ToString(), flightNumberPeriod.FlightNum.StationTo));
                subItems.Add(CreateRow(arrival.ToString("HH:mm"), arrival));
                subItems.Add(CreateRow(flightTime, flightTime));
                subItems.Add(CreateRow(aircrafts, aircrafts));
                subItems.Add(CreateRow(distance, flightNumberPeriod.FlightNum.Distance));
                subItems.Add(CreateRow(flightNumberPeriod.FlightNum.FlightAircraftCode.ToString(), flightNumberPeriod.FlightNum.FlightAircraftCode));
                subItems.Add(CreateRow(flightNumberPeriod.FlightNum.FlightType.ToString(), flightNumberPeriod.FlightNum.FlightType));
                subItems.Add(CreateRow(flightNumberPeriod.FlightNum.FlightCategory.ToString(), flightNumberPeriod.FlightNum.FlightCategory));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow(author, author));
            }

            return(subItems);
        }
Beispiel #14
0
        protected override List <CustomCell> GetListViewSubItems(AircraftFlight item)
        {
            //TODO (Evgenii Babak) : Вся логика должна быть в классе Calculator
            var subItems = new List <CustomCell>();

            var dateString = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var date       = item.FlightDate.Date.AddMinutes(item.OutTime);
            var atlb       = _atbs.GetItemById(item.ATLBId);
            var author     = GlobalObjects.CasEnvironment.GetCorrector(item);

            if (item.AtlbRecordType == AtlbRecordType.Flight)
            {
                var   route            = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
                var   flightTimeString = UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0));
                Color flightTimeColor;
                if (item.FlightTime.TotalMinutes == item.BlockTime.TotalMinutes)
                {
                    flightTimeColor = Color.Black;
                }
                else
                {
                    double persent = Math.Abs(1 - (item.FlightTime.TotalMinutes / item.BlockTime.TotalMinutes)) * 100;
                    if (persent <= 3)
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Green.Color);
                    }
                    else if (persent <= 10)
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Yellow.Color);
                    }
                    else
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Red.Color);
                    }
                }

                var perDaysFlight = Lifelength.Zero;
                var perDaysBlock  = Lifelength.Zero;
                var flights       = _flights.Where(f =>
                                                   f.AtlbRecordType != AtlbRecordType.Maintenance && f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                   item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();
                foreach (AircraftFlight aircraftFlight in flights)
                {
                    perDaysFlight.Add(aircraftFlight.FlightTimeLifelength);
                    perDaysBlock.Add(aircraftFlight.BlockTimeLifelenght);
                }


                subItems.Add(CreateRow(item.PageNo, item.PageNo));
                subItems.Add(CreateRow(dateString, date));
                subItems.Add(CreateRow(item.FlightNumber.ToString(), item.FlightNumber));
                subItems.Add(CreateRow(route, route));
                subItems.Add(CreateRow(flightTimeString, item.FlightTime, flightTimeColor));

                #region колонки для отображения наработок по двигателям и ВСУ

                foreach (BaseComponent baseComponent in _enginesAndAPU.Where(i =>
                                                                             i.BaseComponentType == BaseComponentType.Engine))
                {
                    bool shouldFillSubItems = false;

                    var baseComponentFlightLifeLenght = Lifelength.Null;

                    var lastKnownTransferRecBeforFlight =
                        baseComponent.TransferRecords.GetLastKnownRecord(item.FlightDate.Date);
                    if (lastKnownTransferRecBeforFlight != null &&
                        lastKnownTransferRecBeforFlight.DestinationObjectType == SmartCoreType.Aircraft &&
                        lastKnownTransferRecBeforFlight.DestinationObjectId == _parentAircraft.ItemId)
                    {
                        shouldFillSubItems = true;
                        var flightsWhichOccuredAfterInstallationOfBd = flights.Where(f =>
                                                                                     f.AtlbRecordType != AtlbRecordType.Maintenance &&
                                                                                     f.FlightDate.Date >= lastKnownTransferRecBeforFlight.RecordDate).ToList();

                        var perDaysFlightForBd = Lifelength.Zero;
                        var perDaysBlockForBd  = Lifelength.Zero;

                        foreach (var flight in flightsWhichOccuredAfterInstallationOfBd)
                        {
                            perDaysFlightForBd.Add(flight.FlightTimeLifelength);
                            perDaysBlockForBd.Add(flight.BlockTimeLifelenght);
                        }

                        baseComponentFlightLifeLenght =
                            GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(
                                baseComponent, item);
                    }

                    Color baseComponentTimeColor = Color.Black;
                    if (baseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        if (!last.ContainsKey(baseComponent.ItemId))
                        {
                            last.Add(baseComponent.ItemId, new List <AircraftFlight>());
                        }

                        if (shouldFillSubItems)
                        {
                            subItems.Add(CreateListViewSubItem(baseComponentTimeColor, baseComponentFlightLifeLenght));
                            var cp = WorkParams.FirstOrDefault(i =>
                                                               i.ComponentId == baseComponent.ItemId && i.GroundAir == GroundAir.Air);
                            var cc = OilConditions.FirstOrDefault(i =>
                                                                  i.ComponentId == baseComponent.ItemId && i.FlightId == item.ItemId);

                            var oilFlowMin  = cp?.OilFlowMin ?? 0;
                            var oilFlowNorm = cp?.OilFlowRecomended ?? 0;
                            var oilFlowMax  = cp?.OilFlowMax ?? 0;
                            var oilAdded    = cc?.OilAdded ?? 0;



                            var q = _flights
                                    .Where(f => f.AtlbRecordType != AtlbRecordType.Maintenance &&
                                           f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                           item.FlightDate.Date.AddMinutes(item.TakeOffTime))
                                    .OrderByDescending(i => i.FlightDate).ThenByDescending(i => i.TakeOffTime)
                                    .ToList();


                            var    spent           = cc?.Spent ?? 0;
                            double consumption     = 0;
                            double consumptionMean = 0;


                            if (oilAdded > 0)
                            {
                                if (last[baseComponent.ItemId].Any())
                                {
                                    if (last[baseComponent.ItemId].Last().ItemId != item.ItemId)
                                    {
                                        var  temp = new List <AircraftFlight>();
                                        bool flag = false;
                                        foreach (var aircraftFlight in q)
                                        {
                                            if (aircraftFlight.ItemId == last[baseComponent.ItemId].Last().ItemId)
                                            {
                                                flag = true;
                                            }
                                            if (flag)
                                            {
                                                temp.Add(aircraftFlight);
                                            }
                                        }

                                        foreach (var aircraftFlight in temp)
                                        {
                                            q.Remove(aircraftFlight);
                                        }
                                    }
                                }

                                var sumTime = q.Sum(i => i.FlightTime.TotalMinutes);
                                spent       = oilAdded / sumTime;
                                consumption = spent * 60.0;

                                if (!last[baseComponent.ItemId].Any(i => i.ItemId == item.ItemId))
                                {
                                    last[baseComponent.ItemId].Add(item);
                                }
                            }


                            if (!_consumptionMeans.ContainsKey(baseComponent.ItemId))
                            {
                                _consumptionMeans.Add(baseComponent.ItemId, new List <dynamic>());
                            }

                            _consumptionMeans[baseComponent.ItemId].Add(new { UpLift = cc?.OilAdded * 60 ?? 0, FlightTime = item.FlightTime.TotalMinutes });
                            consumptionMean = _consumptionMeans[baseComponent.ItemId].Sum(i => (double)i.UpLift) /
                                              _consumptionMeans[baseComponent.ItemId].Sum(i => (double)i.FlightTime);

                            subItems.Add(CreateListViewSubItem(oilAdded.ToString()));
                            subItems.Add(CreateListViewSubItem(oilFlowMin.ToString()));
                            subItems.Add(CreateListViewSubItem(oilFlowNorm.ToString()));
                            subItems.Add(CreateListViewSubItem(oilFlowMax.ToString()));
                            subItems.Add(CreateListViewSubItem(consumption.ToString("F")));
                            subItems.Add(CreateListViewSubItem(consumptionMean.ToString("F")));
                            subItems.Add(CreateListViewSubItem(GetStatus(oilFlowMin, oilFlowNorm, oilFlowMax, consumption)
                                                               .ToString()));


                            if (item.AtlbRecordType == AtlbRecordType.Flight && oilAdded > 0)
                            {
                                if (!_graph.Limits.ContainsKey(baseComponent))
                                {
                                    _graph.Limits.Add(baseComponent, new OilLimits()
                                    {
                                        Max    = oilFlowMax,
                                        Min    = oilFlowMin,
                                        Normal = oilFlowNorm
                                    });
                                }

                                if (!_graph.Graph.ContainsKey(baseComponent))
                                {
                                    _graph.Graph.Add(baseComponent, new Dictionary <Lifelength, dynamic>());
                                }


                                if (!_graph.Graph[baseComponent].ContainsKey(baseComponentFlightLifeLenght))
                                {
                                    _graph.Graph[baseComponent].Add(baseComponentFlightLifeLenght, new { Consumption = consumption, ConsumptionMean = consumptionMean });
                                }
                                //else throw new Exception("Такая наработка уже есть!");
                            }
                        }
                        else
                        {
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                        }
                    }
                }

                #endregion

                subItems.Add(CreateRow(atlb?.ATLBNo ?? "AtlB deleted", atlb?.ATLBNo));
                subItems.Add(CreateRow(author, author));
            }
            else
            {
                subItems.Add(CreateRow(item.PageNo, item.PageNo));
                subItems.Add(CreateRow(dateString, date));
                subItems.Add(CreateRow(item.FlightNumber.ToString(), item.FlightNumber));
                subItems.Add(CreateRow(item.StationToId.ShortName, item.StationToId.ShortName));
                subItems.Add(CreateRow("", ""));

                #region колонки для отображения наработок по двигателям и ВСУ

                foreach (var baseComponent in _enginesAndAPU)
                {
                    if (baseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                    }
                }

                #endregion

                subItems.Add(CreateRow(atlb?.ATLBNo, atlb?.ATLBNo));
                subItems.Add(CreateRow(author, author));
            }


            return(subItems);
        }
Beispiel #15
0
        protected override List <CustomCell> GetListViewSubItems(AircraftFlight item)
        {
            //TODO (Evgenii Babak) : Вся логика должна быть в классе Calculator
            var subItems = new List <CustomCell>();

            var dateString = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var date       = item.FlightDate.Date.AddMinutes(item.OutTime);
            var atlb       = _atbs.GetItemById(item.ATLBId);
            var author     = GlobalObjects.CasEnvironment.GetCorrector(item);

            if (item.AtlbRecordType == AtlbRecordType.Flight)
            {
                var route            = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
                var flightTimeString = UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)) + " (" +
                                       UsefulMethods.TimePeriodToString(new TimeSpan(0, 0, item.TakeOffTime, 0),
                                                                        new TimeSpan(0, 0, item.LDGTime, 0)) + ")";
                Color flightTimeColor;
                if (item.FlightTime.TotalMinutes == item.BlockTime.TotalMinutes)
                {
                    flightTimeColor = Color.Black;
                }
                else
                {
                    double persent = Math.Abs(1 - (item.FlightTime.TotalMinutes / item.BlockTime.TotalMinutes)) * 100;
                    if (persent <= 3)
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Green.Color);
                    }
                    else if (persent <= 10)
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Yellow.Color);
                    }
                    else
                    {
                        flightTimeColor = Color.FromArgb(Highlight.Red.Color);
                    }
                }
                var perDaysFlight = Lifelength.Zero;
                var perDaysBlock  = Lifelength.Zero;
                var flights       = _flights.Where(f => f.AtlbRecordType != AtlbRecordType.Maintenance && f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                   item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();
                foreach (AircraftFlight aircraftFlight in flights)
                {
                    perDaysFlight.Add(aircraftFlight.FlightTimeLifelength);
                    perDaysBlock.Add(aircraftFlight.BlockTimeLifelenght);
                }

                var aircraftFlightLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);
                var aircraftBlockLifelenght  = aircraftFlightLifelenght + (perDaysBlock - perDaysFlight);


                subItems.Add(CreateRow(item.PageNo, item.PageNo));
                subItems.Add(CreateRow(dateString, date));
                subItems.Add(CreateRow(item.FlightNumber.ToString(), item.FlightNumber));
                subItems.Add(CreateRow(route, route));
                subItems.Add(CreateRow(flightTimeString, item.FlightTime, flightTimeColor));
                subItems.Add(CreateRow(UsefulMethods.TimeToString(item.BlockTime), item.BlockTime, flightTimeColor));
                subItems.Add(CreateRow(perDaysFlight.ToHoursMinutesAndCyclesFormat("", ""), perDaysFlight));
                subItems.Add(CreateRow(perDaysBlock.ToHoursMinutesAndCyclesFormat("", ""), perDaysBlock));
                subItems.Add(CreateRow(aircraftFlightLifelenght.ToHoursMinutesAndCyclesFormat("", ""), aircraftFlightLifelenght));
                subItems.Add(CreateRow(aircraftBlockLifelenght.ToHoursMinutesAndCyclesFormat("", ""), aircraftFlightLifelenght));

                #region колонки для отображения наработок по двигателям и ВСУ

                foreach (BaseComponent baseComponent in _enginesAndAPU)
                {
                    bool shouldFillSubItems = false;

                    var baseComponentFlightLifeLenght = Lifelength.Null;
                    var baseComponentBlockLifeLenght  = Lifelength.Null;

                    var lastKnownTransferRecBeforFlight = baseComponent.TransferRecords.GetLastKnownRecord(item.FlightDate.Date);
                    if (lastKnownTransferRecBeforFlight != null &&
                        lastKnownTransferRecBeforFlight.DestinationObjectType == SmartCoreType.Aircraft &&
                        lastKnownTransferRecBeforFlight.DestinationObjectId == _parentAircraft.ItemId)
                    {
                        shouldFillSubItems = true;
                        var flightsWhichOccuredAfterInstallationOfBd = flights.Where(f => f.AtlbRecordType != AtlbRecordType.Maintenance && f.FlightDate.Date >= lastKnownTransferRecBeforFlight.RecordDate).ToList();

                        var perDaysFlightForBd = Lifelength.Zero;
                        var perDaysBlockForBd  = Lifelength.Zero;

                        foreach (var flight in flightsWhichOccuredAfterInstallationOfBd)
                        {
                            perDaysFlightForBd.Add(flight.FlightTimeLifelength);
                            perDaysBlockForBd.Add(flight.BlockTimeLifelenght);
                        }

                        baseComponentFlightLifeLenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(baseComponent, item);
                        baseComponentBlockLifeLenght  = baseComponentFlightLifeLenght + (perDaysBlockForBd - perDaysFlightForBd);
                    }

                    Color baseComponentTimeColor = Color.Black;

                    if (shouldFillSubItems && baseComponent.BaseComponentType != BaseComponentType.Apu)
                    {
                        var baseDetailFlightWorkTime = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelength(item, baseComponent);

                        if (item.FlightTime.TotalMinutes == Convert.ToDouble(baseDetailFlightWorkTime.TotalMinutes))
                        {
                            baseComponentTimeColor = Color.Black;
                        }
                        else
                        {
                            double persent = Math.Abs(1 - (Convert.ToDouble(baseDetailFlightWorkTime.TotalMinutes) / item.FlightTime.TotalMinutes)) * 100;
                            if (persent <= 3)
                            {
                                baseComponentTimeColor = Color.FromArgb(Highlight.Green.Color);
                            }
                            else if (persent <= 10)
                            {
                                baseComponentTimeColor = Color.FromArgb(Highlight.Yellow.Color);
                            }
                            else
                            {
                                baseComponentTimeColor = Color.FromArgb(Highlight.Red.Color);
                            }
                        }
                    }
                    var baseDetailHaveOverhaulDirective = BaseDetailHaveOverhaul(baseComponent);
                    var lastOverhaul = GetLastOverhaul(baseComponent);
                    if (baseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        if (shouldFillSubItems)
                        {
                            subItems.Add(CreateListViewSubItem(baseComponentTimeColor, baseComponentFlightLifeLenght));
                            subItems.Add(CreateListViewSubItem(Color.Black, baseComponentBlockLifeLenght));
                            if (baseDetailHaveOverhaulDirective)
                            {
                                if (lastOverhaul != null)
                                {
                                    var sinceOverhaulFlight = baseComponentFlightLifeLenght.IsGreater(lastOverhaul.OnLifelength)
                                                                                ? baseComponentFlightLifeLenght - lastOverhaul.OnLifelength
                                                                                : Lifelength.Null;

                                    subItems.Add(CreateListViewSubItem(Color.Black, sinceOverhaulFlight));

                                    var sinceOverhaulBlock = baseComponentBlockLifeLenght.IsGreater(lastOverhaul.OnLifelength)
                                                                                ? baseComponentBlockLifeLenght - lastOverhaul.OnLifelength
                                                                                : Lifelength.Null;

                                    subItems.Add(CreateListViewSubItem(Color.Black, sinceOverhaulBlock));
                                }
                                else
                                {
                                    subItems.Add(CreateListViewSubItem("N/A"));
                                    subItems.Add(CreateListViewSubItem("N/A"));
                                }
                            }
                        }
                        else
                        {
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            if (baseDetailHaveOverhaulDirective)
                            {
                                subItems.Add(CreateListViewSubItem(string.Empty));
                                subItems.Add(CreateListViewSubItem(string.Empty));
                            }
                        }
                    }
                    else if (baseComponent.BaseComponentType == BaseComponentType.Apu)
                    {
                        if (shouldFillSubItems)
                        {
                            subItems.Add(CreateListViewSubItem(baseComponentTimeColor, baseComponentFlightLifeLenght));
                            if (baseDetailHaveOverhaulDirective)
                            {
                                if (lastOverhaul != null)
                                {
                                    var sinceOverhaulFlight = baseComponentFlightLifeLenght - lastOverhaul.OnLifelength;
                                    subItems.Add(CreateListViewSubItem(Color.Black, sinceOverhaulFlight));
                                }
                                else
                                {
                                    subItems.Add(CreateListViewSubItem("N/A"));
                                }
                            }
                        }
                        else
                        {
                            subItems.Add(CreateListViewSubItem(string.Empty));
                            if (baseDetailHaveOverhaulDirective)
                            {
                                subItems.Add(CreateListViewSubItem(string.Empty));
                            }
                        }
                    }
                }

                #endregion

                subItems.Add(CreateRow(atlb?.ATLBNo ?? "AtlB deleted", atlb?.ATLBNo));
                subItems.Add(CreateRow(item.ListViewChecksPerformed, item.ListViewChecksPerformed));
                subItems.Add(CreateRow(author, author));
            }
            else
            {
                subItems.Add(CreateRow(item.PageNo, item.PageNo));
                subItems.Add(CreateRow(dateString, date));
                subItems.Add(CreateRow(item.FlightNumber.ToString(), item.FlightNumber));
                subItems.Add(CreateRow(item.StationToId.ShortName, item.StationToId.ShortName));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow("", ""));


                #region колонки для отображения наработок по двигателям и ВСУ

                foreach (var baseComponent in _enginesAndAPU)
                {
                    if (baseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        subItems.Add(CreateRow("", ""));
                        subItems.Add(CreateRow("", ""));
                        if (baseComponent.ComponentDirectives.Count(dd => dd.DirectiveType == ComponentRecordType.Overhaul) > 0)
                        {
                            subItems.Add(CreateRow("", ""));
                            subItems.Add(CreateRow("", ""));
                        }
                    }
                    else if (baseComponent.BaseComponentType == BaseComponentType.Apu)
                    {
                        subItems.Add(CreateRow("", ""));
                        if (baseComponent.ComponentDirectives.Count(dd => dd.DirectiveType == ComponentRecordType.Overhaul) > 0)
                        {
                            subItems.Add(CreateRow("", ""));
                        }
                    }
                }

                #endregion

                subItems.Add(CreateRow(atlb?.ATLBNo, atlb?.ATLBNo));
                subItems.Add(CreateRow(item.ListViewChecksPerformed, item.ListViewChecksPerformed));
                subItems.Add(CreateRow(author, author));
            }


            return(subItems);
        }
Beispiel #16
0
        private void AddAircraftFlightInformation(ATLBDataSet dataSet, AircraftFlight aircraftFlight)
        {
            var aircraft             = GlobalObjects.AircraftsCore.GetAircraftById(_currentATLB.ParentAircraftId);
            var currentOperator      = GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == aircraft.OperatorId);
            var operatorLogotype     = currentOperator.LogoTypeWhite;
            var operatorAddress      = currentOperator.Address;
            var revision             = _termsProvider["Revision"].ToString();
            var caaRequirements      = _termsProvider["CAARequirements"].ToString();
            var pageNumber           = (_currentPageNumber++).ToString().PadLeft(5, '0');//todo проверить
            var reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString();
            var reportFooterLink     = new GlobalTermsProvider()["ReportFooterLink"].ToString();
            var specialistCaptain    =
                aircraftFlight.GetSpecialistBySpecializationId(1);
            var specialistCopilot =
                aircraftFlight.GetSpecialistBySpecializationId(2);
            var specialistGroundEngineerAP =
                aircraftFlight.GetSpecialistBySpecializationId(3);
            var specialistGroundEngineerAVI =
                aircraftFlight.GetSpecialistBySpecializationId(4);
            var specialistLoadMaster =
                aircraftFlight.GetSpecialistBySpecializationId(5);
            var specialistQualityControl =
                aircraftFlight.GetSpecialistBySpecializationId(6);
            var captain                    = specialistCaptain == null ? "" : specialistCaptain.FirstName;
            var captainId                  = specialistCaptain == null ? "" : specialistCaptain.IdNo;
            var copilot                    = specialistCopilot == null ? "" : specialistCopilot.FirstName;
            var copilotId                  = specialistCopilot == null ? "" : specialistCopilot.IdNo;
            var groundEngineerAP           = specialistGroundEngineerAP == null ? "" : specialistGroundEngineerAP.FirstName;
            var groundEngineerApid         = specialistGroundEngineerAP == null ? "" : specialistGroundEngineerAP.IdNo;
            var groundEngineerAVI          = specialistGroundEngineerAVI == null ? "" : specialistGroundEngineerAVI.FirstName;
            var groundEngineerAviid        = specialistGroundEngineerAVI == null ? "" : specialistGroundEngineerAVI.IdNo;
            var loadMaster                 = specialistLoadMaster == null ? "" : specialistLoadMaster.FirstName;
            var loadMasterId               = specialistLoadMaster == null ? "" : specialistLoadMaster.IdNo;
            var qualityControl             = specialistQualityControl == null ? "" : specialistQualityControl.FirstName;
            var qualityControlId           = specialistQualityControl == null ? "" : specialistQualityControl.IdNo;
            var aircraftFlightNo           = aircraftFlight.FlightNumber.ToString();
            var aircraftFlightDate         = aircraftFlight.FlightDate.ToString(_termsProvider["DateFormat"].ToString());
            var stationFrom                = aircraftFlight.StationFromId.ShortName;
            var stationTo                  = aircraftFlight.StationToId.ShortName;
            var airborneTimeOut            = aircraftFlight.TimespanOutTime.ToString();     // UsefulMethods.TimeToString(aircraftFlight.OutTime);
            var airborneTimeIn             = aircraftFlight.TimespanInTime.ToString();      //UsefulMethods.TimeToString(aircraftFlight.InTime));
            var airborneTimeBlock          = aircraftFlight.BlockTime.ToString();
            var airborneTimeTakeOff        = aircraftFlight.TimespanTakeOffTime.ToString(); //UsefulMethods.TimeToString(aircraftFlight.TakeOffTime));
            var airborneTimeLDG            = aircraftFlight.TimespanLDGTime.ToString();     //UsefulMethods.TimeToString(aircraftFlight.LDGTime));
            var airborneTimeFlight         = aircraftFlight.FlightTime.ToString();          //UsefulMethods.TimeToString(aircraftFlight.FlightTime);
            var accumulatedTime            = "";                                            //todo
            var totalFlightTime            = "";                                            //aircraft.//todo
            var accumulatedLanding         = "";                                            //todo
            var totalFlightLanding         = "";                                            //todo
            var aircraftModel              = aircraft.Model.ToString();
            var aircraftRegistrationNumber = aircraft.RegistrationNumber;
            var aCheckLastExecutionD       = "";
            var aCheckLastExecutionH       = "";
            var aCheckNextDueD             = "";
            var aCheckNextDueH             = "";
            //  MaintenanceLimitation aCheckLimitation;// = GetCheck(Cas3MaintenanceTypeItem.Instance.ACheck);//GetCheck(MaintenanceCheckTypesCollection.Instance.ACheck);
            //if (aCheckLimitation != null)
            //{
            //    Main
            //    MaintenancePerformance aCheckLastPerformance = aCheckLimitation.LastPerformance as MaintenancePerformance;
            //    if (aCheckLastPerformance != null)
            //    {
            //        aCheckLastExecutionD = aCheckLastPerformance.RecordDate.ToString(termsProvider["DateFormat"].ToString());
            //        aCheckLastExecutionH = Math.Round(aCheckLastPerformance.Lifelength.Hours.TotalHours).ToString();
            //    }
            //    aCheckNextDueD = aircraft.ManufactureDate.AddTicks(aCheckLimitation.Next.Calendar.Ticks).ToString(termsProvider["DateFormat"].ToString());
            //    aCheckNextDueH = Math.Round(aCheckLimitation.Next.Hours.TotalHours).ToString();
            //}
            var aCheckLimitation = GetCheck(1 /*ACheck*/);

            if (aCheckLimitation != null)
            {
                MaintenanceCheckRecord aCheckLastPerformance = GetLastPerformanceForCheckType(1);
                if (aCheckLastPerformance != null)
                {
                    aCheckLastExecutionD = aCheckLastPerformance.RecordDate.ToString(_termsProvider["DateFormat"].ToString());
                    //    aCheckLastExecutionH = Math.Round(aCheckLastPerformance.Lifelength.Hours.TotalHours).ToString();
                }
                //aCheckNextDueD = aircraft.ManufactureDate.AddTicks(aCheckLimitation.Next.Calendar.Ticks).ToString(termsProvider["DateFormat"].ToString());
                //aCheckNextDueH = Math.Round(aCheckLimitation.Next.Hours.TotalHours).ToString();
            }
            var bCheckLastExecutionD = "";
            var bCheckLastExecutionH = "";
            var bCheckNextDueD       = "";
            var bCheckNextDueH       = "";
            var bCheckLimitation     = GetCheck(2 /*BCheck*/);

            if (bCheckLimitation != null)
            {
                MaintenanceCheckRecord bCheckLastPerformance = GetLastPerformanceForCheckType(2);
                if (bCheckLastPerformance != null)
                {
                    bCheckLastExecutionD = bCheckLastPerformance.RecordDate.ToString(_termsProvider["DateFormat"].ToString());
                    //    bCheckLastExecutionH = Math.Round(bCheckLastPerformance.Lifelength.Hours.TotalHours).ToString();
                }
                //bCheckNextDueD = aircraft.ManufactureDate.AddTicks(bCheckLimitation.Next.Calendar.Ticks).ToString(termsProvider["DateFormat"].ToString());
                //bCheckNextDueH = Math.Round(bCheckLimitation.Next.Hours.TotalHours).ToString();
            }
            var cCheckLastExecutionD = "";
            var cCheckLastExecutionH = "";
            var cCheckNextDueD       = "";
            var cCheckNextDueH       = "";
            var cCheckLimitation     = GetCheck(3 /*CCheck*/);

            if (cCheckLimitation != null)
            {
                MaintenanceCheckRecord cCheckLastPerformance = GetLastPerformanceForCheckType(3);
                if (cCheckLastPerformance != null)
                {
                    cCheckLastExecutionD = cCheckLastPerformance.RecordDate.ToString(_termsProvider["DateFormat"].ToString());
                    //    cCheckLastExecutionH = Math.Round(cCheckLastPerformance.Lifelength.Hours.TotalHours).ToString();
                }
                //cCheckNextDueD = aircraft.ManufactureDate.AddTicks(cCheckLimitation.Next.Calendar.Ticks).ToString(termsProvider["DateFormat"].ToString());
                //cCheckNextDueH = Math.Round(cCheckLimitation.Next.Hours.TotalHours).ToString();
            }
            var discrepancy1    = "";
            var discrepancy2    = "";
            var discrepancy3    = "";
            var discrepancy4    = "";
            var filledBy1       = "";
            var filledBy2       = "";
            var filledBy3       = "";
            var filledBy4       = "";
            var addNo1          = "";
            var addNo2          = "";
            var addNo3          = "";
            var addNo4          = "";
            var openClosePage1  = "";
            var openClosePage2  = "";
            var openClosePage3  = "";
            var openClosePage4  = "";
            var caDescription1  = "";
            var caDescription2  = "";
            var caDescription3  = "";
            var caDescription4  = "";
            var pnOn1           = "";
            var pnOn2           = "";
            var pnOn3           = "";
            var pnOn4           = "";
            var snOn1           = "";
            var snOn2           = "";
            var snOn3           = "";
            var snOn4           = "";
            var pnOff1          = "";
            var pnOff2          = "";
            var pnOff3          = "";
            var pnOff4          = "";
            var snOff1          = "";
            var snOff2          = "";
            var snOff3          = "";
            var snOff4          = "";
            var sta1            = "";
            var sta2            = "";
            var sta3            = "";
            var sta4            = "";
            var autorizationNo1 = "";
            var autorizationNo2 = "";
            var autorizationNo3 = "";
            var autorizationNo4 = "";
            var date1           = "";
            var date2           = "";
            var date3           = "";
            var date4           = "";

            if (aircraftFlight.Discrepancies.Count > 0)
            {
                FillDiscrepancyInformation(aircraftFlight.Discrepancies[0], out discrepancy1, out filledBy1, out addNo1, out openClosePage1, out caDescription1, out pnOn1, out snOn1, out pnOff1, out snOff1, out sta1, out autorizationNo1, out date1);
            }
            if (aircraftFlight.Discrepancies.Count > 1)
            {
                FillDiscrepancyInformation(aircraftFlight.Discrepancies[1], out discrepancy2, out filledBy2, out addNo2, out openClosePage2, out caDescription2, out pnOn2, out snOn2, out pnOff2, out snOff2, out sta2, out autorizationNo2, out date2);
            }
            if (aircraftFlight.Discrepancies.Count > 2)
            {
                FillDiscrepancyInformation(aircraftFlight.Discrepancies[2], out discrepancy3, out filledBy3, out addNo3, out openClosePage3, out caDescription3, out pnOn3, out snOn3, out pnOff3, out snOff3, out sta3, out autorizationNo3, out date3);
            }
            if (aircraftFlight.Discrepancies.Count > 3)
            {
                FillDiscrepancyInformation(aircraftFlight.Discrepancies[3], out discrepancy4, out filledBy4, out addNo4, out openClosePage4, out caDescription4, out pnOn4, out snOn4, out pnOff4, out snOff4, out sta4, out autorizationNo4, out date4);
            }
            var tank1Name         = "";
            var tank1RemainKg     = "";
            var tank1OnBoardKg    = "";
            var tank1CorrectionKg = "";
            var tank2Name         = "";
            var tank2RemainKg     = "";
            var tank2OnBoardKg    = "";
            var tank2CorrectionKg = "";
            var tank3Name         = "";
            var tank3RemainKg     = "";
            var tank3OnBoardKg    = "";
            var tank3CorrectionKg = "";
            var totalName         = aircraftFlight.FuelTankCollection.TotalFuel.Tank;
            var totalRemainKg     = aircraftFlight.FuelTankCollection.TotalFuel.Remaining.ToString();       //aircraftFlight.FuelTankCollection.TotalFuel.Remaining.ToString();
            var totalOnBoardKg    = aircraftFlight.FuelTankCollection.TotalFuel.OnBoard.ToString();         //aircraftFlight.FuelTankCollection.TotalFuel.OnBoard.ToString();
            var totalCorrectionKg = aircraftFlight.FuelTankCollection.TotalFuel.Correction.ToString();      //aircraftFlight.FuelTankCollection.TotalFuel.Correction.ToString();
            var calculateUpliftKg = "";
            var actualUpliftLit   = "";
            var discrepancy       = "";
            var density           = "";

            if (aircraftFlight.FuelTankCollection.Count > 0)
            {
                tank1Name         = aircraftFlight.FuelTankCollection[0].Tank;
                tank1RemainKg     = aircraftFlight.FuelTankCollection[0].Remaining.ToString();
                tank1OnBoardKg    = aircraftFlight.FuelTankCollection[0].OnBoard.ToString();
                tank1CorrectionKg = aircraftFlight.FuelTankCollection[0].Correction.ToString();
                calculateUpliftKg = aircraftFlight.FuelTankCollection[0].CalculateUplift.ToString();
                actualUpliftLit   = aircraftFlight.FuelTankCollection[0].ActualUpliftLit.ToString();
                discrepancy       = aircraftFlight.FuelTankCollection[0].Discrepancy.ToString();
                density           = aircraftFlight.FuelTankCollection[0].Density.ToString();
            }
            if (aircraftFlight.FuelTankCollection.Count > 1)
            {
                tank2Name         = aircraftFlight.FuelTankCollection[1].Tank;
                tank2RemainKg     = aircraftFlight.FuelTankCollection[1].Remaining.ToString();
                tank2OnBoardKg    = aircraftFlight.FuelTankCollection[1].OnBoard.ToString();
                tank2CorrectionKg = aircraftFlight.FuelTankCollection[1].Correction.ToString();
            }
            if (aircraftFlight.FuelTankCollection.Count > 2)
            {
                tank3Name         = aircraftFlight.FuelTankCollection[2].Tank;
                tank3RemainKg     = aircraftFlight.FuelTankCollection[2].Remaining.ToString();
                tank3OnBoardKg    = aircraftFlight.FuelTankCollection[2].OnBoard.ToString();
                tank3CorrectionKg = aircraftFlight.FuelTankCollection[2].Correction.ToString();
            }
            var added        = aircraftFlight.FluidsCondition.HydraulicFluidAdded.ToString();
            var onBoard      = aircraftFlight.FluidsCondition.HydraulicFluidOnBoard.ToString();
            var groundDeIce  = aircraftFlight.FluidsCondition.GroundDeIce ? "X" : "";
            var start        = aircraftFlight.FluidsCondition.AntiIcingStartTime.ToString();
            var end          = aircraftFlight.FluidsCondition.AntiIcingEndTime.ToString();   //UsefulMethods.TimeToString(aircraftFlight.FluidsCondition.AntiIcingEndTime);
            var fluidType    = aircraftFlight.FluidsCondition.AntiIcingFluidType;
            var aeaCode      = aircraftFlight.FluidsCondition.AEACode;
            var landingGear1 = "";
            var landingGear1TirePressure1 = "";
            var landingGear1TirePressure2 = "";
            var landingGear2 = "";
            var landingGear2TirePressure1 = "";
            var landingGear2TirePressure2 = "";
            var landingGear3 = "";
            var landingGear3TirePressure1 = "";
            var landingGear3TirePressure2 = "";

            if (aircraftFlight.LandingGearConditions.Count > 0)
            {
                //    landingGear1 = "";//UsefulMethods.GetLandingGearPositionName(aircraftFlight.LandingGearConditions[0].LandingGear);
                landingGear1 = aircraftFlight.LandingGearConditions[0].LandingGear.ToString();
                landingGear1TirePressure1 = aircraftFlight.LandingGearConditions[0].TirePressure1.ToString();
                landingGear1TirePressure2 = aircraftFlight.LandingGearConditions[0].TirePressure2.ToString();
            }
            if (aircraftFlight.LandingGearConditions.Count > 1)
            {
                //    landingGear2 = ""; //UsefulMethods.GetLandingGearPositionName(aircraftFlight.LandingGearConditions[1].LandingGear);
                landingGear2 = aircraftFlight.LandingGearConditions[1].LandingGear.ToString();
                landingGear2TirePressure1 = aircraftFlight.LandingGearConditions[1].TirePressure1.ToString();
                landingGear2TirePressure2 = aircraftFlight.LandingGearConditions[1].TirePressure2.ToString();
            }
            if (aircraftFlight.LandingGearConditions.Count > 2)
            {
                //     landingGear3 = ""; //UsefulMethods.GetLandingGearPositionName(aircraftFlight.LandingGearConditions[2].LandingGear);
                landingGear3 = aircraftFlight.LandingGearConditions[2].LandingGear.ToString();
                landingGear3TirePressure1 = aircraftFlight.LandingGearConditions[2].TirePressure1.ToString();
                landingGear3TirePressure2 = aircraftFlight.LandingGearConditions[2].TirePressure2.ToString();
            }
            var oilCSD1Name    = "";
            var oilCsd1Add     = "";
            var oilCsd1OnBoard = "";
            var oilCSD2Name    = "";
            var oilCsd2Add     = "";
            var oilCsd2OnBoard = "";
            var oilEng1Name    = "";
            var oilEng1Add     = "";
            var oilEng1OnBoard = "";
            var oilEng2Name    = "";
            var oilEng2Add     = "";
            var oilEng2OnBoard = "";
            var oilAPUName     = "";
            var oilAPUAdd      = "";
            var oilAPUOnBoard  = "";

            if (aircraftFlight.OilConditionCollection.Count > 0)
            {
                //oilCSD1Name = aircraftFlight.OilConditionCollection[0].DetailId;
                oilCsd1Add     = aircraftFlight.OilConditionCollection[0].OilAdded.ToString();
                oilCsd1OnBoard = aircraftFlight.OilConditionCollection[0].OnBoard.ToString();
            }
            if (aircraftFlight.OilConditionCollection.Count > 1)
            {
                //oilCSD2Name = aircraftFlight.OilConditionCollection[1].DetailId;
                oilCsd2Add     = aircraftFlight.OilConditionCollection[1].OilAdded.ToString();
                oilCsd2OnBoard = aircraftFlight.OilConditionCollection[1].OnBoard.ToString();
            }
            if (aircraftFlight.OilConditionCollection.Count > 2)
            {
                //oilEng1Name = aircraftFlight.OilConditionCollection[2].DetailId;
                oilEng1Add     = aircraftFlight.OilConditionCollection[2].OilAdded.ToString();
                oilEng1OnBoard = aircraftFlight.OilConditionCollection[2].OnBoard.ToString();
            }
            if (aircraftFlight.OilConditionCollection.Count > 3)
            {
                //oilEng2Name = aircraftFlight.OilConditionCollection[3].DetailId;
                oilEng2Add     = aircraftFlight.OilConditionCollection[3].OilAdded.ToString();
                oilEng2OnBoard = aircraftFlight.OilConditionCollection[3].OnBoard.ToString();
            }
            if (aircraftFlight.OilConditionCollection.Count > 4)
            {
                //oilAPUName = aircraftFlight.OilConditionCollection[4].DetailId;
                oilAPUAdd     = aircraftFlight.OilConditionCollection[4].OilAdded.ToString();
                oilAPUOnBoard = aircraftFlight.OilConditionCollection[4].OnBoard.ToString();
            }
            var pressAlt    = aircraftFlight.EnginesGeneralConditions.PressALT;
            var gmt         = UsefulMethods.TimeToString(aircraftFlight.EnginesGeneralConditions.TimeGMT);
            var grossWeight = aircraftFlight.EnginesGeneralConditions.GrossWeight.ToString();
            var ias         = aircraftFlight.EnginesGeneralConditions.IAS.ToString();
            var mach        = aircraftFlight.EnginesGeneralConditions.Mach.ToString();
            var tat         = aircraftFlight.EnginesGeneralConditions.TAT.ToString();
            var oat         = aircraftFlight.EnginesGeneralConditions.OAT.ToString();
            var releaseToServiceCheckPerformed = "";
            var releaseToServiceDate           = "";
            var releaseToServiceAuth           = "";

            if (aircraftFlight.CertificateOfReleaseToService != null)
            {
                releaseToServiceCheckPerformed = aircraftFlight.CertificateOfReleaseToService.CheckPerformed;
                releaseToServiceDate           = aircraftFlight.CertificateOfReleaseToService.RecordDate.ToString(_termsProvider["DateFormat"].ToString());
                if (aircraftFlight.CertificateOfReleaseToService.AuthorizationB1 != null)
                {
                    releaseToServiceAuth = aircraftFlight.CertificateOfReleaseToService.AuthorizationB1.ToString();
                }
                if (aircraftFlight.CertificateOfReleaseToService.AuthorizationB2 != null)
                {
                    releaseToServiceAuth = aircraftFlight.CertificateOfReleaseToService.AuthorizationB2.ToString();
                }
            }
            var engine1         = "";
            var engine2         = "";
            var epr1            = "";
            var epr2            = "";
            var n11             = "";
            var n12             = "";
            var egt1            = "";
            var egt2            = "";
            var n21             = "";
            var n22             = "";
            var oilTemperature1 = "";
            var oilTemperature2 = "";
            var oilPressure1    = "";
            var oilPressure2    = "";
            var fuelFlow1       = "";
            var fuelFlow2       = "";
            var fuelBnKg1       = "";
            var fuelBnKg2       = "";

            if (aircraftFlight.EngineConditionCollection.Count > 0)
            {
                engine1         = "Engine " + aircraftFlight.EngineConditionCollection[0].Engine.PositionNumber;
                epr1            = aircraftFlight.EngineConditionCollection[0].ERP.ToString();
                n11             = aircraftFlight.EngineConditionCollection[0].N1.ToString();
                egt1            = aircraftFlight.EngineConditionCollection[0].EGT.ToString();
                n21             = aircraftFlight.EngineConditionCollection[0].N2.ToString();
                oilTemperature1 = aircraftFlight.EngineConditionCollection[0].OilTemperature.ToString();
                oilPressure1    = aircraftFlight.EngineConditionCollection[0].OilPressure.ToString();
                fuelFlow1       = aircraftFlight.EngineConditionCollection[0].FuelFlow.ToString();
                fuelBnKg1       = aircraftFlight.EngineConditionCollection[0].FuelBurn.ToString();
            }
            if (aircraftFlight.EngineConditionCollection.Count > 1)
            {
                engine2         = "Engine " + aircraftFlight.EngineConditionCollection[1].Engine.PositionNumber;
                epr2            = aircraftFlight.EngineConditionCollection[1].ERP.ToString();
                n12             = aircraftFlight.EngineConditionCollection[1].N1.ToString();
                egt2            = aircraftFlight.EngineConditionCollection[1].EGT.ToString();
                n22             = aircraftFlight.EngineConditionCollection[1].N2.ToString();
                oilTemperature2 = aircraftFlight.EngineConditionCollection[1].OilTemperature.ToString();
                oilPressure2    = aircraftFlight.EngineConditionCollection[1].OilPressure.ToString();
                fuelFlow2       = aircraftFlight.EngineConditionCollection[1].FuelFlow.ToString();
                fuelBnKg2       = aircraftFlight.EngineConditionCollection[1].FuelBurn.ToString();
            }
            dataSet.AircraftFlightTable.AddAircraftFlightTableRow(operatorLogotype, operatorAddress, revision,
                                                                  caaRequirements, pageNumber, reportFooterPrepared,
                                                                  reportFooterLink, captain, captainId, copilot,
                                                                  copilotId,
                                                                  groundEngineerAP, groundEngineerApid,
                                                                  groundEngineerAVI, groundEngineerAviid, loadMaster,
                                                                  loadMasterId, qualityControl, qualityControlId,
                                                                  aircraftFlightNo, aircraftFlightDate, stationFrom,
                                                                  stationTo, airborneTimeOut, airborneTimeIn,
                                                                  airborneTimeBlock, airborneTimeTakeOff,
                                                                  airborneTimeLDG, airborneTimeFlight,
                                                                  accumulatedTime, totalFlightTime,
                                                                  accumulatedLanding, totalFlightLanding,
                                                                  aircraftModel, aircraftRegistrationNumber,
                                                                  aCheckLastExecutionD, aCheckLastExecutionH,
                                                                  aCheckNextDueD, aCheckNextDueH,
                                                                  bCheckLastExecutionD, bCheckLastExecutionH,
                                                                  bCheckNextDueD, bCheckNextDueH,
                                                                  cCheckLastExecutionD, cCheckLastExecutionH,
                                                                  cCheckNextDueD, cCheckNextDueH, discrepancy1,
                                                                  discrepancy2, discrepancy3, discrepancy4, filledBy1,
                                                                  filledBy2, filledBy3, filledBy4, addNo1, addNo2,
                                                                  addNo3, addNo4, openClosePage1, openClosePage2,
                                                                  openClosePage3, openClosePage4, caDescription1,
                                                                  caDescription2, caDescription3, caDescription4, pnOn1,
                                                                  pnOn2, pnOn3,
                                                                  pnOn4, snOn1, snOn2, snOn3, snOn4, pnOff1,
                                                                  pnOff2, pnOff3, pnOff4, snOff1, snOff2, snOff3,
                                                                  snOff4, sta1, sta2, sta3, sta4, autorizationNo1,
                                                                  autorizationNo2, autorizationNo3, autorizationNo4,
                                                                  date1, date2, date3, date4, tank1Name, tank1RemainKg,
                                                                  tank1OnBoardKg, tank1CorrectionKg, tank2Name,
                                                                  tank2RemainKg, tank2OnBoardKg, tank2CorrectionKg,
                                                                  tank3Name, tank3RemainKg, tank3OnBoardKg,
                                                                  tank3CorrectionKg, totalName, totalRemainKg,
                                                                  totalOnBoardKg, totalCorrectionKg, calculateUpliftKg,
                                                                  actualUpliftLit, discrepancy, density, added, onBoard,
                                                                  groundDeIce, start, end, fluidType, aeaCode,
                                                                  landingGear1, landingGear1TirePressure1,
                                                                  landingGear1TirePressure2, landingGear2,
                                                                  landingGear2TirePressure1, landingGear2TirePressure2,
                                                                  landingGear3, landingGear3TirePressure1,
                                                                  landingGear3TirePressure2,
                                                                  oilCSD1Name, oilCsd1Add, oilCsd1OnBoard, oilCSD2Name,
                                                                  oilCsd2Add, oilCsd2OnBoard, oilEng1Name, oilEng1Add,
                                                                  oilEng1OnBoard, oilEng2Name, oilEng2Add,
                                                                  oilEng2OnBoard, oilAPUName, oilAPUAdd, oilAPUOnBoard,
                                                                  pressAlt,
                                                                  gmt, grossWeight, ias, mach, tat, oat,
                                                                  releaseToServiceCheckPerformed, releaseToServiceDate,
                                                                  releaseToServiceAuth, engine1,
                                                                  engine2, epr1, epr2, n11, n12, egt1, egt2, n21,
                                                                  n22, oilTemperature1, oilTemperature2, oilPressure1,
                                                                  oilPressure2, fuelFlow1, fuelFlow2, fuelBnKg1,
                                                                  fuelBnKg2, _ATASpec);
            if (aircraftFlight.Discrepancies.Count > 4)
            {
                AddAdditionalAircraftFlightTableRow(dataSet, aircraftFlight, 4);
            }
        }
Beispiel #17
0
        protected override List <CustomCell> GetListViewSubItems(FlightTrackRecord item)
        {
            var aircrafts = "";
            var flightNo  = item.FlightNumberPeriod?.FlightNo.ToString();

            var flightDifference = UsefulMethods.GetDifference(new TimeSpan(0, item.FlightNumberPeriod.PeriodTo, 0), new TimeSpan(0, item.FlightNumberPeriod.PeriodFrom, 0));
            var flightTime       = UsefulMethods.TimeToString(flightDifference);

            var departure = item.FlightNumberPeriod.DepartureDate.Date.AddMinutes(item.FlightNumberPeriod.PeriodFrom);
            var arrival   = item.FlightNumberPeriod.DepartureDate.Date.AddMinutes(item.FlightNumberPeriod.PeriodTo);
            var author    = GlobalObjects.CasEnvironment.GetCorrector(item);
            var distance  = $"{item.FlightNumberPeriod.FlightNum.Distance} {item.FlightNumberPeriod.FlightNum.DistanceMeasure}";

            foreach (var model in item.FlightNumberPeriod.FlightNum.AircraftModels)
            {
                aircrafts += $"{model.AircraftModel} ";
            }

            var days = "";

            if (item.FlightNumberPeriod.IsMonday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "1";
            }
            if (item.FlightNumberPeriod.IsTuesday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "2";
            }
            if (item.FlightNumberPeriod.IsWednesday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "3";
            }
            if (item.FlightNumberPeriod.IsThursday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "4";
            }
            if (item.FlightNumberPeriod.IsFriday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "5";
            }
            if (item.FlightNumberPeriod.IsSaturday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "6";
            }
            if (item.FlightNumberPeriod.IsSunday)
            {
                if (days != "")
                {
                    days += " , ";
                }
                days += "7";
            }

            if (item.FlightType != FlightType.Schedule)
            {
                days += $" ({item.FlightNumberPeriod.DepartureDate:dd-MMMM-yyyy})";
            }

            return(new List <CustomCell>
            {
                CreateRow(flightNo, flightNo),
                CreateRow(aircrafts, aircrafts),
                CreateRow(days, days),
                CreateRow(item.FlightNumberPeriod.FlightNum.StationFrom.ToString(), item.FlightNumberPeriod.FlightNum.StationFrom),
                CreateRow(departure.ToString("HH:mm"), departure),
                CreateRow(item.FlightNumberPeriod.FlightNum.StationTo.ToString(), item.FlightNumberPeriod.FlightNum.StationTo),
                CreateRow(arrival.ToString("HH:mm"), arrival),
                CreateRow(flightTime, flightTime),
                CreateRow(distance, item.FlightNumberPeriod.FlightNum.Distance),
                CreateRow(item.FlightNumberPeriod.FlightNum.FlightAircraftCode.ToString(), item.FlightNumberPeriod.FlightNum.FlightAircraftCode),
                CreateRow(item.FlightNumberPeriod.FlightNum.FlightType.ToString(), item.FlightNumberPeriod.FlightNum.FlightType),
                CreateRow(item.FlightNumberPeriod.FlightNum.FlightCategory.ToString(), item.FlightNumberPeriod.FlightNum.FlightCategory),
                CreateRow(item.FlightNumberPeriod.FlightNum.Description, item.FlightNumberPeriod.FlightNum.Description),
                CreateRow(item.FlightNumberPeriod.FlightNum.Remarks, item.FlightNumberPeriod.FlightNum.Remarks),
                CreateRow(item.FlightNumberPeriod.FlightNum.HiddenRemarks, item.FlightNumberPeriod.FlightNum.HiddenRemarks),
                CreateRow(author, Tag = author)
            });
        }
        /// <summary>
        /// Обновляет значения полей
        /// </summary>
        public override void FillControls()
        {
            BeginUpdate();

            // Заполняем общие данные проведения измерений
            if (Flight != null && Flight.EnginesGeneralCondition != null)
            {
                textPressAlt.Text    = Flight.EnginesGeneralCondition.PressALT;
                textGMT.Text         = UsefulMethods.TimeToString(Flight.EnginesGeneralCondition.TimeGMT);
                textGrossWeight.Text = Flight.EnginesGeneralCondition.GrossWeight.ToString();
                textIAS.Text         = Flight.EnginesGeneralCondition.IAS.ToString();
                textMach.Text        = Flight.EnginesGeneralCondition.MACH.ToString();
                textTAT.Text         = Flight.EnginesGeneralCondition.TAT.ToString();
                textOAT.Text         = Flight.EnginesGeneralCondition.OAT.ToString();
            }
            else
            {
                textPressAlt.Text = textGMT.Text = textGrossWeight.Text = textIAS.Text = textMach.Text = textTAT.Text = textOAT.Text = "";
            }


            // Заполняем данные первого двигателя
            if (Flight != null && Flight.EngineConditions != null && Flight.EngineConditions.Length >= 1)
            {
                EngineCondition eng = Flight.EngineConditions[0];
                if (eng.Engine != null)
                {
                    labelEng1.Text = "ENG " + eng.Engine.PositionNumber;
                }
                else
                {
                    labelEng1.Text = "ENG #1";
                }
                textERP1.Text            = eng.EPR.ToString();
                textN11.Text             = eng.N1.ToString();
                textEGT1.Text            = eng.EGT.ToString();
                textN21.Text             = eng.N2.ToString();
                textOilTemperature1.Text = eng.OilTemperature.ToString();
                textOilPressure1.Text    = eng.OilPressure.ToString();
                textFuelFlow1.Text       = eng.FuelFlow.ToString();
                textFuelBurn1.Text       = eng.FuelBurn.ToString();
            }
            else
            {
                textERP1.Text          = textN11.Text = textEGT1.Text = textN21.Text = textOilTemperature1.Text = textOilPressure1.Text =
                    textFuelFlow1.Text = textFuelBurn1.Text = "";
            }

            // Заполняем данные второго двигателя
            if (Flight != null && Flight.EngineConditions != null && Flight.EngineConditions.Length >= 2)
            {
                EngineCondition eng = Flight.EngineConditions[1];
                if (eng.Engine != null)
                {
                    labelEng2.Text = "ENG " + eng.Engine.PositionNumber;
                }
                else
                {
                    labelEng2.Text = "ENG #2";
                }
                textERP2.Text            = eng.EPR.ToString();
                textN12.Text             = eng.N1.ToString();
                textEGT2.Text            = eng.EGT.ToString();
                textN22.Text             = eng.N2.ToString();
                textOilTemperature2.Text = eng.OilTemperature.ToString();
                textOilPressure2.Text    = eng.OilPressure.ToString();
                textFuelFlow2.Text       = eng.FuelFlow.ToString();
                textFuelBurn2.Text       = eng.FuelBurn.ToString();
            }
            else
            {
                textERP2.Text          = textN12.Text = textEGT2.Text = textN22.Text = textOilTemperature2.Text = textOilPressure2.Text =
                    textFuelFlow2.Text = textFuelBurn2.Text = "";
            }

            EndUpdate();
        }
Beispiel #19
0
        protected virtual void AddFlight(MonthlyUtilizationDataSet dataSet, AircraftFlight item, string groupName, int counter)
        {
            //TODO: (Evgenii Babak) сравнить подход в этом методе с подходом в MonthlyutilizationListView. Нужно вынести в отдельный метод BL
            var dateString       = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var route            = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
            var flightTimeString = UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)) + " (" +
                                   UsefulMethods.TimePeriodToString(new TimeSpan(0, 0, item.TakeOffTime, 0),
                                                                    new TimeSpan(0, 0, item.LDGTime, 0)) + ")";
            var perDays = Lifelength.Zero;
            var flights = _currentFlights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (var aircraftFlight in flights)
            {
                perDays.Add(aircraftFlight.FlightTimeLifelength);
            }
            var aircraftLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);

            #region колонки для отображения наработок по двигателям и ВСУ

            var engine1 = "";
            var engine2 = "";
            var apu     = "";
            if (_engine1 != null)
            {
                engine1 = GetFlightLifelengthStringForBaseDetail(_engine1, item);
            }
            if (_engine2 != null)
            {
                engine2 = GetFlightLifelengthStringForBaseDetail(_engine2, item);
            }
            if (_apu != null)
            {
                apu = GetFlightLifelengthStringForBaseDetail(_apu, item);
            }

            #endregion

            var color = UsefulMethods.GetColorName(item);
            if (!item.Correct)
            {
                color = "White";
            }
            //if(color=="") color = aircraftFlight.Highlight.Name;


            dataSet.Items.AddItemsRow(dateString,
                                      item.FlightNumber.ToString(),
                                      route,
                                      "",
                                      item.Reference,
                                      item.PageNo,
                                      "",
                                      "",
                                      "1",
                                      flightTimeString,
                                      perDays.ToHoursMinutesAndCyclesFormat("", ""),
                                      aircraftLifelenght.ToHoursMinutesAndCyclesFormat("", ""),
                                      "",
                                      groupName,
                                      counter.ToString(), engine1, "", engine2, "", apu, "", color);
        }
Beispiel #20
0
        protected override void AddFlight(MonthlyUtilizationDataSet dataSet, AircraftFlight item, string groupName, int counter)
        {
            string                dateString = SmartCore.Auxiliary.Convert.GetDateFormat(item.FlightDate);
            Lifelength            perDays    = Lifelength.Zero;
            List <AircraftFlight> flights    = Flights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                             item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (AircraftFlight aircraftFlight in flights)
            {
                perDays.Add(aircraftFlight.FlightTimeLifelength);
            }
            Lifelength aircraftLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);

            #region колонки для отображения наработок по двигателям и ВСУ

            Lifelength engine1 = Lifelength.Null;
            Lifelength engine2 = Lifelength.Null;
            Lifelength apu     = Lifelength.Null;
            if (_engine1 != null)
            {
                engine1 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine1, item);
            }
            if (_engine2 != null)
            {
                engine2 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine2, item);
            }
            if (_apu != null)
            {
                apu = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_apu, item);
            }

            #endregion

            string color = UsefulMethods.GetColorName(item);
            if (!item.Correct)
            {
                color = "White";
            }

            dataSet.Items.AddItemsRow(dateString,
                                      item.FlightNumber.ToString(),
                                      item.StationFromId.ShortName,
                                      item.StationToId.ShortName,
                                      item.Reference,
                                      item.PageNo,
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.TakeOffTime, 0)),
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.LDGTime, 0)),
                                      "1",
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)),
                                      perDays.ToHoursMinutesAndCyclesFormat("", ""),
                                      aircraftLifelenght.ToHoursMinutesFormat(""),
                                      aircraftLifelenght.Cycles != null ? aircraftLifelenght.Cycles.ToString() : "",
                                      groupName,
                                      counter.ToString(),
                                      engine1.ToHoursMinutesFormat(""),
                                      engine1.Cycles != null ? engine1.Cycles.ToString() : "",
                                      engine2.ToHoursMinutesFormat(""),
                                      engine2.Cycles != null ? engine2.Cycles.ToString() : "",
                                      apu.ToHoursMinutesFormat(""),
                                      apu.Cycles != null ? apu.Cycles.ToString() : "",
                                      color);
        }