Code
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.Security;
using System.Security.Cryptography;
using DBSql;
namespace NetManageSystem
{
/**//// <summary>
/// AutheLib 的摘要说明。
/// </summary>
public enum ModuleType : int
{
DevMudule = 0,
NetMudule = 3,
DocMudule = 6,
CountMudule = 10,
SysMudule = 13
}
public enum Goneng : int
{
add = 1,
delete = 2,
Edit = 3,
Look = 4
}
public class AutheLib
{
public AutheLib()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static String Encrypt(string password)
{
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
}
public static bool IsExsit(ModuleType Pro, string Nick, Goneng Gon)
{
bool IsExt = false;
string strUser = "SELECT * FROM dbo_SysCountTable where UserName='"+Nick+"'";
DataSet ds = DbService.ExecuteDataSet(strUser);
string AccessRight = ds.Tables[0].Rows[0]["UserAuthe"].ToString();
string accright = AccessRight.Substring((int)Pro,(int)Gon);
IsExt = accright.Substring(accright.Length -1, 1)== "1" ? true : false;
return IsExt;
}
}
}
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.Security;
using System.Security.Cryptography;
using DBSql;
namespace NetManageSystem
{
/**//// <summary>
/// AutheLib 的摘要说明。
/// </summary>
public enum ModuleType : int
{
DevMudule = 0,
NetMudule = 3,
DocMudule = 6,
CountMudule = 10,
SysMudule = 13
}
public enum Goneng : int
{
add = 1,
delete = 2,
Edit = 3,
Look = 4
}
public class AutheLib
{
public AutheLib()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static String Encrypt(string password)
{
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
}
public static bool IsExsit(ModuleType Pro, string Nick, Goneng Gon)
{
bool IsExt = false;
string strUser = "SELECT * FROM dbo_SysCountTable where UserName='"+Nick+"'";
DataSet ds = DbService.ExecuteDataSet(strUser);
string AccessRight = ds.Tables[0].Rows[0]["UserAuthe"].ToString();
string accright = AccessRight.Substring((int)Pro,(int)Gon);
IsExt = accright.Substring(accright.Length -1, 1)== "1" ? true : false;
return IsExt;
}
}
}