private void demoDatenProjekte() { Projekt p1 = new Projekt(); p1.ID = 1; p1.Name = "Projekt Zeiterfassung"; p1.IstAktiv = true; p1.StartDatum = new DateTime(2016, 3, 1); p1.EndDatum = new DateTime(2016, 10, 1); p1.GesamtZeitStunden = 120; p1.OffeneZeitStunden = 120; p1.Farbe = Colors.Violet; Bibliothek.Projekt_Neu(p1); Projekt p2 = new Projekt(); p2.ID = 2; p2.Name = "Projekt YellowLabel"; p2.IstAktiv = true; p2.StartDatum = new DateTime(2016, 4, 2); p2.EndDatum = new DateTime(2016, 7, 30); p2.GesamtZeitStunden = 80; p2.OffeneZeitStunden = 80; p2.Farbe = Colors.Yellow; Bibliothek.Projekt_Neu(p2); }
private void btnProj_Handler(object sender, RoutedEventArgs e) { Button myButton = (Button)sender; // Create new Project if (myButton.Tag.ToString() == "new") { Projekt newProj = new Projekt(); int id; var bool4 = Int32.TryParse(Application.Current.Properties["proj_id"].ToString(), out id); // saved max id to increment newProj.ID = id += 1; Application.Current.Properties["proj_id"] = (id += 1).ToString(); newProj.Name = this.projName.Text; int offen; var bool1 = Int32.TryParse(projOffene.Text, out offen); int gesamt; var bool2 = Int32.TryParse(projGesamt.Text, out gesamt); newProj.OffeneZeitStunden = offen; newProj.GesamtZeitStunden = gesamt; newProj.IstAktiv = projAktiv.IsChecked.Value; newProj.StartDatum = this.projStart.SelectedDate.Value; newProj.EndDatum = this.projEnd.SelectedDate.Value; Bibliothek.Projekt_Neu(newProj); // Project Created - show success and reset form this.projName.Text = ""; this.projOffene.Text = ""; this.projGesamt.Text = ""; this.projStart.SelectedDate = null; this.projEnd.SelectedDate = null; this.projAktiv.IsChecked = false; this.success.Text = "Projekt erfolgrichlich erstellt"; this.success.Visibility = Visibility.Visible; } // Edit Project if (myButton.Tag.ToString() == "edit") { int id; var bool6 = Int32.TryParse(this.btnID.Tag.ToString(), out id); Projekt proj = Bibliothek.Projekt_nach_ID(id); proj.Name = this.projName.Text; int offen; var bool1 = Int32.TryParse(projOffene.Text, out offen); int gesamt; var bool2 = Int32.TryParse(projGesamt.Text, out gesamt); proj.OffeneZeitStunden = offen; proj.GesamtZeitStunden = gesamt; proj.IstAktiv = projAktiv.IsChecked.Value; proj.StartDatum = this.projStart.SelectedDate.Value; proj.EndDatum = this.projEnd.SelectedDate.Value; this.btnID.Tag = ""; // reset edit job id holder // Project Edited - show success and reset form this.projName.Text = ""; this.projOffene.Text = ""; this.projGesamt.Text = ""; this.projStart.SelectedDate = null; this.projEnd.SelectedDate = null; this.projAktiv.IsChecked = false; this.success.Text = "Projekt erfolgrichlich gearbeitet"; this.success.Visibility = Visibility.Visible; } }