private void TmR_Backup_Tick(object sender, EventArgs e) { TmR_Backup.Enabled = false; Cls_Procedure.BackupData(); TmR_Backup.Enabled = true; }
private void Frm_Haupt_Load(object sender, EventArgs e) { OracleConnection oConnection = new OracleConnection(); OracleCommand oCommand = new OracleCommand(); OracleDataReader dataReader; bool bRun = true; int nCounter = 0; string sSammeluser = ""; XmlDocument doc = new XmlDocument(); doc.Load("Settings.xml"); XmlNode nodeSchema = doc.SelectSingleNode("/Bauwagen/Database/Schema"); sSchema = nodeSchema.FirstChild.Value; XmlNode nodeSchemaPassword = doc.SelectSingleNode("/Bauwagen/Database/SchemaPassword"); sSchemaPassword = nodeSchemaPassword.FirstChild.Value; XmlNode nodeDatabase = doc.SelectSingleNode("/Bauwagen/Database/Adress"); sDatabase = nodeDatabase.FirstChild.Value; XmlNode nodeListener = doc.SelectSingleNode("/Bauwagen/Database/ListenerPort"); sListenerPort = nodeListener.FirstChild.Value; XmlNode nodeBackupPfad = doc.SelectSingleNode("/Bauwagen/Database/BackupPfad"); sBackupPfad = nodeBackupPfad.FirstChild.Value; XmlNode nodeRestorePfad = doc.SelectSingleNode("/Bauwagen/Database/RestorePfad"); sRestorePfad = nodeRestorePfad.FirstChild.Value; XmlNode nodeHostAutomat = doc.SelectSingleNode("/Bauwagen/Software/HostName_Automat"); XmlNode nodeHostCocktail = doc.SelectSingleNode("/Bauwagen/Software/HostName_CocktailMixer"); XmlNode nodeSammelUser = doc.SelectSingleNode("/Bauwagen/Software/Gemeinschaftsuser"); sSammeluser = nodeSammelUser.FirstChild.Value; CmD_Automatenbuchung.Visible = false; CmD_Cocktailmixer.Visible = false; if (nodeHostAutomat.InnerText == System.Environment.MachineName.ToUpper().Trim()) { CmD_Automatenbuchung.Visible = true; } if (nodeHostCocktail.InnerText == System.Environment.MachineName.ToUpper().Trim()) { CmD_Cocktailmixer.Visible = true; } if (!Directory.Exists(sBackupPfad)) { Directory.CreateDirectory(sBackupPfad); } if (!Directory.Exists(sRestorePfad)) { Directory.CreateDirectory(sRestorePfad); } string sTemp = Cls_Procedure.XorEncrypt(sSchemaPassword, Bauwagen.Properties.Settings.Default.Key); sDSN = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + sDatabase + ")(PORT=" + sListenerPort + ")))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xe)));User Id=" + sSchema + "; Password="******";"; LbL_Summe.Text = "0,00 €"; LbL_Budget.Text = "0,00 €"; LbL_Verfügbar.Text = "0,00 €"; LbL_Kredit.Text = "0,00 €"; while (bRun == true) { try { oConnection.ConnectionString = sDSN; oConnection.Open(); oCommand.Connection = oConnection; oCommand.CommandText = Cls_Query.GetAnwenderDaten(sSammeluser, false, ""); dataReader = oCommand.ExecuteReader(); if (!dataReader.HasRows) { MessageBox.Show("Fehler in der Konfiguration, der angegebene Sammeluser existiert nicht!\n" + sSammeluser); } oConnection.Close(); bRun = false; } catch (Exception ex) { bRun = true; Thread.Sleep(1000); nCounter += 1; } if (nCounter > 1000) { MessageBox.Show("Datenbankfehler Anwendung wird geschlossen!"); this.Close(); } } CreateButtons(); Cls_Procedure.BackupData(); bLoad = false; }