Exemple #1
0
        private bool GetMyFinds()
        {
            List <Framework.Data.Geocache> gcList = Utils.DataAccess.GetFoundGeocaches(_core.Geocaches, _core.Logs, _core.GeocachingComAccount);

            _myFinds = new List <MyGeocacheFind>();
            string tl = _core.GeocachingComAccount.AccountName.ToLower();

            foreach (Framework.Data.Geocache gc in gcList)
            {
                if (gc.Code.StartsWith("GC"))
                {
                    MyGeocacheFind mf = new MyGeocacheFind();
                    mf.gc = gc;
                    mf.lg = (from Framework.Data.Log l in _core.Logs where l.GeocacheCode == gc.Code && l.Finder.ToLower() == tl && l.LogType.AsFound orderby l.Date descending select l).FirstOrDefault();
                    if (mf.lg != null)
                    {
                        mf.logDate        = mf.lg.Date;
                        mf.logDateForSort = mf.lg.Date;
                        int logid = 0;
                        if (mf.lg.ID.StartsWith("GL"))
                        {
                            logid = Utils.Conversion.GetCacheIDFromCacheCode(mf.lg.ID);
                        }
                        else
                        {
                            int.TryParse(mf.lg.ID, out logid);
                        }
                        mf.logDateForSort.AddMilliseconds(logid);
                    }
                    else
                    {
                        _myFinds = null;
                        return(false);
                    }
                    _myFinds.Add(mf);
                }
            }
            _myFinds.Sort(delegate(MyGeocacheFind a, MyGeocacheFind b)
            {
                int cv = a.logDate.CompareTo(b.logDate);
                if (cv == 0)
                {
                    return(a.logDateForSort.CompareTo(b.logDateForSort));
                }
                else
                {
                    return(cv);
                }
            });
            return(true);
        }
Exemple #2
0
 private void GetMyFinds()
 {
     List<Geocache> gcList = DataAccess.GetFoundGeocaches(_core.Geocaches, _core.Logs, _core.GeocachingComAccount);
     _myFinds = new List<MyGeocacheFind>();
     string tl = _core.GeocachingComAccount.AccountName.ToLower();
     foreach (Geocache gc in gcList)
     {
         MyGeocacheFind mf = new MyGeocacheFind();
         mf.gc = gc;
         mf.lg = (from Log l in _core.Logs where l.GeocacheCode == gc.Code && l.Finder.ToLower() == tl && l.LogType.AsFound orderby l.Date descending select l).FirstOrDefault();
         if (mf.lg != null)
         {
             mf.logDate = mf.lg.Date;
             mf.logDateForSort = mf.lg.Date;
             int logid = 0;
             if (mf.lg.ID.StartsWith("GL"))
             {
                 logid = Conversion.GetCacheIDFromCacheCode(mf.lg.ID);
             }
             else
             {
                 try
                 {
                     logid = int.Parse(mf.lg.ID);
                 }
                 catch
                 {
                 }
             }
             mf.logDateForSort.AddMilliseconds(logid);
         }
         else
         {
             mf.logDate = DateTime.MinValue;
             mf.logDateForSort = DateTime.MinValue;
         }
         _myFinds.Add(mf);
     }
     _myFinds.Sort(delegate(MyGeocacheFind a, MyGeocacheFind b)
     {
         return a.logDateForSort.CompareTo(b.logDateForSort);
     });
 }
Exemple #3
0
 private bool GetMyFinds()
 {
     List<Framework.Data.Geocache> gcList = Utils.DataAccess.GetFoundGeocaches(_core.Geocaches, _core.Logs, _core.GeocachingComAccount);
     _myFinds = new List<MyGeocacheFind>();
     string tl = _core.GeocachingComAccount.AccountName.ToLower();
     foreach (Framework.Data.Geocache gc in gcList)
     {
         if (gc.Code.StartsWith("GC"))
         {
             MyGeocacheFind mf = new MyGeocacheFind();
             mf.gc = gc;
             mf.lg = (from Framework.Data.Log l in _core.Logs where l.GeocacheCode == gc.Code && l.Finder.ToLower() == tl && l.LogType.AsFound orderby l.Date descending select l).FirstOrDefault();
             if (mf.lg != null)
             {
                 mf.logDate = mf.lg.Date;
                 mf.logDateForSort = mf.lg.Date;
                 int logid = 0;
                 if (mf.lg.ID.StartsWith("GL"))
                 {
                     logid = Utils.Conversion.GetCacheIDFromCacheCode(mf.lg.ID);
                 }
                 else
                 {
                     int.TryParse(mf.lg.ID, out logid);
                 }
                 mf.logDateForSort.AddMilliseconds(logid);
             }
             else
             {
                 _myFinds = null;
                 return false;
             }
             _myFinds.Add(mf);
         }
     }
     _myFinds.Sort(delegate(MyGeocacheFind a, MyGeocacheFind b)
     {
         int cv = a.logDate.CompareTo(b.logDate);
         if (cv == 0) { return a.logDateForSort.CompareTo(b.logDateForSort); }
         else return cv;
     });
     return true;
 }