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




namespace GymSystem
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {


            FrmLogin fl = new FrmLogin();
            fl.ShowDialog();

            BtnAddUser.Enabled = fl.BSabteNam;
            BtnManageUser.Enabled = fl.BModiriatAza;
            BtnSavabeqUser.Enabled = fl.BSavabeq;
            BtnSell.Enabled = fl.BForoosh;
            BtnEditKala.Enabled = fl.BForooshgahManage;
            BtnAddKala.Enabled = fl.BForooshgahManage;
            buttonItem1.Enabled = fl.Bkomod;
            BtnLogin.Enabled = fl.BAdminManagement;
            BtnRestore.Enabled = fl.BDoBackUp;
            BtnBackUp.Enabled = fl.BDoRestore;

            LblUserName.Text = fl.txtUserName.Text;
            
            
            analogClockControl1.Value = System.DateTime.Now;

            DateTime today = DateTime.Now;
            PersianCalendar pc = new PersianCalendar();

            LblYear.Text = pc.GetYear(today).ToString("0000");
            LblMonth.Text = pc.GetMonth(today).ToString("00");
            LblDay.Text = pc.GetDayOfMonth(today).ToString("00");







            switch (pc.GetDayOfWeek(today).ToString())
            {

                case "Saturday" :
                    {
                        lblDayName.Text = "شنبه";
                        break;
                    }

                case "Sunday":
                    {
                        lblDayName.Text = "یکشنبه";
                        break;
                    }
                case "Monday":
                    {
                        lblDayName.Text = "دوشنبه";
                        break;
                    }
                case "Tusday":
                    {
                        lblDayName.Text = "سه شنبه";
                        break;
                    }
                case "Wednesday":
                    {
                        lblDayName.Text = "چهارشنبه";
                        break;
                    }
                case "Thursday":
                    {
                        lblDayName.Text = "پنجشنبه";
                        break;
                    }

                case "Friday":
                    {
                        lblDayName.Text = "جمعه";
                        break;
                    }


            }







        }

        private void office2007StartButton1_Click(object sender, EventArgs e)
        {

        }

        private void BtnAddKala_Click(object sender, EventArgs e)
        {
            FrmSabtKala fsk = new FrmSabtKala();
            fsk.ShowDialog();



        }

        private void BtnSavabeqUser_Click(object sender, EventArgs e)
        {
            FrmSavabeq fs = new FrmSavabeq();
            fs.ShowDialog();

        }

        private void BtnManageUser_Click(object sender, EventArgs e)
        {
            FrmUserManagement fum = new FrmUserManagement();
            fum.ShowDialog();

        }

        private void BtnAddUser_Click(object sender, EventArgs e)
        {
            FrmSabteNam fsn = new FrmSabteNam();
            fsn.ShowDialog();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            analogClockControl1.Value = System.DateTime.Now;





        }

        private void BtnExit_Click(object sender, EventArgs e)
        {
            FrmMessage fm = new FrmMessage();
            fm.Text = "خروج از نرم افزار";
            fm.LblText.Text = "آیا از خروج اطمینان دارید؟";
            fm.PicYes.Visible = true;
            fm.PicNo.Visible = true;
            fm.PicSoal.Visible = true;

            fm.ShowDialog();


            if (fm.MResult == true)
            {
                Application.Exit();
            }




        }

        private void BtnEditKala_Click(object sender, EventArgs e)
        {
            FrmForooshGah ff = new FrmForooshGah();
            ff.ShowDialog();
        }

        private void BtnSell_Click(object sender, EventArgs e)
        {
            FrmSell fs = new FrmSell();
            fs.ShowDialog();
        }

        private void buttonItem1_Click(object sender, EventArgs e)
        {
            FrmKomod fk = new FrmKomod();
            fk.ShowDialog();
        }

        private void buttonItem14_Click(object sender, EventArgs e)
        {
            FrmAbout fa = new FrmAbout();
            fa.ShowDialog();
        }

        private void BtnLogin_Click(object sender, EventArgs e)
        {
            FrmAdmin fa = new FrmAdmin();
            fa.ShowDialog();
        }

        private void BtnBackUp_Click(object sender, EventArgs e)
        {
            FrmBackUp fb = new FrmBackUp();
            fb.ShowDialog();
        }

        private void BtnRestore_Click(object sender, EventArgs e)
        {
            FrmRestore fr = new FrmRestore();
            fr.ShowDialog();
        }

        private void buttonItem2_Click(object sender, EventArgs e)
        {
            BtnAddUser_Click(null, null);
        }

        private void buttonItem3_Click(object sender, EventArgs e)
        {
            BtnManageUser_Click(null, null);
        }

        private void buttonItem4_Click(object sender, EventArgs e)
        {
            BtnBackUp_Click(null, null);
        }

        private void buttonItem5_Click(object sender, EventArgs e)
        {
            BtnRestore_Click(null, null);
        }

        private void buttonItem12_Click(object sender, EventArgs e)
        {
            buttonItem14_Click(null, null);
        }

        private void buttonItem13_Click(object sender, EventArgs e)
        {
            BtnExit_Click(null, null);
        }
    }
}
