/// <summary> /// 得到一个对象实体 /// </summary> public KSOA.Model.Admin_OperatLog DataRowToModel(DataRow row) { KSOA.Model.Admin_OperatLog model=new KSOA.Model.Admin_OperatLog(); if (row != null) { if(row["ID"]!=null && row["ID"].ToString()!="") { model.ID=int.Parse(row["ID"].ToString()); } if(row["OperatorID"]!=null && row["OperatorID"].ToString()!="") { model.OperatorID=int.Parse(row["OperatorID"].ToString()); } if(row["OperatorName"]!=null) { model.OperatorName=row["OperatorName"].ToString(); } if(row["Module"]!=null) { model.Module=row["Module"].ToString(); } if(row["OperationContent"]!=null) { model.OperationContent=row["OperationContent"].ToString(); } if(row["OpIp"]!=null) { model.OpIp=row["OpIp"].ToString(); } if(row["AddTime"]!=null && row["AddTime"].ToString()!="") { model.AddTime=DateTime.Parse(row["AddTime"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KSOA.Model.Admin_OperatLog GetModel(int ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,OperatorID,OperatorName,Module,OperationContent,OpIp,AddTime from Admin_OperatLog "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4) }; parameters[0].Value = ID; KSOA.Model.Admin_OperatLog model=new KSOA.Model.Admin_OperatLog(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }