Пример #1
0
        void ConstructDataBase()
        {
            try
            {
                string       pathScript = Path.Combine(Application.StartupPath, @"script/scripts.txt");
                StreamReader sr         = new StreamReader(pathScript);
                string       sqlScripts = sr.ReadToEnd();
                sr.Close();

                string database = _database;
                sqlScripts = sqlScripts.Replace("#DataBaseName#", database);
                string pathMdf = dataBasePath;
                string pathLdf = pathMdf;
                pathMdf    = Path.Combine(dataBasePath, database + ".mdf");
                pathLdf    = Path.Combine(dataBasePath, database + "_log.ldf");
                sqlScripts = sqlScripts.Replace("#PathMdf#", pathMdf);
                sqlScripts = sqlScripts.Replace("#PathLdf#", pathLdf);
                sqlScripts = sqlScripts.Replace("HAN_log", database + "_log");
                ProcessDataBase pData = new ProcessDataBase();
                pData.ExecuteNonQueries(sqlScripts, textBox1);
                btnKapat.Enabled = true;
                Settings set = Engine.FindSettings();
                set.Kurulum = "1";
                Engine.SaveSettings(set);
            }
            catch (Exception exc)
            {
                LogWrite.Write(exc);
                MessageBox.Show(exc.Message);
            }
        }
Пример #2
0
 private void btnTest_Click(object sender, EventArgs e)
 {
     try {
         StringBuilder conStr = new StringBuilder();
         conStr.AppendFormat("Server={0};", txtServer.Text);
         conStr.AppendFormat("Initial Catalog={0};", txtDatabase.Text);
         conStr.AppendFormat("Password={0};", txtPassword.Text);
         conStr.AppendFormat("User ID={0}", txtUserID.Text);
         Settings set = new Settings {
             ConnectionString = conStr.ToString()
         };
         //set.Paket = (IndeksPaket)Enum.Parse(typeof(IndeksPaket), cmbPaket.Text);
         set.Paket    = IndeksPaket.Pro;
         set.DataBase = "MsSql";
         set.Kurulum  = "0";
         //Engine.SaveConnectinString(conStr.ToString());
         Engine.SaveSettings(set);
         ProcessDataBase prc  = new ProcessDataBase();
         bool            test = prc.TestConnection();
         if (test)
         {
             MessageBox.Show("Bağlandı");
         }
         else
         {
             MessageBox.Show("Bağlanamadı");
         }
     } catch (Exception exc) {
         MessageBox.Show(exc.Message);
         LogWrite.Write(exc);
     }
 }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         ProcessDataBase prc = new ProcessDataBase(Engine.GetConString());
         prc.ExecuteNonQueries(textBox1.Text);
         MessageBox.Show("Komutlar çalıştırıldı.Lütfen programı kapatıp tekrar açın");
     } catch (Exception exc) {
         MessageBox.Show(exc.Message);
         LogWrite.Write(exc);
     }
 }
Пример #4
0
        void LoadAllSube()
        {
            try {
                //Stopwatch stopwatch = new Stopwatch();
                //stopwatch.Start();
                //mngFac = new ManagerFactory(Engine.GetConString(), Engine.GetSqlServerType());
                //mngSube = mngFac.GetSubeManager();
                //mngUSer = mngFac.GetKullaniciManager();
                ProcessDataBase pd       = new ProcessDataBase(Engine.GetConString());
                IList <Sube>    listSube = pd.SubeListe();
                bool            first    = true;
                foreach (Sube sube in listSube)
                {
                    cmbSube.Items.Add(sube.Id);
                    if (first)
                    {
                        cmbSube.Text = sube.Id;
                        first        = false;
                    }
                }



                //List<Sube>liste=  mngSube.GetAll();
                //foreach (Sube sube in liste)
                //    cmbSube.Items.Add(sube.Id);
                //TimeSpan ts = stopwatch.Elapsed;

                //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                //ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

                //txtKulAdi.Text = elapsedTime;
                //stopwatch.Stop();
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                LogWrite.Write(exc);
            }
        }