Beispiel #1
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = -2016528824;
                hashCode = hashCode * -1521134295 + ID.GetHashCode();
                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Username);

                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

                hashCode = hashCode * -1521134295 + Expiration.GetHashCode();
                hashCode = hashCode * -1521134295 + RegenSpan.GetHashCode();
                hashCode = hashCode * -1521134295 + RegenType.GetHashCode();
                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ErrorString);

                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RegenDescription);

                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ExpirationDisplay);

                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RegenPrompt);

                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DisplayName);

                hashCode = hashCode * -1521134295 + AircraftID.GetHashCode();
                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(TailNumber);

                hashCode = hashCode * -1521134295 + AircraftHours.GetHashCode();
                hashCode = hashCode * -1521134295 + Mode.GetHashCode();
                hashCode = hashCode * -1521134295 + UsesHours.GetHashCode();
                hashCode = hashCode * -1521134295 + IsSharedAircraftDeadline.GetHashCode();
                hashCode = hashCode * -1521134295 + HasAssociatedAircraft.GetHashCode();
                return(hashCode);
            }
        }
 protected void ResetDeadlineForm()
 {
     ckDeadlineUseHours.Checked        = false;
     cmbDeadlineAircraft.SelectedValue = (AircraftID > 0) ? AircraftID.ToString(CultureInfo.InvariantCulture) : string.Empty;
     SetNewDeadlineMode(false);
     txtDeadlineName.Text       = string.Empty;
     mfbDeadlineDate.Date       = DateTime.MinValue;
     decDueHours.Value          = decRegenInterval.IntValue = 0;
     ckDeadlineUseHours.Visible = false;
     rbRegenManual.Checked      = true;
     cpeDeadlines.ClientState   = "true";
 }
Beispiel #3
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            DeadlineCurrency dc = (DeadlineCurrency)obj;

            if (dc.AircraftID == AircraftID)
            {
                return(DisplayName.CompareCurrentCultureIgnoreCase(dc.DisplayName));
            }
            else
            {
                return(AircraftID.CompareTo(dc.AircraftID));
            }
        }
Beispiel #4
0
        public override LogbookEntry ToLogbookEntry()
        {
            OnDuty  = FixedUTCDateFromTime(Date, OnDuty);
            OffDuty = FixedUTCDateFromTime(Date, OffDuty, OnDuty);

            TimeOut = FixedUTCDateFromTime(Date, TimeOut);
            TimeIn  = FixedUTCDateFromTime(Date, TimeIn, TimeOut);

            List <string> lstApproachStrings = new List <string>()
            {
                Approach1, Approach2, Approach3, Approach4, Approach5, Approach6
            };
            StringBuilder sbApproaches = new StringBuilder();
            int           cApproaches  = 0;

            foreach (string szApproach in lstApproachStrings)
            {
                if (!String.IsNullOrWhiteSpace(szApproach))
                {
                    string szFixedApproach = Regex.Replace(szApproach, " ?\\(GPS\\)", "/GPS", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);
                    try
                    {
                        MatchCollection mc = regApproach.Matches(szFixedApproach);
                        foreach (Match m in mc)
                        {
                            ApproachDescription ad = new ApproachDescription(m);
                            sbApproaches.Append(ad.ToCanonicalString() + Resources.LocalizedText.LocalizedSpace + m.Groups["remark"].Value + Resources.LocalizedText.LocalizedSpace);
                            cApproaches += ad.Count;
                        }
                    }
                    catch (FormatException) { }
                }
            }

            StudentNames    = new List <string>();
            InstructorNames = new List <string>();
            ExaminerNames   = new List <string>();
            PassengerNames  = new List <string>();

            // try to parse people's role on the flight
            Person1 = AddToRole(Person1);
            Person2 = AddToRole(Person2);
            Person3 = AddToRole(Person3);
            Person4 = AddToRole(Person4);
            Person5 = AddToRole(Person5);
            Person6 = AddToRole(Person6);
            if (!String.IsNullOrEmpty(InstructorName))
            {
                InstructorNames.Add(InstructorName);
            }
            InstructorName = JoinStrings(InstructorNames);

            if (AircraftID == null)
            {
                AircraftID = string.Empty;
            }

            if (AircraftID.StartsWith(CountryCodePrefix.szSimPrefix, StringComparison.CurrentCultureIgnoreCase))
            {
                AircraftID = CountryCodePrefix.szSimPrefix;
            }

            string szModel = Regex.Replace(((String.IsNullOrEmpty(Model) ? TypeCode : Model) ?? string.Empty), " *[([]?SIM[)\\]]?$", String.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);

            LogbookEntry le = new LogbookEntry()
            {
                Date            = this.Date,
                ModelDisplay    = szModel,
                TailNumDisplay  = String.IsNullOrWhiteSpace(AircraftID) ? (SimulatedFlight > 0 ? CountryCodePrefix.SimCountry.Prefix : CountryCodePrefix.AnonymousCountry.Prefix) : AircraftID,
                Route           = rLatLon.Replace(JoinStrings(new string[] { From, Route, To }), (m) => { return("@" + m.Groups[1].Value + m.Groups[2].Value + m.Groups[3].Value + m.Groups[4].Value); }),
                EngineStart     = TimeOut,
                EngineEnd       = TimeIn,
                TotalFlightTime = TotalTime,
                PIC             = this.PIC,
                SIC             = this.SIC,
                Nighttime       = Night,
                CrossCountry    = CrossCountry,
                IMC             = ActualInstrument,
                SimulatedIFR    = SimulatedInstrument,
                CFI             = DualGiven,
                Dual            = DualReceived,
                GroundSim       = SimulatedFlight,

                FullStopLandings   = DayLandingsFullStop,
                NightLandings      = NightLandingsFullStop,
                Landings           = AllLandings,
                HobbsStart         = HobbsStart,
                HobbsEnd           = HobbsEnd,
                Approaches         = cApproaches,
                fHoldingProcedures = (Holds > 0),
                CFIName            = InstructorName,
                Comment            = JoinStrings(new string[] { PilotComments, Text, sbApproaches.ToString().Trim(), Person1, Person2, Person3, Person4, Person5, Person6 }),

                CustomProperties = PropertiesWithoutNullOrDefault(new CustomFlightProperty[]
                {
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropFlightDutyTimeStart, OnDuty, true),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropFlightDutyTimeEnd, OffDuty, true),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropSolo, Solo),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropNightTakeoff, NightTakeoffs),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropTachStart, TachStart),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropTachEnd, TachEnd),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropInstructorName, InstructorName),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropPassengerNames, JoinStrings(PassengerNames)),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropStudentName, JoinStrings(StudentNames)),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropNameOfExaminer, JoinStrings(ExaminerNames)),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropGroundInstructionGiven, DualGiven > 0 ? GroundTraining : 0),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropGroundInstructionReceived, DualReceived > 0 ? GroundTraining : 0),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropFlightReview, FlightReview),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropIPC, IPC),
                    PropertyWithValue(CustomPropertyType.KnownProperties.IDPropCheckRide, Checkride)
                }).ToArray()
            };

            return(le);
        }