/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_ds_export DataRowToModel(DataRow row) { HisClient.Model.his_ds_export model=new HisClient.Model.his_ds_export(); if (row != null) { if(row["ID"]!=null) { model.ID=row["ID"].ToString(); } if(row["EXPORT_CODE"]!=null) { model.EXPORT_CODE=row["EXPORT_CODE"].ToString(); } if(row["MANUFACTURE_NAME"]!=null) { model.MANUFACTURE_NAME=row["MANUFACTURE_NAME"].ToString(); } if(row["MANUFACTURE_CODE"]!=null) { model.MANUFACTURE_CODE=row["MANUFACTURE_CODE"].ToString(); } if(row["EXPORT_TYPE"]!=null) { model.EXPORT_TYPE=row["EXPORT_TYPE"].ToString(); } if(row["EXPORT_DEPT"]!=null) { model.EXPORT_DEPT=row["EXPORT_DEPT"].ToString(); } if(row["CREATE_BY"]!=null) { model.CREATE_BY=row["CREATE_BY"].ToString(); } if(row["CREATE_DATE"]!=null && row["CREATE_DATE"].ToString()!="") { model.CREATE_DATE=DateTime.Parse(row["CREATE_DATE"].ToString()); } if(row["COST"]!=null && row["COST"].ToString()!="") { model.COST=decimal.Parse(row["COST"].ToString()); } if(row["OPERATOR_NAME"]!=null) { model.OPERATOR_NAME=row["OPERATOR_NAME"].ToString(); } if(row["OPERATOR_DATE"]!=null && row["OPERATOR_DATE"].ToString()!="") { model.OPERATOR_DATE=DateTime.Parse(row["OPERATOR_DATE"].ToString()); } if(row["CANCEL_OPERATOR"]!=null) { model.CANCEL_OPERATOR=row["CANCEL_OPERATOR"].ToString(); } if(row["CANCEL_DATE"]!=null && row["CANCEL_DATE"].ToString()!="") { model.CANCEL_DATE=DateTime.Parse(row["CANCEL_DATE"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_ds_export GetModel(string ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select ID,EXPORT_CODE,MANUFACTURE_NAME,MANUFACTURE_CODE,EXPORT_TYPE,EXPORT_DEPT,CREATE_BY,CREATE_DATE,COST,OPERATOR_NAME,OPERATOR_DATE,CANCEL_OPERATOR,CANCEL_DATE from his_ds_export "); strSql.Append(" where ID=@ID "); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar,18) }; parameters[0].Value = ID; HisClient.Model.his_ds_export model=new HisClient.Model.his_ds_export(); DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }