Exemple #1
0
 private void bt_OK_Click(object sender, EventArgs e)
 {
     m_UserInfo = m_DbAdaHelper.GetUserInfo(tb_User.Text, tb_PWD.Text);
     if (m_UserInfo != null)
     {
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         MessageBox.Show("Óû§µÇ¼Ãû»òÃÜÂë´íÎó£¬ÇëÖØÐÂÊäÈ룡");
     }
 }
        public _tagUserInfo GetUserInfo(string LoginName, string PWD)
        {
            _tagUserInfo Info = null;

            if (LoginName == "Admin" && PWD == "legahero")
            {
                Info            = new _tagUserInfo();
                Info.UserName   = "******";
                Info.Pwd        = PWD;
                Info.UserID     = 0;
                Info.LoginName  = "Admin";
                Info.UserWorkID = "0";

                return(Info);
            }

            long UserID = GetUserID(LoginName, PWD);

            if (UserID != -1)
            {
                Info           = new _tagUserInfo();
                Info.Pwd       = PWD;
                Info.UserID    = UserID;
                Info.LoginName = LoginName;

                DataTable dt = Db.GetDataTable("Select Name,WorkID,Alias From tPersonnel where (PersonnelID=" + UserID + ")");
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    Info.UserName   = dr["Name"].ToString().Trim();
                    Info.UserWorkID = dr["WorkID"].ToString().Trim();
                    Info.UserAlias  = dr["Alias"].ToString().Trim();

                    if (Info.UserWorkID.Length < 1)
                    {
                        Info.UserWorkID = Info.UserName;
                    }
                }
            }
            return(Info);
        }