Code
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.Security;
using System.Security.Cryptography;
using DBSql;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
namespace NetManageSystem
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// AutheLib 的摘要说明。
/// </summary>
public enum ModuleType : int
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DevMudule = 0,
NetMudule = 3,
DocMudule = 6,
CountMudule = 10,
SysMudule = 13
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
public enum Goneng : int
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
add = 1,
delete = 2,
Edit = 3,
Look = 4
}
public class AutheLib
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
public AutheLib()
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
//
// TODO: 在此处添加构造函数逻辑
//
}
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
public static String Encrypt(string password)
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
}
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
public static bool IsExsit(ModuleType Pro, string Nick, Goneng Gon)
![ExpandedSubBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
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;
}
}
}
转载于:https://www.cnblogs.com/jianjialin/archive/2009/01/08/1371963.html