/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_bil_counter DataRowToModel(DataRow row) { HisClient.Model.his_bil_counter model=new HisClient.Model.his_bil_counter(); if (row != null) { if(row["ID"]!=null) { model.ID=row["ID"].ToString(); } if(row["CASHIER"]!=null) { model.CASHIER=row["CASHIER"].ToString(); } if(row["START_IVNNO"]!=null) { model.START_IVNNO=row["START_IVNNO"].ToString(); } if(row["END_IVNNO"]!=null) { model.END_IVNNO=row["END_IVNNO"].ToString(); } if(row["RECP_TYPE"]!=null) { model.RECP_TYPE=row["RECP_TYPE"].ToString(); } if(row["USE_TYPE"]!=null) { model.USE_TYPE=row["USE_TYPE"].ToString(); } if(row["RECP_COUNT"]!=null && row["RECP_COUNT"].ToString()!="") { model.RECP_COUNT=decimal.Parse(row["RECP_COUNT"].ToString()); } if(row["PRE_CODE"]!=null) { model.PRE_CODE=row["PRE_CODE"].ToString(); } if(row["REFOUNDED_COUNT"]!=null && row["REFOUNDED_COUNT"].ToString()!="") { model.REFOUNDED_COUNT=decimal.Parse(row["REFOUNDED_COUNT"].ToString()); } if(row["INVALID_COUNT"]!=null && row["INVALID_COUNT"].ToString()!="") { model.INVALID_COUNT=decimal.Parse(row["INVALID_COUNT"].ToString()); } if(row["OPT_USER"]!=null) { model.OPT_USER=row["OPT_USER"].ToString(); } if(row["OPT_DATE"]!=null && row["OPT_DATE"].ToString()!="") { model.OPT_DATE=DateTime.Parse(row["OPT_DATE"].ToString()); } if(row["OPT_TERM"]!=null) { model.OPT_TERM=row["OPT_TERM"].ToString(); } if(row["OPT_ORGA"]!=null) { model.OPT_ORGA=row["OPT_ORGA"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_bil_counter GetModel(string ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select ID,CASHIER,START_IVNNO,END_IVNNO,RECP_TYPE,USE_TYPE,RECP_COUNT,PRE_CODE,REFOUNDED_COUNT,INVALID_COUNT,OPT_USER,OPT_DATE,OPT_TERM,OPT_ORGA from his_bil_counter "); strSql.Append(" where ID=@ID "); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar,18) }; parameters[0].Value = ID; HisClient.Model.his_bil_counter model=new HisClient.Model.his_bil_counter(); DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }