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 WeekNum : Form
    {
        public WeekNum()
        {
            InitializeComponent();
        }
        Week W = new Week();
        
        private void WeekNum_Load(object sender, EventArgs e)
        {
            W.LoadWeek();
            txt_WeekNum.TEXT = W.WeekNum.ToString();
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {
            try
            {
                W.WeekNum = Convert.ToInt16(txt_WeekNum.TEXT);
            }
            catch (Week_Exceptions_WeekNum ex)
            {
                MessageBox.Show(ex.Message, "اطلاعات اشتباه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_WeekNum.Focus();
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "اطلاعات اشتباه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //-------------------------------------------------
            W.SetWeek();
            MessageBox.Show("اطلاعات با موفقیت ثبت شد", "ثبت اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }

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