public BookmarkClass(DbDataReader dr)
        {
            id = (long)dr["id"];
            if (System.DBNull.Value != dr["StarName"])
            {
                StarName = (string)dr["StarName"];
            }
            x = (double)dr["x"];
            y = (double)dr["y"];
            z = (double)dr["z"];

            DateTime t = (DateTime)dr["Time"];

            if (t < utcswitchover)      // dates before this was stupidly recorded in here in local time.
            {
                t = new DateTime(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second, DateTimeKind.Local);
                t = t.ToUniversalTime();
            }
            TimeUTC = t;

            if (System.DBNull.Value != dr["Heading"])
            {
                Heading = (string)dr["Heading"];
            }
            Note = (string)dr["Note"];
            if (System.DBNull.Value != dr["PlanetMarks"])
            {
                //System.Diagnostics.Debug.WriteLine("Planet mark {0} {1}", StarName, (string)dr["PlanetMarks"]);
                PlanetaryMarks = new PlanetMarks((string)dr["PlanetMarks"]);
            }
        }
 public void AddOrUpdatePlanetBookmark(string planet, string comment)
 {
     if (PlanetaryMarks == null)
     {
         PlanetaryMarks = new PlanetMarks();
     }
     PlanetaryMarks.AddOrUpdatePlanetBookmark(planet, comment);
     Update();
 }
 // with a found bookmark.. add locations in the system
 public void AddOrUpdateLocation(string planet, string placename, string comment, double latp, double longp)
 {
     if (PlanetaryMarks == null)
     {
         PlanetaryMarks = new PlanetMarks();
     }
     PlanetaryMarks.AddOrUpdateLocation(planet, placename, comment, latp, longp);
     Update();
 }
 public BookmarkClass(DataRow dr)
 {
     id = (long)dr["id"];
     if (System.DBNull.Value != dr["StarName"])
     {
         StarName = (string)dr["StarName"];
     }
     x    = (double)dr["x"];
     y    = (double)dr["y"];
     z    = (double)dr["z"];
     Time = (DateTime)dr["Time"];
     if (System.DBNull.Value != dr["Heading"])
     {
         Heading = (string)dr["Heading"];
     }
     Note = (string)dr["Note"];
     if (System.DBNull.Value != dr["PlanetMarks"])
     {
         PlanetaryMarks = new PlanetMarks((string)dr["PlanetMarks"]);
     }
 }
 public BookmarkClass(DbDataReader dr)
 {
     id = (long)dr["id"];
     if (System.DBNull.Value != dr["StarName"])
     {
         StarName = (string)dr["StarName"];
     }
     x    = (double)dr["x"];
     y    = (double)dr["y"];
     z    = (double)dr["z"];
     Time = (DateTime)dr["Time"];
     if (System.DBNull.Value != dr["Heading"])
     {
         Heading = (string)dr["Heading"];
     }
     Note = (string)dr["Note"];
     if (System.DBNull.Value != dr["PlanetMarks"])
     {
         //System.Diagnostics.Debug.WriteLine("Planet mark {0} {1}", StarName, (string)dr["PlanetMarks"]);
         PlanetaryMarks = new PlanetMarks((string)dr["PlanetMarks"]);
     }
 }
        // bk = null, new bookmark, else update.  isstar = true, region = false.
        public BookmarkClass AddOrUpdateBookmark(BookmarkClass bk, bool isstar, string name, double x, double y, double z, DateTime tme, string notes = null, PlanetMarks planetMarks = null)
        {
            System.Diagnostics.Debug.Assert(System.Windows.Forms.Application.MessageLoop);
            bool addit = bk == null;

            if (addit)
            {
                bk      = new BookmarkClass();
                bk.Note = "";       // set empty, in case notes==null
                globalbookmarks.Add(bk);
                System.Diagnostics.Debug.WriteLine("New bookmark created");
            }

            if (isstar)
            {
                bk.StarName = name;
            }
            else
            {
                bk.Heading = name;
            }

            bk.x              = x;
            bk.y              = y;
            bk.z              = z;
            bk.Time           = tme;
            bk.PlanetaryMarks = planetMarks ?? bk.PlanetaryMarks;
            bk.Note           = notes ?? bk.Note; // only override notes if its set.

            if (addit)
            {
                bk.Add();
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(GlobalBookMarkList.Instance.Bookmarks.Find((xx) => Object.ReferenceEquals(bk, xx)) != null);
                bk.Update();
            }

            System.Diagnostics.Debug.WriteLine("Write bookmark " + bk.Name + " Notes " + notes);

            OnBookmarkChange?.Invoke(bk, false);

            return(bk);
        }