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;
using System.Data.SqlClient;
using MyDataAccess;

namespace Amozeshgah
{
    public partial class DarsJadid : Form
    {
        public DarsJadid()
        {
            InitializeComponent();
        }

        cDataAccess cData = new cDataAccess(clsPath.ConnectionString());

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            cData.Sql_Command.Parameters.AddWithValue("@NameDars", txtNameBook.Text);
            cData.Sql_Command.Parameters.AddWithValue("@Mozo", txtMozo.Text);
            cData.Sql_Command.Parameters.AddWithValue("@TedadVahed", txtTedadVahed.Text);
            cData.Sql_Command.Parameters.AddWithValue("@NameOstad", txtOstad.Text);

            string sql ="INSERT INTO [tDoros]([NameDars],[Mozo],[TedadVahed],[NameOstad])VALUES(@NameDars,@Mozo,@TedadVahed,@NameOstad)";

            cData.ExecuteNonQuery(sql);
            cData.Sql_Command.Parameters.Clear();

            txtMozo.Text = "";
            txtNameBook.Text = "";
            txtOstad.Text = "";
            txtTedadVahed.Text = "";
        }
    }
}
