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

namespace OwnControls
{
    public partial class RadioFieldDefaultSeason : UserControl
    {
        public RadioFieldDefaultSeason()
        {
            InitializeComponent();
            
        }

        private bool isWinter()
        {
            if (DateTime.Now.Month < 4 || DateTime.Now.Month > 9)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool isWinterSelected()
        {
            if (!radioButtonWinter.Checked && !radioButtonSummer.Checked)
            {
                throw new Exception("Legalább egy évszak opciót ki kell választani!");
            }
            else
            {
                return radioButtonWinter.Checked;
            }
        }
        
        [DefaultValue(false)]
        public bool SetAutomaticSeason
        {
            get;
            set;
        }

        public bool RadioSummerChecked
        {
            get { return radioButtonSummer.Checked; }

            set { radioButtonSummer.Checked = value; }
        }

        public bool RadioWinterChecked
        {
            get { return radioButtonWinter.Checked; }

            set { radioButtonWinter.Checked = value; }
        }

        public string RadioSummerText
        {
            get { return radioButtonSummer.Text; }

            set { radioButtonSummer.Text = value; }
        }

        public string RadioWinterText
        {
            get { return radioButtonWinter.Text; }

            set { radioButtonWinter.Text = value; }
        }

        private void RadioFieldDefaultSeason_Load(object sender, EventArgs e)
        {
            if (SetAutomaticSeason)
            {
                if (isWinter())
                {
                    radioButtonWinter.Checked = true;
                }
                else
                {
                    radioButtonSummer.Checked = true;
                }
            }
        }
    }
}
