Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SHMetroTestSysModel.jc_Dbbak DataRowToModel(DataRow row)
 {
     SHMetroTestSysModel.jc_Dbbak model=new SHMetroTestSysModel.jc_Dbbak();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["bakFileName"]!=null)
         {
             model.bakFileName=row["bakFileName"].ToString();
         }
         if(row["fileSize"]!=null && row["fileSize"].ToString()!="")
         {
             model.fileSize=int.Parse(row["fileSize"].ToString());
         }
         if(row["bakDate"]!=null && row["bakDate"].ToString()!="")
         {
             model.bakDate=DateTime.Parse(row["bakDate"].ToString());
         }
         if(row["describe"]!=null)
         {
             model.describe=row["describe"].ToString();
         }
     }
     return model;
 }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SHMetroTestSysModel.jc_Dbbak GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,bakFileName,fileSize,bakDate,describe from jc_Dbbak ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

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