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 FarsiMsgBox;

namespace ajans
{
    public partial class form_password : Form
    {
        DataView objdv;
        public form_password()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            login Login = new login();
            objdv = new DataView(Login.SelectPassword().Tables["password"]);
            lblpass.DataBindings.Clear();
            lblpass.DataBindings.Add("text", objdv, "password");
            if (lblpass.Text != txtpass.Text) FarsiMessage.ShowMessageBox(" رمز عبور اشتباه می باشد.", "پیغام", ShowButton.تائید_تنها, MsgIcon.Information_1);
            else if (static_variables.accountKey)
            {
                if (!static_variables.form_account_show)
                {
                    form_account frmAccount = new form_account();
                    frmAccount.Show();
                    static_variables.form_account_show = true;
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
                else
                {
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
            }
            else if (static_variables.reportKey)
            {
                if (!static_variables.form_report_show)
                {
                    form_report frmReport = new form_report();
                    frmReport.Show();
                    static_variables.form_report_show = true;
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
                else
                {
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
            }
            else if (static_variables.settingKey)
            {
                if (!static_variables.form_setting_show)
                {
                    form_setting frmSetting = new form_setting();
                    frmSetting.Show();
                    static_variables.form_setting_show = true;
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
                else
                {
                    static_variables.Enter = true;
                    static_variables.statusOperator = "فعال سازی مجدد رمز امنیتی";
                    this.Close();
                }
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            static_variables.settingKey = false;
            static_variables.reportKey = false;
            static_variables.accountKey = false;

            this.Opacity = 1;
            for (int i = 100; i > 1; i--)
            {
                this.Opacity -= 0.01;
                Application.DoEvents();
            }
            this.Close();
        }
    }
}
