Пример #1
0
        private void btnNovy_Click(object sender, EventArgs e)
        {
            FormEditUkol form = new FormEditUkol();

            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                Ukol ukol = new Ukol(form.dtpDatum.Value, form.cbDulezity.Checked, form.cbUpozorneni.Checked, form.tbUkol.Text);
                PridejUkol(ukol);
                ZobrazUkoly();
            }
        }
Пример #2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            FormEditUkol form = new FormEditUkol();

            int idx = SelectedIndex();

            if ((idx >= 0) && (idx < ukolList.Count))
            {
                form.dtpDatum.Value = ukolList[idx].Datum;
                form.cbDulezity.Checked = ukolList[idx].Dulezity;
                form.cbUpozorneni.Checked = ukolList[idx].Upozorneni;
                form.tbUkol.Text = ukolList[idx].Text;

                DialogResult result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    Ukol ukol = new Ukol(form.dtpDatum.Value, form.cbDulezity.Checked, form.cbUpozorneni.Checked, form.tbUkol.Text);
                    UpravUkol(idx, ukol);
                    ZobrazUkoly();
                }
            }
        }
Пример #3
0
        private int CompareByDate(Ukol x, Ukol y)
        {
            if ((x == null) && (y == null))
                return 0;
            else if (x == null)
                return -1;
            else if (y == null)
                return 1;

            return x.Datum.CompareTo(y.Datum);
        }
Пример #4
0
 private void UpravUkol(int idx, Ukol ukol)
 {
     if ((idx >= 0) && (idx < ukolList.Count) && (ukol != null))
     {
         ukolList[idx] = ukol;
         SetridAUlozUkoly();
     }
 }
Пример #5
0
 private void PridejUkol(Ukol ukol)
 {
     if (ukol != null)
     {
         ukolList.Add(ukol);
         SetridAUlozUkoly();
     }
 }