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 CancelDay : Form
    {
        public CancelDay()
        {
            InitializeComponent();
        }
        Reserve R = new Reserve();
        private void CancelDay_Load(object sender, EventArgs e)
        {
            R.LoadCancelDay();
            txt_BackCount.TEXT = R.CancelDay.ToString();           
        }

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

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