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

namespace Amozeshgah
{
    public partial class New_Term : DevComponents.DotNetBar.Office2007Form
    {
        public New_Term()
        {
            InitializeComponent();
        }

        private void New_Term_Load(object sender, EventArgs e)
        {

        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
            DateTime dt = new DateTime();
            dt = DateTime.Now;
            Class_date cdate = new Class_date();
            string date = dt.Year.ToString() + "/" + dt.Month.ToString() + "/" + dt.Day.ToString();
            txtStart.Text = cdate.Shamsi(date);
            txtTitle.Focus();
        }

        private void groupPanel2_Click(object sender, EventArgs e)
        {

        }

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

        private void btnInsert_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text == "" || txtStart.Text == "" || txtDuration.Text == "" || txtMonth.Text == "" || txtYear.Text == "")
            {
                MessageBox.Show("اطلاعات وارد شده کامل نیست", "مدیریت آموزشگاه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            termTableAdapter1.Insert(txtTitle.Text, txtStart.Text, txtDuration.Text, txtYear.Text, txtMonth.Text);
            MessageBox.Show("اطلاعات با موفقیت ثبت شد", "مدیریت آموزشگاه", MessageBoxButtons.OK, MessageBoxIcon.Information);
            txtDuration.Text = txtMonth.Text = txtStart.Text = txtTitle.Text = txtYear.Text = "";
            txtTitle.Focus();
        }
    }
}
