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

namespace LibraryMembers
{
    public partial class frmTamdideozviiat : Form
    {

        public void dbConnection()
        {
            clsGrideview dbCon1 = new clsGrideview();
            dataGridView1.DataSource = dbCon1.dbConnection(@"SELECT MemBerID, Name, Sname, RegDate, ExprDate, melliCode FROM dbo.Members");
        }

        public void updatesConnection()
        {
            clsUpdate dbUpd = new clsUpdate();
            dbUpd.updateSql(@"update Members set ExprDate=" + " '" + textBox5.Text + "' " + "where MemBerID=" + " '" + textBox1.Text + "'  ");
            dbConnection();


        }

        
        public frmTamdideozviiat()
        {
            InitializeComponent();
        }

        private void frmTamdideozviiat_Load(object sender, EventArgs e)
        {
            dbConnection();
        }

        private void btnTamdid_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox5.Text == "" )
            {
                MessageBox.Show("تمامی فیلدها بایستی دارای مقدار باشند");
            }
            else
            {
                updatesConnection();
                dbConnection();
            }

        }
    }
}