Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KSOA.Model.Admin_SysErrorLog DataRowToModel(DataRow row)
 {
     KSOA.Model.Admin_SysErrorLog model=new KSOA.Model.Admin_SysErrorLog();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["PageUrl"]!=null)
         {
             model.PageUrl=row["PageUrl"].ToString();
         }
         if(row["ErrorMsg"]!=null)
         {
             model.ErrorMsg=row["ErrorMsg"].ToString();
         }
         if(row["AddTime"]!=null && row["AddTime"].ToString()!="")
         {
             model.AddTime=DateTime.Parse(row["AddTime"].ToString());
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KSOA.Model.Admin_SysErrorLog GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,PageUrl,ErrorMsg,AddTime from Admin_SysErrorLog ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

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