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

namespace WareHouse
{
    public partial class frmMain : Form
    {
        frmTaghiiratsystem.frmUnitjadid frmUnitj;
        frmRepSefareshat frm1;
        frmRepPurched frm2;
        frmRepTahvili frm3;
        frmRepMojoodi frm4;
        frmTahvileKala frm5;
        frmKarbareJadid frm6;
        frmChangPassword frm7;
        frmParvandeh.SabteSefareshat frm8;
        frmParvandeh.Asset101 frm9;
        frmTaghiiratsystem.frmAnbarejadid frm10;
        frmTaghiiratsystem.frmVahedeKalaiejadid frm11;
        frmCategoory frm12;
        AboutBox1 frm13;
        frmParvandeh.khariDarishodeh frm14;

        public frmMain()
        {
            InitializeComponent();
        }

        public string calenFar()
        {
            string strMydate;
            PersianCalendar calFar1 = new PersianCalendar();
            strMydate = calFar1.GetYear(DateTime.Now).ToString() + "/" + calFar1.GetMonth(DateTime.Now).ToString("00") + "/" + calFar1.GetDayOfMonth(DateTime.Now).ToString("00");
            return strMydate;
        }

        private void exit1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
            this.Close(); 
        }


        private void aghlameKharidariShodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm14 == null || frm14.IsDisposed)
            {
                frm14 = new frmParvandeh.khariDarishodeh();
                frm14.MdiParent = this;
                frm14.Show();
            }
            else
            {
                frm14.Activate();
            }
        }

        private void vahedeJadidToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmUnitj == null || frmUnitj.IsDisposed)
            {
                frmUnitj = new frmTaghiiratsystem.frmUnitjadid();
                frmUnitj.MdiParent = this;
                frmUnitj.Show();  

            }
            else
            {
                frmUnitj.Activate();
            }
           
        }

        private void AboutUsff1_Click(object sender, EventArgs e)
        {
            if (frm13 == null || frm13.IsDisposed)
            {
                frm13 = new AboutBox1();
                frm13.MdiParent = this;
                frm13.Show();
            }
            else
            {
                frm13.Activate();
            }
        }


        private void frmMain_Load(object sender, EventArgs e)
        {
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(System.Globalization.CultureInfo.CreateSpecificCulture("Fa-Ir"));  
            //MessageBox.Show(calenFar());
            this.Text = "  *****سیستم انبارداری - نسخه 1.0.1*****  " + calenFar();
        }

        private void tabagheBandieJadidToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm12 == null || frm12.IsDisposed)
            {
                frm12 = new frmCategoory();
                frm12.MdiParent = this;
                frm12.Show();
            }
            else
            {
                frm12.Activate();
            }
        }

        private void vahedeKalaieJadidToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm11 == null || frm11.IsDisposed)
            {
                frm11 = new frmTaghiiratsystem.frmVahedeKalaiejadid();
                frm11.MdiParent = this;
                frm11.Show();
            }
            else
            {
                frm11.Activate();
            }
        }

        private void tarifeAnbareJadidToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm10 == null || frm10.IsDisposed)
            {
                frm10 = new frmTaghiiratsystem.frmAnbarejadid();
                frm10.MdiParent = this;
                frm10.Show();
            }
            else
            {
                frm10.Activate();
            }
        }

        private void tarifeCodeAghlamToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm9 == null || frm9.IsDisposed)
            {
                frm9 = new frmParvandeh.Asset101();
                frm9.MdiParent = this;
                frm9.Show();
            }
            else
            {
                frm9.Activate();
            }
        }

        private void SabtesEfareShat_Click(object sender, EventArgs e)
        {
            if (frm8 == null || frm8.IsDisposed)
            {
                frm8 = new frmParvandeh.SabteSefareshat();
                frm8.MdiParent = this;
                frm8.Show();
            }
            else
            {
                frm8.Activate();
            }
        }

        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void pasChanging100ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm7 == null || frm7.IsDisposed)
            {
                frm7 = new frmChangPassword();
                frm7.MdiParent = this;
                frm7.Show();
            }
            else
            {
                frm7.Activate();
            }
        }

        private void defJadidUsersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm6 == null || frm6.IsDisposed)
            {
                frm6 = new frmKarbareJadid();
                frm6.MdiParent = this;
                frm6.Show();
            }
            else
            {
                frm6.Activate();
            }
        }

        private void frmTahvileKalaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm5 == null || frm5.IsDisposed)
            {
                frm5 = new frmTahvileKala();
                frm5.MdiParent = this;
                frm5.Show();
            }
            else
            {
                frm5.Activate();
            }
        }

        private void aghlameKhardiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm1 == null || frm1.IsDisposed)
            {
                frm1 = new frmRepSefareshat();
                frm1.MdiParent = this;
                frm1.Show();
            }
            else
            {
                frm1.Activate();
            }
        }

        private void kolleSefareshatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm2 == null || frm2.IsDisposed)
            {
                frm2 = new frmRepPurched();
                frm2.MdiParent = this;
                frm2.Show();
            }
            else
            {
                frm2.Activate();
            }
        }

        private void lisAnbrDanrantToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm3 == null || frm3.IsDisposed)
            {
                frm3 = new frmRepTahvili();
                frm3.MdiParent = this;
                frm3.Show();
            }
            else
            {
                frm3.Activate();
            }
        }

        private void aGhlameKharidariNashodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frm4 == null || frm4.IsDisposed)
            {
                frm4 = new frmRepMojoodi();
                frm4.MdiParent = this;
                frm4.Show();
            }
            else
            {
                frm4.Activate();
            }
        }

    }
}