public BankHoliday[] GetThisYearsBankHols(OriginCountry countryOfOrigin = OriginCountry.EnglandAndWales)
        {
            BankHolidaysData bankHolData = GetBankHolData();

            BankHoliday[] bankHols = bankHolData.GetAllYearsBankHols(countryOfOrigin);

            return(bankHols.Where(x => x.Date.Year == DateTime.Now.Year).ToArray());
        }
        public DateTime[] GetLastYearsBankHolDates(OriginCountry countryOfOrigin = OriginCountry.EnglandAndWales)
        {
            BankHolidaysData bankHolData = GetBankHolData();

            DateTime[] bankHols = bankHolData.GetAllYearsBankHolDates(countryOfOrigin);

            return(bankHols.Where(x => x.Year == DateTime.Now.Year - 1).ToArray());
        }
Example #3
0
 private void DeleteCountryButton_Click(object sender, EventArgs e)
 {
     var selectedRows = CountryTable.SelectedRows;
     foreach (DataGridViewRow row in selectedRows)
     {
         int id = Convert.ToInt32(row.Cells[0].Value);
         CountryManager.DeleteData(id);
         OriginCountry local = CountryList.Find(x => x.Id == id);
         CountryList.Remove(local);
     }
     UpdateOriginCountryTable();
 }
        public DateTime[] GetSpecifiedYearsBankHolDates(int year, OriginCountry countryOfOrigin = OriginCountry.EnglandAndWales)
        {
            BankHolidaysData bankHolData = GetBankHolData();

            DateTime[] bankHols = bankHolData.GetAllYearsBankHolDates(countryOfOrigin);

            if (!bankHols.Any(x => x.Year == year))
            {
                throw new ArgumentOutOfRangeException();
            }

            return(bankHols.Where(x => x.Year == year).ToArray());
        }
Example #5
0
 private void AddCountryButton_Click(object sender, EventArgs e)
 {
     try
     {
         OriginCountry local = new OriginCountry(Convert.ToInt32(IdTextBox.Text),
                                                 CountryTextBox.Text);
         MainForm main = Application.OpenForms["MainForm"] as MainForm;
         main.CountryList.Add(local);
         main.CountryManager.LoadData(local);
         main.UpdateOriginCountryTable();
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK);
     }
 }
 public void ApplyStateVector(StateVector stateVector, long version)
 {
     lock (_SyncLock) {
         LastSeenInOpenSkyUtc = DateTime.UtcNow;
         Version = Math.Max(Version, Callsign.UpdateValue(stateVector.Callsign, version));
         Version = Math.Max(Version, OriginCountry.UpdateValue(stateVector.OriginCountry, version));
         Version = Math.Max(Version, LastPositionTime.UpdateValue(stateVector.TimeOfLastPosition, version));
         Version = Math.Max(Version, LastMessageTime.UpdateValue(stateVector.TimeOfLastMessage, version));
         Version = Math.Max(Version, Latitude.UpdateValue(stateVector.Latitude, version));
         Version = Math.Max(Version, Longitude.UpdateValue(stateVector.Longitude, version));
         Version = Math.Max(Version, AltitudeFeet.UpdateValue(stateVector.AltitudeFeet, version));
         Version = Math.Max(Version, OnGround.UpdateValue(stateVector.OnGround, version));
         Version = Math.Max(Version, GroundSpeedKnots.UpdateValue(stateVector.GroundSpeedKnots, version));
         Version = Math.Max(Version, Track.UpdateValue(stateVector.Track, version));
         Version = Math.Max(Version, VerticalRateFeetPerSecond.UpdateValue(stateVector.VerticalRateFeetPerSecond, version));
         Version = Math.Max(Version, Squawk.UpdateValue(stateVector.Squawk, version));
         Version = Math.Max(Version, SpecialPurposeIndicator.UpdateValue(stateVector.SpecialPurposeIndicator, version));
         Version = Math.Max(Version, PositionSource.UpdateValue(stateVector.PositionSource, version));
     }
 }
        public DateTime[] GetAllYearsBankHolDates(OriginCountry countryOfOrigin = OriginCountry.EnglandAndWales)
        {
            switch (countryOfOrigin)
            {
            case OriginCountry.EnglandAndWales:
                return(EnglandAndWales.events.Select(x => DateTime.Parse(x.date))
                       .ToArray());

            case OriginCountry.Scotland:
                return(Scotland.events.Select(x => DateTime.Parse(x.date))
                       .ToArray());

            case OriginCountry.NorthernIreland:
                return(NorthernIreland.events.Select(x => DateTime.Parse(x.date))
                       .ToArray());

            default:
                return(EnglandAndWales.events.Select(x => DateTime.Parse(x.date))
                       .ToArray());
            }
        }
        public BankHoliday[] GetAllYearsBankHols(OriginCountry countryOfOrigin = OriginCountry.EnglandAndWales)
        {
            switch (countryOfOrigin)
            {
            case OriginCountry.EnglandAndWales:
                return(EnglandAndWales.events.Select(x => new BankHoliday(x.title, x.date))
                       .ToArray());

            case OriginCountry.Scotland:
                return(Scotland.events.Select(x => new BankHoliday(x.title, x.date))
                       .ToArray());

            case OriginCountry.NorthernIreland:
                return(NorthernIreland.events.Select(x => new BankHoliday(x.title, x.date))
                       .ToArray());

            default:
                return(EnglandAndWales.events.Select(x => new BankHoliday(x.title, x.date))
                       .ToArray());
            }
        }
Example #9
0
 public void Remove(OriginCountry originCountry)
 {
     _originCountryRepository.Remove(originCountry);
 }
Example #10
0
 public void Add(OriginCountry originCountry)
 {
     _originCountryRepository.Add(originCountry);
 }