Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_sTicket DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_sTicket model = new WechatBuilder.Model.wx_sTicket();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["actionName"] != null)
         {
             model.actionName = row["actionName"].ToString();
         }
         if (row["succTip"] != null)
         {
             model.succTip = row["succTip"].ToString();
         }
         if (row["brief"] != null)
         {
             model.brief = row["brief"].ToString();
         }
         if (row["beginDate"] != null && row["beginDate"].ToString() != "")
         {
             model.beginDate = DateTime.Parse(row["beginDate"].ToString());
         }
         if (row["endDate"] != null && row["endDate"].ToString() != "")
         {
             model.endDate = DateTime.Parse(row["endDate"].ToString());
         }
         if (row["aContent"] != null)
         {
             model.aContent = row["aContent"].ToString();
         }
         if (row["usedRemark"] != null)
         {
             model.usedRemark = row["usedRemark"].ToString();
         }
         if (row["telphone"] != null)
         {
             model.telphone = row["telphone"].ToString();
         }
         if (row["wUrl"] != null)
         {
             model.wUrl = row["wUrl"].ToString();
         }
         if (row["seq"] != null && row["seq"].ToString() != "")
         {
             model.seq = int.Parse(row["seq"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["endNotice"] != null)
         {
             model.endNotice = row["endNotice"].ToString();
         }
         if (row["endContent"] != null)
         {
             model.endContent = row["endContent"].ToString();
         }
         if (row["bannerPic"] != null)
         {
             model.bannerPic = row["bannerPic"].ToString();
         }
         if (row["beginPic"] != null)
         {
             model.beginPic = row["beginPic"].ToString();
         }
         if (row["endPic"] != null)
         {
             model.endPic = row["endPic"].ToString();
         }
         if (row["pwd"] != null)
         {
             model.pwd = row["pwd"].ToString();
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_sTicket GetModel(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,wid,actionName,succTip,brief,beginDate,endDate,aContent,usedRemark,telphone,wUrl,seq,remark,createDate,endNotice,endContent,bannerPic,beginPic,endPic,pwd from wx_sTicket ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            WechatBuilder.Model.wx_sTicket model = new WechatBuilder.Model.wx_sTicket();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }