RaUI/Source/OnLineUpgradeConfig/User/UserData.cs

40 lines
1.3 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using ryCommon;
using ryCommonDb;
using ryConfig.MSSQLTables;
namespace Server.User
{
//用户数据实现
class UserData:IUserData
{
public bool CheckUser(string userName, string password,out string nickName)
{
nickName = "";
DataProvider mydb = new DataProvider();
IDbInterface db =new SqlDataProvider();
if (db.ConnDb(Config.clsPram.SQLConnStr) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL(TableUsers.TableName);
mySQL.AddParameter("@userid", userName);
mySQL.AddParameter("@pwd", password);
DataSet ds = db.ReadData("select * from " + TableUsers.TableName + " where "
+ TableUsers.UserId + "=@userid and "
+ TableUsers.Pwd + "=@pwd and " + TableUsers.Enabled + "=1", mySQL);
if (mydb.HaveData(ds))
{
DataRow reader = ds.Tables[0].Rows[0];
nickName = reader[TableUsers.NickName].ToString();
db.Free();
return true;
}
}
db.Free();
return false;
}
}
}