Пример #1
0
        static void MakeUpRandomData()
        {
            var repo = new ContactDbRepo();

            foreach (var contact in repo.GetList())
            {
                repo.Delete(contact);
            }

            var calls = new[] { "M0LTE", "2E0XLX", "G4RDC", "2E0JPM", "2E1EPQ" };
            var bands = new[] { 21, 14, 7, 3.5, 1.8 };

            for (int i = 0; i < 10000; i++)
            {
                Debug.WriteLine(i);
                DateTime dt = DateTime.Now.AddDays(-1).AddSeconds(i * 10 + rnd.Next(0, 6));
                repo.Add(new ContactDbRow
                {
                    Band            = bands[rnd.Next(0, bands.Length)],
                    Operator        = calls[rnd.Next(0, calls.Length)],
                    Call            = MakeUpCallsign(),
                    ContestNumber   = 10,
                    IsMultiplier1   = rnd.Next(5) == 0,
                    StationName     = "stn-" + (rnd.Next(2) + 1),
                    TimestampUtc_dt = dt
                });
            }
        }
Пример #2
0
        static void DeleteContact(string n1mmTimestamp, string stationName)
        {
            var contactRepo = new ContactDbRepo(pathToDb);

            // search for which contact to delete by station name and timestamp
            if (DateTime.TryParse(n1mmTimestamp, out DateTime ts))
            {
                if (ts != new DateTime(1900, 1, 1, 0, 0, 0)) // for some reason n1mm passes us this in some circumstances, no idea what we're supposed to do with it
                {
                    if (!string.IsNullOrWhiteSpace(stationName))
                    {
                        var contacts = contactRepo.GetList(contactTime: ts, stationName: stationName);

                        foreach (var contact in contacts)
                        {
                            contactRepo.Delete(contact);
                        }
                    }
                }
            }
        }