Exemple #1
0
        public newProject()
        {
            InitializeComponent();


            // Edit Employee auto fill form
            if (Application.Current.Properties["proj_edit_id"] != null)
            {
                int     proj_id;
                var     bool5 = Int32.TryParse(Application.Current.Properties["proj_edit_id"].ToString(), out proj_id);
                Projekt proj  = Bibliothek.Projekt_nach_ID(proj_id);
                this.projName.Text = proj.Name;

                this.projOffene.Text     = proj.OffeneZeitStunden.ToString();
                this.projGesamt.Text     = proj.GesamtZeitStunden.ToString();
                this.projAktiv.IsChecked = proj.IstAktiv;

                this.projStart.SelectedDate = proj.StartDatum;
                this.projEnd.SelectedDate   = proj.EndDatum;

                this.projSubmit.Tag = "edit";
                // Create hidden button to save employee id
                this.btnID.Tag = proj_id.ToString();

                // Edit window opened and loaded.. reset trigger property
                Application.Current.Properties["proj_edit_id"] = null;
            }
        }
        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);
        }
 public static void Projekt_Neu(Projekt projekt)
 {
     if (Projekte == null)
     {
         Projekte = new List <Projekt>();
     }
     Projekte.Add(projekt);
 }
Exemple #4
0
        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;
            }
        }