using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Kalendarz
{
    public partial class SzczegolyZadania : Form
    {
        private DateTime _data;
        private Kalendarz _kalendarz;

        public SzczegolyZadania(Kalendarz kalendarz)
        {
            InitializeComponent();
            _kalendarz = kalendarz;
        }

        public void ustawDate(DateTime data)
        {
            dateTimePicker1.Value = data;
            dateTimePicker2.Value = data;
        }

        public void wyczysc()
        {
            this.textBox1.Clear();
            this.dateTimePicker1.Value = DateTime.Now.Date;
            this.dateTimePicker2.Value = DateTime.Now.Date;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Kalendarz.Zadanie zadanie = new Kalendarz.Zadanie();
            
            zadanie.dataRozpoczecia = dateTimePicker1.Value;
            zadanie.dataZakonczenia = dateTimePicker2.Value;
            zadanie.opis = textBox1.Text;

            _kalendarz.DodajZadanie(zadanie);
            
            this.Close();
        }
    }
}
