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 MainPage : Form
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void MainPage_Load(object sender, EventArgs e)
        {
            Week W = new Week();
            Text += Functions.UserName + " - تاریخ امروز : " + Functions.FarsiDate("/") + " - امروز : " + W.FindHafteID();
            //---------------------------------------
            User U = new User();
            U.LoadAccess(Functions.UserName);
            M1_AddStudent.Enabled = M1_ChangeStudent.Enabled = M1_ActiveStudent.Enabled = M1_DeleteStudent.Enabled = M1_AddPriceStudent.Enabled = M1_AddType.Enabled = M1_ChangeType.Enabled = U.Access_Student;
            M2_ManageFoodName.Enabled = M2_DetermaineReserveFood.Enabled = M2_FoodPrice.Enabled = M2_FoodTime.Enabled = M2_FoodStatictice.Enabled = U.Access_Food;
            M3_ManageWeek.Enabled = M3_ManageDay.Enabled = U.Access_Vacation;
            M4_LimitReserve.Enabled = M4_WeekNum.Enabled = M4_CancelDay.Enabled = M4_DeleteDay.Enabled = U.Access_Reserve;
            M5_CreateBackUP.Enabled = M5_ReadBackUP.Enabled = M5_DeleteBackUP.Enabled = U.Access_BackUP;
            M6_AddUser.Enabled = M6_ChangeUser.Enabled = M6_DeleteUser.Enabled = U.Access_Users;            
        }

        private void MainPage_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }

        private void m1_Click(object sender, EventArgs e)
        {
            AddHesab FF = new AddHesab();            
            FF.MdiParent = this;
            FF.Show();           
        }

        private void m4_Click(object sender, EventArgs e)
        {
            SearchStudent FF = new SearchStudent();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m2_Click(object sender, EventArgs e)
        {
            try
            {
                ChangeStudent FF = new ChangeStudent();
                FF.MdiParent = this;
                FF.Show();
            }
            catch
            {
            }
        }

        private void m10_Click(object sender, EventArgs e)
        {
            Limit FF = new Limit();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m11_Click(object sender, EventArgs e)
        {
            WeekNum FF = new WeekNum();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m12_Click(object sender, EventArgs e)
        {
            CancelDay FF = new CancelDay();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m20_Click(object sender, EventArgs e)
        {
            GiveBackUP FF = new GiveBackUP();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m21_Click(object sender, EventArgs e)
        {
            ReadBackUP FF = new ReadBackUP();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m22_Click(object sender, EventArgs e)
        {
            DeleteBackUP FF = new DeleteBackUP();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m30_Click(object sender, EventArgs e)
        {
            AddUser FF = new AddUser();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m32_Click(object sender, EventArgs e)
        {
            DeleteUser FF = new DeleteUser();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m31_Click(object sender, EventArgs e)
        {
            ChangeUser FF = new ChangeUser();
            FF.MdiParent = this;
            FF.MP = this;
            FF.Show();
        }

        private void m40_Click(object sender, EventArgs e)
        {
            ReserveFood FF = new ReserveFood();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m5_Click(object sender, EventArgs e)
        {
            try
            {
                ChangeHesab FF = new ChangeHesab();
                FF.MdiParent = this;
                FF.Show();
            }
            catch
            {
            }
        }

        private void m3_Click(object sender, EventArgs e)
        {
            DeleteStudent FF = new DeleteStudent();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m15_Click(object sender, EventArgs e)
        {
            DeleteReserves FF = new DeleteReserves();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m6_Click(object sender, EventArgs e)
        {
            ActiveStudent FF = new ActiveStudent();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m41_Click(object sender, EventArgs e)
        {
            EatingFood FF = new EatingFood();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m52_Click(object sender, EventArgs e)
        {
            About FF = new About();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m50_Click(object sender, EventArgs e)
        {
            this.Hide();
            Login FF = new Login();
            this.Hide();
            FF.Show();
        }

        private void مدیریتنامغذاهاToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ManageFoodName FF = new ManageFoodName();
            FF.MdiParent = this;
            FF.Show();
        }

        private void تعیینغذاهایسلفToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FoodName FF = new FoodName();
            FF.MdiParent = this;
            FF.Show();
        }

        private void مدیریتهفتههایتعطیلToolStripMenuItem_Click(object sender, EventArgs e)
        {
            VacationsWeek FF = new VacationsWeek();
            FF.MdiParent = this;
            FF.Show();
        }

        private void مدیریتروزهایتعطیلToolStripMenuItem_Click(object sender, EventArgs e)
        {
            VacationsDay FF = new VacationsDay();
            FF.MdiParent = this;
            FF.Show();
        }

        private void افزودننوعدانشجویجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddStudentType FF = new AddStudentType();
            FF.MdiParent = this;
            FF.Show();
        }

        private void ویرایشنوعدانشجوToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EditStudentType FF = new EditStudentType();
            FF.MdiParent = this;
            FF.Show();
        }

        private void آمارغذاهاییکروزToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StaticsofFoodDay FF = new StaticsofFoodDay();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m13_Click(object sender, EventArgs e)
        {
            Prices FF = new Prices();
            FF.MdiParent = this;
            FF.Show();
        }

        private void m14_Click(object sender, EventArgs e)
        {
            FoodTime FF = new FoodTime();
            FF.MdiParent = this;
            FF.Show();
        }

        private void M3_ManageWeek_Click(object sender, EventArgs e)
        {
            VacationsWeek FF = new VacationsWeek();
            FF.MdiParent = this;
            FF.Show();
        }

        private void M3_ManageDay_Click(object sender, EventArgs e)
        {
            VacationsDay FF = new VacationsDay();
            FF.MdiParent = this;
            FF.Show();
        }

        private void M1_Exit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("آیا از برنامه خارج می شوید ؟", "خروج از برنامه", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "No") return;
            Application.Exit();
        }                              
    }
}