using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Configuration;
using System.Security.Cryptography;
using System.Text;namespace Hugo.BookShop
{
/// <summary>
/// User 的摘要说明。
/// </summary>
public class User:DbBase.Base
{
public User()
{
//
// TODO: 在此处添加构造函数逻辑
//
}     private string m_Password;
private string m_Mail; public string Password
{
get
{
return m_Password;
}
set
{
m_Password=value;
}
} public string Mail
{
get
{
return m_Mail;
}
set
{
m_Mail=value;
}
} public static void Add(string name,string password,string mail)
{
if(IsExist(name))
{
throw new Exception("This name was registered!");
}
else
{
strSQL="insert into userinfo(name,password,mail) values('"+name+"','"+Functions.Encrypt(password,1)+"','"+mail+"')";
try
{
ExecuteSql(strSQL);
}
catch
{
throw new Exception("Register Failed!");
}
}
} public static void ChangePassword(string name,string oldPassword,string newPassword)
{
strSQL="Update userinfo set "+"password='"+Functions.Encrypt(newPassword,1)+"'"+"where name='"+name+"'"+"and password='"+Functions.Encrypt(oldPassword,1)+"'";
try
{
ExecuteSql(strSQL); }
catch
{
throw new Exception("Change Password Failed");
} } public static bool Check(string name,string mail)
{
strSQL="select id from userinfo where name='"+name+"' and mail='"+mail+"'";
try
{
ExecuteSql4Value(strSQL);
return true; }
catch
{
return false;
}
} public static void Delete(int id)
{
strSQL="delete from userinfo where id="+id;
try
{
ExecuteSql(strSQL);
}
catch
{
throw new Exception("Delete user Failed");
}
} public static void Delete(string name)
{
strSQL="delete from userinfo where userinfo="+name;
try
{
ExecuteSql(strSQL);
}
catch
{
throw new Exception("Delete user Failed");
}
} public static void DeleteGroup(string names)
{
strSQL="delete from userinfo where name in('"+names+"')";
try
{
ExecuteSql(strSQL);
}
catch
{
throw new Exception("Delete user Failed");
} } public static bool IsExist(string name)
{
strSQL="select id from userinfo where name='"+name+"'";
try
{
ExecuteSql4Value(strSQL);
return true;
}
catch 
{
return false;
}
} public static bool IsSupervisor(string name)
{
string strManager=ConfigurationSettings.AppSettings["Manager"];
string[] names=strManager.Split(',');
int i;
for(i=0;i<names.Length;i++)
{
if(name==names[i])
{
return true;
}
}
return false;
} public static string GetPassword(string name)
{
Random rnd=new Random();
StringBuilder sb=new StringBuilder();
int i;
for(i=0;i<32;i++)
{
sb.Append(rnd.Next(0,9).ToString());
}
string Password=sb.ToString();
string EnPassword=Functions.Encrypt(Password,1); strSQL="Update userinfo set password='"+EnPassword+"' where name='"+name+"'";
try
{
ExecuteSql(strSQL);
return Password;
}
catch
{
throw new Exception("Get Password Failed");
}
} public static bool Login(string name,string password)
{
strSQL="select id from userinfo where name='"+name+"' and password='"+Functions.Encrypt(password,1)+"'";
try
{
ExecuteSql4Value(strSQL);
return true;
}
catch
{
return false;
}
} public static bool Update(string mail,string name,string password)
{
strSQL="Update userinfo set mail='"+mail+"' where name='"+name+"' and password='"+Functions.Encrypt(password,1)+"'";
try
{
ExecuteSql(strSQL);
return true;
}
catch
{
throw new Exception("Update failed!");
}
} public static DataSet GetUsers()
{
strSQL="select * from userinfo"; try
{
return ExecuteSql4Ds(strSQL);
}
catch
{
throw new Exception("Get all Users Information failed!");
}
} public bool GetUserInfo()
{
strSQL="select * from userinfo where name='"+this.Name+"'";
    
SqlConnection myCn=new SqlConnection(strConn);
myCn.Open();
SqlCommand myCmd=new SqlCommand(strSQL,myCn); try
{
myCmd.ExecuteNonQuery();
SqlDataReader reader=myCmd.ExecuteReader();
if(reader.Read())
{
this.ID=reader.GetInt32(0);
this.Mail=reader.GetString(3);
return true;
}
else
{
return false;
}
}
catch(System.Data.SqlClient.SqlException e)
{
throw new Exception(e.Message);
}
finally
{
myCmd.Dispose();
myCn.Close();
}
}
当我引用类库时Hugo.BookShop.User user=new Hugo.BookShop.User();
却只能看见GetUserInfo这个函数,其他只要前面有static的就看不见,
但是删除了static又报错!
请问高手门如何解决