using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace 人力资源管理系统
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }        private void 登录窗体_Load(object sender, EventArgs e)
        {}
            public bool bResult=false ;
            public string UserId="";
            public string UserPwd="";
            private void txbPwd_KeyPress(object sender ,System .WindowsFormsSection.FormStartPosition.KeyPressEventArgs e)
            {
               if (e.KeyChar==(char)13&&(UserControl!=""))
               {
                   this.btnSummit_Click(null ,null);
               }
             }
         private void txbUserId_KeyPress(object sender ,System .WindowsFormsSection.FormStartPosition.KeyPressEventArgs e)
            {
               if (e.KeyChar==(char)13)
               {
                   this.txbPwd.Focus ();
               }
             }
         private void txbUserId_Leave(object sender ,System .EventArgs e)
         {
             DataBase db=new DataBase();
             DataView dv=db.RunSelectSQL("Select 密码 from 用户清单 where用户编码='"+this.txbUserId.Text.Trim()+"'");
             if (dv .Count == 0)
             {
                 this.txbUserId.Txet="";
                 this.txbPwd.Txet="";
                 
             }
             else 
             {
                 UserId=this.txbUserId.Text.Trim();
                 this.UserPwd =dv.Item[0]["密码"];             }
             db.Dispose();
         }
        private void btnSummit_Click(object sender ,System .EventArgs e)
        {
            if ((this.UserPwd.Trim()==this.txbPwd.Text.Trim())&&UserPwd !="")
            {
                bResult =ture;
                this.Close();
            }
            else
            {
                bResult =false;
                MessageBox.Show("请确认你的密码是否证正确");
            }
        }
        private void btnClear_Click(object sender ,System .EventArgs e)
        {
            this.CloseReason();
        Application .Exit();
        }
        }
    }
}