Exemplo n.º 1
0
        private void Usertest() //用户数据库测试
        {
            using (SQLiteConnection conn = UserDatabase.GetDbConnection())
            {
                Debug.WriteLine(conn.DatabasePath.ToString());//找出数据库位置
                TableQuery <UserAccount> t = conn.Table <UserAccount>();
                var q = from s in t.AsParallel <UserAccount>()
                        orderby s.user_id
                        select s;

                useracccount.Clear();

                foreach (var temp in q)
                {
                    useracccount.Add(temp);
                }

                //StringBuilder msg = new StringBuilder();
                //msg.AppendLine($"数据库中总共 {useracccount.Count()} 个 user 对象。");

                /////测试数据库出来的实例location转换

                //foreach (var item in useracccount)
                //{
                //    msg.AppendLine($"Id:{item.user_id};Name:{item.name}");
                //}

                //new MessageDialog(msg.ToString()).ShowAsync();
            }
        }
Exemplo n.º 2
0
        public List <PartOfSpeechStorage> QueryPartOfSpeech(int _entry_id)
        {
            TableQuery <PartOfSpeechStorage>    t = Connection.Table <PartOfSpeechStorage>();
            ParallelQuery <PartOfSpeechStorage> q = from s in t.AsParallel()
                                                    where s.Entry_ID == _entry_id
                                                    select s;

            return(q.ToList());
        }
        public Pos_OfflineSource1 QueryPos(int _pos_id)
        {
            TableQuery <Pos_OfflineSource1>    t = Connection.Table <Pos_OfflineSource1>();
            ParallelQuery <Pos_OfflineSource1> q = from s in t.AsParallel()
                                                   where s.ID == _pos_id
                                                   select s;

            return(q.ToList()[0]);
        }
Exemplo n.º 4
0
        public List <MeanStorage> QueryMeans(Guid _definition_id)
        {
            TableQuery <MeanStorage>    t = Connection.Table <MeanStorage>();
            ParallelQuery <MeanStorage> q = from s in t.AsParallel()
                                            where s.Definition_ID == _definition_id
                                            select s;

            return(q.ToList());
        }
Exemplo n.º 5
0
        public WordNoteBookModel QueryByID(int ID)
        {
            TableQuery <WordNoteBookModel>    t = Connection.Table <WordNoteBookModel>();
            ParallelQuery <WordNoteBookModel> q = from s in t.AsParallel()
                                                  where s.ID == ID
                                                  select s;

            return(q.ToList()[0]);
        }
        public WordNoteModel Query(string _word, int _notebookid)
        {
            TableQuery <WordNoteModel>    t = Connection.Table <WordNoteModel>();
            ParallelQuery <WordNoteModel> q = from s in t.AsParallel()
                                              where s.Word == _word & s.WordNoteBookID == _notebookid
                                              select s;

            return(q.ToList()[0]);
        }
Exemplo n.º 7
0
        public int FindEntryID(string _word, int _dictionarysource_id)
        {
            TableQuery <WordsStorageModel>    t = Connection.Table <WordsStorageModel>();
            ParallelQuery <WordsStorageModel> q = from s in t.AsParallel()
                                                  where s.Word == _word & s.DictionarySource_ID == _dictionarysource_id
                                                  select s;

            return(q.ToList()[0].ID);
        }
Exemplo n.º 8
0
        public WordsStorageModel QueryEntry(int _word_id, int _dictionarysource_id)
        {
            TableQuery <WordsStorageModel>    t = Connection.Table <WordsStorageModel>();
            ParallelQuery <WordsStorageModel> q = from s in t.AsParallel()
                                                  where s.Word_ID == _word_id & s.DictionarySource_ID == _dictionarysource_id
                                                  select s;

            return(q.ToList()[0]);
        }
Exemplo n.º 9
0
        public int FindWordID(string _word)
        {
            TableQuery <Word>    t = Connection.Table <Word>();
            ParallelQuery <Word> q = from s in t.AsParallel()
                                     where s.Spelling == _word
                                     select s;

            return(q.ToList()[0].ID);
        }
        public List <WordHistoryModel> QueryAllOrderByIDDescending()
        {
            TableQuery <WordHistoryModel>    t = Connection.Table <WordHistoryModel>();
            ParallelQuery <WordHistoryModel> q = from s in t.AsParallel()
                                                 orderby s.ID descending
                                                 select s;

            return(q.ToList());
        }
        public List <Mean_OfflineSource1> QueryMean(int _word_id)
        {
            TableQuery <Mean_OfflineSource1>    t = Connection.Table <Mean_OfflineSource1>();
            ParallelQuery <Mean_OfflineSource1> q = from s in t.AsParallel()
                                                    where s.wordID == _word_id
                                                    select s;

            return(q.ToList());
        }
        public List <WordHistoryModel> QueryByTaskID(Guid taskID)
        {
            TableQuery <WordHistoryModel>    t = Connection.Table <WordHistoryModel>();
            ParallelQuery <WordHistoryModel> q = from s in t.AsParallel()
                                                 orderby s.ID descending
                                                 select s;

            return(q.ToList());
        }
Exemplo n.º 13
0
        public List <WordNoteBookModel> Query()
        {
            TableQuery <WordNoteBookModel>    t = Connection.Table <WordNoteBookModel>();
            ParallelQuery <WordNoteBookModel> q = from s in t.AsParallel()
                                                  orderby s.ID descending
                                                  select s;

            return(q.ToList());
        }
Exemplo n.º 14
0
        public List <DefinitionStroage> QueryDefinitions(int _entryid)
        {
            TableQuery <DefinitionStroage>    t = Connection.Table <DefinitionStroage>();
            ParallelQuery <DefinitionStroage> q = from s in t.AsParallel()
                                                  where s.Entry_ID == _entryid
                                                  select s;

            return(q.ToList());
        }
        public Words_OfflineSource1 QueryWord(string _word)
        {
            TableQuery <Words_OfflineSource1>    t = Connection.Table <Words_OfflineSource1>();
            ParallelQuery <Words_OfflineSource1> q = from s in t.AsParallel()
                                                     where s.word == _word
                                                     select s;
            var l = q.ToList();

            return(l.Count > 0 ? l[0] : null);
        }
        public WordHistoryModel QueryByID(int ID)
        {
            TableQuery <WordHistoryModel>    t = Connection.Table <WordHistoryModel>();
            ParallelQuery <WordHistoryModel> q = from s in t.AsParallel()
                                                 where s.ID == ID
                                                 select s;
            var l = q.ToList();

            return(l.Count > 0 ? l[0] : null);
        }
Exemplo n.º 17
0
        public List <WordNoteModel> QueryByNoteBookID(int _wordNoteBookID)
        {
            TableQuery <WordNoteModel>    t = Connection.Table <WordNoteModel>();
            ParallelQuery <WordNoteModel> q = from s in t.AsParallel()
                                              where s.WordNoteBookID == _wordNoteBookID
                                              orderby s.OrderedIndex ascending
                                              select s;

            return(q.ToList());
        }
Exemplo n.º 18
0
 public int Count()
 {
     try
     {
         TableQuery <WordNoteBookModel>    t = Connection.Table <WordNoteBookModel>();
         ParallelQuery <WordNoteBookModel> q = from s in t.AsParallel()
                                               select s;
         return(q.ToList().Count);
     }
     catch
     {
         return(0);
     }
 }
Exemplo n.º 19
0
        public bool IfEntryExist(string _word, int _dictionarysource_id)
        {
            TableQuery <WordsStorageModel>    t = Connection.Table <WordsStorageModel>();
            ParallelQuery <WordsStorageModel> q = from s in t.AsParallel()
                                                  where s.Word == _word & s.DictionarySource_ID == _dictionarysource_id
                                                  select s;

            if (q.ToList().Count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 20
0
        public bool IsWordSaved(string _word, int NoteBookID)
        {
            TableQuery <WordNoteModel>    t = Connection.Table <WordNoteModel>();
            ParallelQuery <WordNoteModel> q = from s in t.AsParallel()
                                              where s.Word == _word & s.WordNoteBookID == NoteBookID
                                              select s;

            if (q.ToList().Count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool IfWordExist(string _word)
        {
            TableQuery <Word>    t = Connection.Table <Word>();
            ParallelQuery <Word> q = from s in t.AsParallel()
                                     where s.Spelling == _word
                                     select s;

            if (q.ToList().Count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 22
0
        private void reNameBox_Loaded(object sender, RoutedEventArgs e)
        {
            using (SQLiteConnection conn = UserDatabase.GetDbConnection())
            {
                TableQuery <UserAccount> t = conn.Table <UserAccount>();
                var q = from s in t.AsParallel <UserAccount>()
                        orderby s.user_id
                        where s.user_id == this_account
                        select s;

                ///如何将用户登陆后的账户通信到这些页面呢??这个分支采用导航传参数

                foreach (var item in q)
                {
                    reNameBox.Text = item.nickname.ToString();
                }
            }
        }
Exemplo n.º 23
0
 public static ViewPostHelperClass GetVideoWatchRecord(string id)
 {
     using (var conn = GetDbConnection())
     {
         TableQuery <ViewPostHelperClass> t = conn.Table <ViewPostHelperClass>();
         var q = from s in t.AsParallel <ViewPostHelperClass>()
                 where s.epId == id
                 select s;
         if (q.ToList().Count != 0)
         {
             return(q.ToList()[0]);
         }
         else
         {
             return(null);
         }
     }
 }
Exemplo n.º 24
0
        //private void Ellipse_PointerPressed(object sender, PointerRoutedEventArgs e)
        //{

        //}



        private void dataload() //用于打开页面加载路程数据等方法
        {
            using (SQLiteConnection conn = UserDatabase.GetDbConnection())
            {
                TableQuery <UserAccount> t = conn.Table <UserAccount>();
                var q = from s in t.AsParallel <UserAccount>()
                        orderby s.user_id where s.user_id == this_account
                        select s;

                ///如何将用户登陆后的账户通信到这些页面呢??这个分支采用导航传参数

                foreach (var item in q)
                {
                    distanceText.Text   = item.in_distance.ToString();
                    savecarbonText.Text = item.carbon_save.ToString();
                    calText.Text        = item.calorie_cousume.ToString();
                    numberText.Text     = item.phonenumber.ToString();
                }
            }
        }
Exemplo n.º 25
0
 public static HistoryClass GetHistory(string id)
 {
     using (var conn = GetDbConnection())
     {
         //var dbPerson = conn.Table<CommicHistoryClass>();
         TableQuery <HistoryClass> t = conn.Table <HistoryClass>();
         var q = from s in t.AsParallel <HistoryClass>()
                 where s._aid == id
                 select s;
         // 绑定
         if (q.ToList().Count != 0)
         {
             return(q.ToList()[0]);
         }
         else
         {
             return(null);
         }
     }
 }
Exemplo n.º 26
0
        private void dataload() //用于打开页面加载路程数据等方法
        {
            using (SQLiteConnection conn = UserDatabase.GetDbConnection())
            {
                TableQuery <UserAccount> t = conn.Table <UserAccount>();
                var q = from s in t.AsParallel <UserAccount>()
                        orderby s.user_id
                        where s.user_id == this_account
                        select s;


                foreach (var item in q)
                {
                    nicknameText.Text = item.nickname.ToString();
                    nameText.Text     = item.name.ToString();
                    phoneText.Text    = item.phonenumber.ToString();
                    //headpictureE  如何设置头像?
                }
            }
        }
Exemplo n.º 27
0
        public int QueryMaxID()
        {
            int maxid = 0;
            TableQuery <WordNoteModel>    t = Connection.Table <WordNoteModel>();
            ParallelQuery <WordNoteModel> q = from s in t.AsParallel()
                                              select s;
            var list = q.ToList();

            if (list != null)
            {
                foreach (var item in list)
                {
                    while (item.ID >= maxid)
                    {
                        maxid++;
                    }
                }
                return(maxid);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 28
0
        private void Bicycletest() //单车数据库测试
        {
            using (SQLiteConnection conn = BicycleDatabase.GetDbConnection())
            {
                TableQuery <Bicycle> t = conn.Table <Bicycle>();
                var q = from s in t.AsParallel <Bicycle>()
                        orderby s.bicycle_id
                        select s;
                // 绑定

                bicycle.Clear();
                map.MapElements.Clear();

                foreach (var temp in q)
                {
                    bicycle.Add(temp);
                }


                foreach (var temp in bicycle.Select(temp => current_location_parse(temp.current_location))
                         .Select(temp => new Geopoint(new BasicGeoposition()
                {
                    Latitude = temp.x,
                    Longitude = temp.y,
                })).Select(temp => new MapIcon()
                {
                    Location = temp,
                    Image = RandomAccessStreamReference.
                            CreateFromUri(new Uri("ms-appx:///Assets/Bicycle.png")),
                }))
                {
                    map.MapElements.Add(temp);
                }

                #region
                //List<List<string>> lat_lon = new List<List<string>>();
                ////将现在位置存入
                //foreach (var item in bicycle)
                //{
                //    lat_lon.Add(item.current_location.Split(',').ToList());
                //}


                //List<Geopoint> bikepoint = new List<Geopoint>();

                //foreach (var item in lat_lon)
                //{
                //    bikepoint.Add(new Geopoint(new BasicGeoposition()
                //    {
                //        Latitude = double.Parse(item[0]),
                //        Longitude = double.Parse(item[1]),
                //    }));
                //}

                //List<MapIcon> bikeicon = new List<MapIcon>();

                //foreach (var item in bikepoint)
                //{
                //    bikeicon.Add(new MapIcon() { Location = item }); //单车图标未定

                //}

                //foreach (var item in bikeicon)
                //{
                //    map.MapElements.Add(item);
                //}
                #endregion
            }

            (double x, double y) current_location_parse(string current_location)
            {
                var str = current_location.Split(',');

                double.TryParse(str[0], out var x);
                double.TryParse(str[1], out var y);
                return(x, y);
            }
        }