Exemplo n.º 1
0
 public void NotizAnzeigen(Notiz notiz)
 {
     txtTitel.Text        = notiz.Titel;
     txtErstelldatum.Text = notiz.Erstelldatum.ToShortDateString();
     numPrioritaet.Value  = notiz.Prioritaet;
     drpDwnKategorie.Text = notiz.Kategorie;
     dateDeadline.Value   = notiz.Deadline;
     txtInhalt.Text       = notiz.Inhalt;
 }
Exemplo n.º 2
0
        private void NotizSpeichern()
        {
            if (txtTitel.Text == "")
            {
                MessageBox.Show("Bitte einen Titel angeben.", "Fehler", MessageBoxButtons.OK);
                Console.WriteLine("ERROR: Title can't be empty.");
                return;
            }

            string titel     = txtTitel.Text;
            int    prio      = (int)numPrioritaet.Value;
            string kategorie = drpDwnKategorie.Text;

            if (txtKategorie.Text != "")
            {
                string neueKategorie = txtKategorie.Text;
                if (!notizbuch.Kategorien.Contains(neueKategorie))
                {
                    kategorie = neueKategorie;
                    notizbuch.Kategorien.Add(neueKategorie);
                    KategorienSync();
                    drpDwnKategorie.SelectedIndex = notizbuch.Kategorien.IndexOf(neueKategorie);
                }
            }
            DateTime deadline = dateDeadline.Value;
            string   inhalt   = txtInhalt.Text;

            Notiz neueNotiz = new Notiz(titel, prio, kategorie, deadline, inhalt);

            bool confirmed;

            if (notizbuch.NotizExistiert(neueNotiz))
            {
                confirmed = MessageBox.Show("Notiz mit diesem Titel existiert bereits. Überschreiben?", "Notiz überschreiben", MessageBoxButtons.OKCancel) == DialogResult.OK ? true : false;
            }
            else
            {
                confirmed = true;
                //confirmed = MessageBox.Show("Soll eine neue Notiz angelegt werden?", "Neue Notiz anlegen", MessageBoxButtons.OKCancel) == DialogResult.OK ? true : false;
            }

            if (confirmed)
            {
                notizbuch.NotizDatenSpeichern(neueNotiz);

                NotizenSync();
            }
            else
            {
                return;
            }
        }
Exemplo n.º 3
0
        private void NotizLoeschen()
        {
            //TODO: need some sort of check to see if an item is actually selected, the index is always set to something
            int index = lstbNotizen.SelectedIndex;

            if (cboxFiltern.Checked)
            {
                Notiz zuLoeschen = notizbuch.NotizenSuchen((int)numPrioSuche.Value)[index];
                notizbuch.NotizLoeschen(zuLoeschen);
            }
            else
            {
                notizbuch.NotizLoeschen(index);
            }

            NotizenSync();
        }
Exemplo n.º 4
0
        /**
         *
         */
        public void notizHinzufuegen(
            string p_titel,
            DateTime p_erstellDatum,
            int p_prio,
            string p_kategorie,
            string p_text,
            DateTime p_deadLine
            )
        {
            Notiz einNeuesNotizObjet = new Notiz();

            einNeuesNotizObjet.setTitle(p_titel);
            einNeuesNotizObjet.setErstellDatum(p_erstellDatum);
            einNeuesNotizObjet.setPrio(p_prio);
            einNeuesNotizObjet.setKategorie(p_kategorie);
            einNeuesNotizObjet.setText(p_text);
            einNeuesNotizObjet.setDeadLine(p_deadLine);

            // speicdhern des neuen Objekts
            notizen.Add(einNeuesNotizObjet);
        }
Exemplo n.º 5
0
        private void btnAnzeigen_Click(object sender, EventArgs e)
        {
            Notiz ausgewaehlt = notizbuch.Notizen[lstbNotizen.SelectedIndex];

            NotizAnzeigen(ausgewaehlt);
        }