Admin.cs
资源名称:moban.rar [点击查看]
上传用户:szraylite
上传日期:2018-06-06
资源大小:11546k
文件大小:3k
源码类别:
软件测试
开发平台:
Java
- /**********************************************************
- * 说明:管理员类Admin
- * 作者:
- * 创建日期:
- *********************************************************/
- using System;
- using System.Collections;
- using System.Data;
- using ENTERPRISE.DataAccessLayer;
- using ENTERPRISE.DataAccessHelper;
- namespace ENTERPRISE.BusinessLogicLayer
- {
- /// <summary>
- /// Admin 的摘要说明
- /// </summary>
- public class Admin
- {
- private string _admin_name;
- private string _password;
- public string admin_name
- {
- set
- {
- this._admin_name = value;
- }
- get
- {
- return this._admin_name;
- }
- }
- public string password
- {
- set
- {
- this._password = value;
- }
- get
- {
- return this._password;
- }
- }
- public Admin()
- {
- //
- // TODO: 在此处添加构造函数逻辑
- //
- }
- #region 方法
- /// <summary>
- /// 向数据库添加一个用户
- /// </summary>
- /// <param name="message">用户信息哈希表</param>
- public void Add(NoSortHashtable admininfo)
- {
- Database db = new Database(); //实例化一个Database类
- db.Insert("[admin_info]", admininfo);
- }
- /// <summary>
- /// 修改留言内容
- /// </summary>
- /// <param name="newTopicInfo"></param>
- public void Update(Hashtable admininfo, string admin_name)
- {
- Database db = new Database();
- string strCond = "Where admin_name = " + admin_name;
- db.Update("[admin_info]", admininfo, strCond);
- }
- /// <summary>
- /// 删除留言
- /// </summary>
- public void Delete()
- {
- ArrayList sqls = new ArrayList();
- string sql = "";
- sql = "Delete from [admin_info] where admin_name = " + this._admin_name;
- sqls.Add(sql);
- Database db = new Database();
- db.ExecuteSQL(sqls);
- }
- /// <summary>
- /// 按时间降序,读取所有留言
- /// </summary>
- /// <returns></returns>
- public static DataSet QueryMessages()
- {
- string sql = "";
- sql = "Select * from [admin_info]";
- Database db = new Database();
- return db.GetDataSet(sql);
- }
- /// <summary>
- /// 根据参数topicID,获取帖子细信息
- /// </summary>
- /// <param name="topicID">帖子ID</param>
- public void LoadData(string admin_name)
- {
- Database db = new Database(); //实例化一个Database类
- string sql = "";
- sql = "Select * from [admin_info] where admin_name = " + admin_name;
- DataRow dr = db.GetDataRow(sql); //利用Database类的GetDataRow方法查询用户数据
- //根据查询得到的数据,对成员赋值
- if (dr != null)
- {
- this._admin_name = GetSafeData.ValidateDataRow_S(dr, "admin_name");
- this._password = GetSafeData.ValidateDataRow_S(dr, "password");
- }
- }
- #endregion 方法
- }
- }