Пример #1
0
        public List <SystemTrayApp.SharedItems.CopyItems> getRecords()
        {
            try
            {
                List <SystemTrayApp.SharedItems.CopyItems> clsList = new List <SystemTrayApp.SharedItems.CopyItems>();

                SQLiteCommand cmd = conn.CreateCommand();
                cmd.CommandText = "select * from KeyWord";
                SQLiteDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    SystemTrayApp.SharedItems.CopyItems cls = new SystemTrayApp.SharedItems.CopyItems();
                    cls.Date    = Convert.ToDateTime(dr["DateOfRecord"]);
                    cls.Text    = (string)dr["ClipBoardText"];
                    cls.Keyword = (string)dr["RemainderText"];
                    cls.Id      = Convert.ToInt32(dr["id"]);
                    //yield return cls;
                    clsList.Add(cls);
                    //Thread.Sleep(1000);
                }
                return(clsList);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Пример #2
0
 public void UpdateRecord(SystemTrayApp.SharedItems.CopyItems cls)
 {
     try
     {
         SQLiteCommand cmd = conn.CreateCommand();
         cmd.CommandText = string.Format("Update KeyWord set DateOfRecord= datetime(CURRENT_TIMESTAMP, 'localtime'),RemainderText= {0}where id ={1}", cls.Keyword, cls.Id);
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
     }
 }
Пример #3
0
        public async void insertRecord(SystemTrayApp.SharedItems.CopyItems cls)
        {
            try
            {
                string sql2 = "insert into KeyWord (id,DateOfRecord, ClipBoardText,RemainderText) values (NULL,datetime(CURRENT_TIMESTAMP, 'localtime'), '" + cls.Text + "','" + cls.Keyword + "')";

                SQLiteCommand command1 = new SQLiteCommand(sql2, conn);


                command1.ExecuteNonQuery();

                //return true;
            }
            catch (Exception ex)
            {
                //return false;
            }
        }
Пример #4
0
 public SystemTrayApp.SharedItems.CopyItems GetRecordByText(string text)
 {
     try
     {
         SQLiteCommand cmd = conn.CreateCommand();
         cmd.CommandText = string.Format("select * from KeyWord where ClipBoardText ='{0}'", text);
         SQLiteDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             SystemTrayApp.SharedItems.CopyItems cls = new SystemTrayApp.SharedItems.CopyItems();
             cls.Date    = Convert.ToDateTime(dr["DateOfRecord"]);
             cls.Text    = (string)dr["ClipBoardText"];
             cls.Keyword = (string)dr["RemainderText"];
             return(cls);
         }
         return(null);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }