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

namespace Self_Project
{
    public partial class StaticsofFoodDay : Form
    {
        public StaticsofFoodDay()
        {
            InitializeComponent();
        }
        Reserve objReserve = new Reserve();

        private void txt_Day_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Day.SelectedIndex == -1 || cmb_Month.SelectedIndex == -1) return;
                if (cmb_Month.SelectedIndex < 9)
                    objReserve.Tarikh = "0" + (cmb_Month.SelectedIndex + 1).ToString() + "/" + cmb_Day.Text;
                else
                    objReserve.Tarikh = (cmb_Month.SelectedIndex + 1).ToString() + "/" + cmb_Day.Text;
                String A, B, C;
                objReserve.LoadStatistics(out A, out B, out C);
                lbl_BreakFast.Text = "صبحانه : " + A + " غذا";
                lbl_Launch.Text = "نهار : " + B + " غذا";
                lbl_Dinner.Text = "شام : " + C + " غذا";
            }
            catch (Reserve_Exceptions_Tarikh ex)
            {
                MessageBox.Show(ex.Message, "اطلاعات اشتباه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_Day.Focus();
                return;
            }
        }

        private void StaticsofFoodDay_Load(object sender, EventArgs e)
        {
            cmb_Month.SelectedIndex = 0;
            cmb_Day.SelectedIndex = 0;
        }

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

        private void cmb_Month_SelectedIndexChanged(object sender, EventArgs e)
        {
            txt_Day_SelectedIndexChanged(null, null);
        }
    }
}