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

        private void btn_OK_Click(object sender, EventArgs e)
        {
            try
            {
                StudentType objStdType = new StudentType();
                objStdType.Name = txt_Student_Type.TEXT;
                objStdType.Create();
                MessageBox.Show("اطلاعات با موفقیت ثبت شد", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (StudentType_Exceptions_Name ex)
            {
                MessageBox.Show(ex.Message, "خطا در نام دانشجو", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_Student_Type.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_Student_Type.Focus();
            }
        }

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