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

namespace DabirKhane
{
    public partial class pass : Form
    {
        public string m;
        public pass()
        {
            InitializeComponent();
        }

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

        private void pass_Load(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            if ((textBox4.Text == "") | (textBox5.Text == "") | (textBox6.Text ==""))
            {
                button3.Enabled = false;

            }
            else
            {
                button3.Enabled = true;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox4.Text == m)
            {
                if (textBox5.Text == textBox6.Text)
                {
                    string s = "update ramz set password='" + textBox5.Text + "' where'" + textBox4.Text + "'=" + m + ""; 
                    Payegah.UpDate (Variables.masir,s);
                    textBox4.Text = "";
                    textBox5.Text = "";
                    textBox6.Text = "";
                }
                else
                {
                    MessageBox.Show("تكرار رمز اشتباه است", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("رمز قديم را اشتباه وارد كرده ايد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

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

        private void pass_Activated(object sender, EventArgs e)
        {
            Payegah.FindNumberORpassWord(Variables.masir, Variables.StrCommandRamz);
            m = Payegah.PassWord;

        }
    }
}