/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_comm_function DataRowToModel(DataRow row) { HisClient.Model.his_comm_function model=new HisClient.Model.his_comm_function(); if (row != null) { if(row["ID"]!=null) { model.ID=row["ID"].ToString(); } if(row["MODULE_CODE"]!=null) { model.MODULE_CODE=row["MODULE_CODE"].ToString(); } if(row["FUNCTION_CODE"]!=null) { model.FUNCTION_CODE=row["FUNCTION_CODE"].ToString(); } if(row["FUNCTION_NAME"]!=null) { model.FUNCTION_NAME=row["FUNCTION_NAME"].ToString(); } if(row["IS_USE"]!=null) { model.IS_USE=row["IS_USE"].ToString(); } if(row["HOSPITAL_CODE"]!=null) { model.HOSPITAL_CODE=row["HOSPITAL_CODE"].ToString(); } if(row["REMARKS"]!=null) { model.REMARKS=row["REMARKS"].ToString(); } if(row["CREATE_DATE"]!=null && row["CREATE_DATE"].ToString()!="") { model.CREATE_DATE=DateTime.Parse(row["CREATE_DATE"].ToString()); } if(row["CREATE_BY"]!=null) { model.CREATE_BY=row["CREATE_BY"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_comm_function GetModel(string ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select ID,MODULE_CODE,FUNCTION_CODE,FUNCTION_NAME,IS_USE,HOSPITAL_CODE,REMARKS,CREATE_DATE,CREATE_BY from his_comm_function "); strSql.Append(" where ID=@ID "); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar,18) }; parameters[0].Value = ID; HisClient.Model.his_comm_function model=new HisClient.Model.his_comm_function(); DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }