Admin.cs
上传用户:szraylite
上传日期:2018-06-06
资源大小:11546k
文件大小:3k
源码类别:

软件测试

开发平台:

Java

  1. /**********************************************************
  2.  * 说明:管理员类Admin
  3.  * 作者:
  4.  * 创建日期:
  5.  *********************************************************/
  6. using System;
  7. using System.Collections;
  8. using System.Data;
  9. using ENTERPRISE.DataAccessLayer;
  10. using ENTERPRISE.DataAccessHelper;
  11. namespace ENTERPRISE.BusinessLogicLayer
  12. {
  13.     /// <summary>
  14.     /// Admin 的摘要说明
  15.     /// </summary>
  16.     public class Admin
  17.     {
  18.         private string _admin_name;
  19.         private string _password;
  20.         public string admin_name
  21.         {
  22.             set
  23.             {
  24.                 this._admin_name = value;
  25.             }
  26.             get
  27.             {
  28.                 return this._admin_name;
  29.             }
  30.         }
  31.         public string password
  32.         {
  33.             set
  34.             {
  35.                 this._password = value;
  36.             }
  37.             get
  38.             {
  39.                 return this._password;
  40.             }
  41.         }
  42.         public Admin()
  43.         {
  44.             //
  45.             // TODO: 在此处添加构造函数逻辑
  46.             //
  47.         }
  48.         #region 方法
  49.         /// <summary>
  50.         /// 向数据库添加一个用户
  51.         /// </summary>
  52.         /// <param name="message">用户信息哈希表</param>
  53.         public void Add(NoSortHashtable admininfo)
  54.         {
  55.             Database db = new Database(); //实例化一个Database类
  56.             db.Insert("[admin_info]", admininfo);
  57.         }
  58.         /// <summary>
  59.         /// 修改留言内容
  60.         /// </summary>
  61.         /// <param name="newTopicInfo"></param>
  62.         public void Update(Hashtable admininfo, string admin_name)
  63.         {
  64.             Database db = new Database();
  65.             string strCond = "Where admin_name = " + admin_name;
  66.             db.Update("[admin_info]", admininfo, strCond);
  67.         }
  68.         /// <summary>
  69.         /// 删除留言
  70.         /// </summary>
  71.         public void Delete()
  72.         {
  73.             ArrayList sqls = new ArrayList();
  74.             string sql = "";
  75.             sql = "Delete from [admin_info] where admin_name = " + this._admin_name;
  76.             sqls.Add(sql);
  77.             Database db = new Database();
  78.             db.ExecuteSQL(sqls);
  79.         }
  80.         /// <summary>
  81.         /// 按时间降序,读取所有留言
  82.         /// </summary>
  83.         /// <returns></returns>
  84.         public static DataSet QueryMessages()
  85.         {
  86.             string sql = "";
  87.             sql = "Select * from [admin_info]";
  88.             Database db = new Database();
  89.             return db.GetDataSet(sql);
  90.         }
  91.         /// <summary>
  92.         /// 根据参数topicID,获取帖子细信息
  93.         /// </summary>
  94.         /// <param name="topicID">帖子ID</param>
  95.         public void LoadData(string admin_name)
  96.         {
  97.             Database db = new Database(); //实例化一个Database类
  98.             string sql = "";
  99.             sql = "Select * from [admin_info] where admin_name = " + admin_name;
  100.             DataRow dr = db.GetDataRow(sql); //利用Database类的GetDataRow方法查询用户数据
  101.             //根据查询得到的数据,对成员赋值
  102.             if (dr != null)
  103.             {
  104.                 this._admin_name = GetSafeData.ValidateDataRow_S(dr, "admin_name");
  105.                 this._password = GetSafeData.ValidateDataRow_S(dr, "password");
  106.             }
  107.         }
  108.         #endregion 方法
  109.     }
  110. }