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

软件测试

开发平台:

Java

  1. /**********************************************************
  2.  * 说明:文章类ArticleClass
  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.     /// ArticleClass 的摘要说明
  15.     /// </summary>
  16.     /// 
  17.     public class ArticleClass
  18.     {
  19.         private int _id;
  20.         private string _column_name;
  21.         private string _column_memo;
  22.         public int id
  23.         {
  24.             set
  25.             {
  26.                 this._id = value;
  27.             }
  28.             get
  29.             {
  30.                 return this._id;
  31.             }
  32.         }
  33.         public string column_name
  34.         {
  35.             set
  36.             {
  37.                 this._column_name = value;
  38.             }
  39.             get
  40.             {
  41.                 return this._column_name;
  42.             }
  43.         }
  44.         public string column_memo
  45.         {
  46.             set
  47.             {
  48.                 this._column_memo = value;
  49.             }
  50.             get
  51.             {
  52.                 return this._column_memo;
  53.             }
  54.         }
  55.         public ArticleClass()
  56.         {
  57.             //
  58.             // TODO: 在此处添加构造函数逻辑
  59.             //
  60.         }
  61.         #region 方法
  62.         /// <summary>
  63.         /// 向数据库添加一个用户
  64.         /// </summary>
  65.         /// <param name="message">用户信息哈希表</param>
  66.         public void Add(NoSortHashtable ArticleClass)
  67.         {
  68.             Database db = new Database(); //实例化一个Database类
  69.             db.Insert("[column]", ArticleClass);
  70.         }
  71.         /// <summary>
  72.         /// 修改留言内容
  73.         /// </summary>
  74.         /// <param name="newTopicInfo"></param>
  75.         public void Update(Hashtable ArticleClass, int id)
  76.         {
  77.             Database db = new Database();
  78.             string strCond = "Where id = " + id;
  79.             db.Update("[column]", ArticleClass, strCond);
  80.         }
  81.         /// <summary>
  82.         /// 删除留言
  83.         /// </summary>
  84.         public void Delete()
  85.         {
  86.             ArrayList sqls = new ArrayList();
  87.             string sql = "";
  88.             sql = "Delete from [column] where id = " + this._id;
  89.             sqls.Add(sql);
  90.             Database db = new Database();
  91.             db.ExecuteSQL(sqls);
  92.         }
  93.         /// <summary>
  94.         /// 按时间降序,读取所有留言
  95.         /// </summary>
  96.         /// <returns></returns>
  97.         public static DataSet Queryclass()
  98.         {
  99.             string sql = "";
  100.             sql = "Select * from [column]";
  101.             Database db = new Database();
  102.             return db.GetDataSet(sql);
  103.         }
  104.         /// <summary>
  105.         /// 根据参数ID,获取帖子细信息
  106.         /// </summary>
  107.         /// <param name="topicID">帖子ID</param>
  108.         public void LoadData(int id)
  109.         {
  110.             Database db = new Database(); //实例化一个Database类
  111.             string sql = "";
  112.             sql = "Select * from [column] where id = " + id;
  113.             DataRow dr = db.GetDataRow(sql); //利用Database类的GetDataRow方法查询用户数据
  114.             //根据查询得到的数据,对成员赋值
  115.             if (dr != null)
  116.             {
  117.                 this._id = GetSafeData.ValidateDataRow_N(dr, "id");
  118.                 this._column_name = GetSafeData.ValidateDataRow_S(dr, "column_name");
  119.                 this._column_memo = GetSafeData.ValidateDataRow_S(dr, "column_memo");
  120.             }
  121.         }
  122.         #endregion 方法
  123.     }
  124. }