예제 #1
0
 public WayPoint(TtPoint p)
     : base(p)
 {
     if (p.IsGpsType())
     {
         GpsCopy((GpsPoint)p);
         _op = TwoTrails.Engine.OpType.WayPoint;
     }
     else
     {
         DefaultGpsValues();
         _op = TwoTrails.Engine.OpType.WayPoint;
     }
 }
        public void DeletePoint(TtPoint p)
        {
            StringBuilder where = new StringBuilder();
            where.AppendFormat("{0} = '{1}'",
                TwoTrailsSchema.SharedSchema.CN,
                p.CN);

            SQLiteTransaction trans = _dbConnection.BeginTransaction();

            try
            {
                if (p.op == OpType.Quondam)
                {
                    DeleteLinkQuondam((QuondamPoint)p, trans);
                }

                DeletePoint(where.ToString(), trans);

                //delete nmea associated with the point
                if (p.IsGpsType())
                    DeleteNmeaBursts(p.CN, trans);

                trans.Commit();
            }
            catch (Exception ex)
            {
                TtUtils.WriteError(ex.Message, "DataAccessLayer:DeletePoint");
            }
            finally
            {
                trans.Dispose();
            }
        }