Beispiel #1
0
 private void fillModel(DbDataReader dr, QAInfo model)
 {
     model.ID        = dr.GetInt32(0);
     model.CatName   = dr.GetString(1);
     model.QATitle   = dr.GetString(2);
     model.QAContent = dr.GetString(3);
 }
Beispiel #2
0
        public int Update(QAInfo model)
        {
            string strSql = SQL_UPDATE + PK_PARA_SET;

            DbParameter[] paras = makeParameterForUpdate(model);
            return(Db.Helper.ExecuteNonQuery(strSql, paras));
        }
Beispiel #3
0
        public int Update(QAInfo model, DbTransaction tran)
        {
            string strSql = SQL_UPDATE + PK_PARA_SET;

            DbParameter[] para = makeParameterForUpdate(model);
            return(Db.Helper.ExecuteNonQuery(tran, strSql, para));
        }
Beispiel #4
0
 private DbParameter[] makeParameterForAdd(QAInfo model)
 {
     DbParameter[] paras =
     {
         Db.Helper.MakeInParameter("@CatName",   model.CatName),
         Db.Helper.MakeInParameter("@QATitle",   model.QATitle),
         Db.Helper.MakeInParameter("@QAContent", model.QAContent)
     };
     return(paras);
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (CurrentQA == null)
     {
         List <TMS.QAInfo> qaList = new TMS.QA().SelectList(1, "1=1", "ID asc", null);
         if (qaList.Count == 1)
         {
             CurrentQA = qaList[0];
             Response.Redirect("QA.aspx?cat=" + Server.UrlEncode(CurrentQA.CatName) + "&ID=" + CurrentQA.ID);
         }
         else
         {
             //没有任何内容,跳转到首页
             Response.Redirect("Default.aspx");
         }
     }
 }
Beispiel #6
0
 public int Add(QAInfo model)
 {
     DbParameter[] paras = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras));
 }
Beispiel #7
0
 public int Add(QAInfo model, DbTransaction tran)
 {
     DbParameter[] para = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para));
 }