예제 #1
0
 ///<summary>
 ///Proje dosyasını yaratır ve ilk ayarlamaları db.ini dosyasına göre yapar.
 ///</summary>
 public void create_project(string name)
 {
     try
     {
         var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
         var connectionStringsSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
         connectionStringsSection.ConnectionStrings["tablo"].ConnectionString = @"XpoProvider=SQLite;Data Source=" + Application.StartupPath + "\\" + name + ".nursan";
         // MessageBox.Show(Application.StartupPath + "\\" + name + ".nursan");
         config.Save();
         ConfigurationManager.RefreshSection("connectionStrings");
         SQLiteConnection m_dbConnection = new SQLiteConnection(@"XpoProvider=SQLite;Data Source=" + Application.StartupPath + "\\" + name + ".nursan");
         m_dbConnection.Open();
         string        sql     = File.ReadAllText(@"db.ini");
         SQLiteCommand command = new SQLiteCommand(commandText: sql, connection: m_dbConnection);
         command.ExecuteNonQuery();
         m_dbConnection.Close();
         created = true;
         using (LocalTables update = new LocalTables(true))
         {
             update.getalltables();
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
예제 #2
0
 public DataManager(bool temp)
 {
     if (temp)
     {
         if (initialized == false)
         {
             localTables = new LocalTables(initialize);
             initialized = true;
         }
         else
         {
             Console.WriteLine("Daha önceden tablolar yüklenmiş!");
         }
     }
     else
     {
         localTables = new LocalTables(temp);
         Console.WriteLine("Tablolar Yüklenmeyecek!");
     }
 }