Beispiel #1
0
        private void LV_History_Loaded(object sender, RoutedEventArgs e)
        {
            String query = "select * from project order by id_project desc;";
            DataTable dt = db.GetDataTable(query);

            // Create a collection for your types
            ProjectList.Clear();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Project p = new Project();
                p.mis = dt.Rows[i]["pr_mis"].ToString();
                p.title = dt.Rows[i]["pr_title"].ToString();
                p.Settings = dt.Rows[i]["pr_settings"].ToString();
                p.SetPrefix(dt.Rows[i]["pr_table_prefix"].ToString());
                ProjectList.Add(p);
            }
            LV_History.ItemsSource = ProjectList;
        }
Beispiel #2
0
 public Project GetProject()
 {
     Project p = new Project();
     try
     {
         SQLiteConnection cnn = new SQLiteConnection(dbConnection);
         // cnn.SetPassword(Password);
         cnn.Open();
         //  cnn.ChangePassword("");
         SQLiteCommand mycommand = new SQLiteCommand(cnn);
         mycommand.CommandText = "Select pr_table_prefix from project order by id_project asc limit 1";
         SQLiteDataReader reader = mycommand.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 p.SetPrefix(reader.GetString(0));
             }
         }
         else
         {
             p = null;
         }
         reader.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
     return p;
 }