//Starts the programm with the data needed private void StartProgramm() { try { if (Convert.ToInt32(WeekNrTextBox.Text) > 0 && Convert.ToInt32(WeekNrTextBox.Text) < 56) //Week in year { if (File.Exists(@"Data\" + WeekNrTextBox.Text + @".week")) //Week does exist { Buchhaltung b = new Buchhaltung(WeekNrTextBox.Text); b.Show(); } else { string oldCashDeskStr = OldCashDesk.Text; if (oldCashDeskStr.Contains("€")) { oldCashDeskStr = oldCashDeskStr.Replace('€', ' '); } Buchhaltung b = new Buchhaltung(WeekNrTextBox.Text, NameInput.Text, Convert.ToDateTime(DateTextBox.Text), Convert.ToDouble(oldCashDeskStr)); MessageBox.Show("Die Woche wurde nicht gefunden! Es wird eine neue erstellt."); b.Show(); } Close(); } else { Buchhaltung.Log("Ungültige Woche"); } } catch (Exception e) { Buchhaltung.Log(e.Message); Buchhaltung.SaveErrorMsg(e); } }
private void StartProgramm() { try { if (Convert.ToInt32(weekNrTextBox.Text) > 0 && Convert.ToInt32(weekNrTextBox.Text) < 56) { if (!File.Exists(@"Data\" + weekNrTextBox.Text + @".week")) { MessageBox.Show("Die Woche wurde nicht gefunden! Es wird eine neue erstellt."); using (StreamWriter writer = new StreamWriter(@"Data\" + weekNrTextBox.Text + @".week")) { writer.Write("[monday]\n[tuesday]\n[wednesday]\n[thursday]\n[saturday]\n[sunday]\n[end]"); } } Buchhaltung b = new Buchhaltung(weekNrTextBox.Text); b.Show(); this.Close(); } else { Buchhaltung.Log("Ungültige Woche"); } } catch (Exception e) { Buchhaltung.Log(e.Message); Buchhaltung.SaveErrorMsg(e); } }