/// <summary> /// 得到一个对象实体 /// </summary> public HisClient.Model.his_bil_cl_receipt DataRowToModel(DataRow row) { HisClient.Model.his_bil_cl_receipt model=new HisClient.Model.his_bil_cl_receipt(); if (row != null) { if(row["CL_RECEIPT_CODE"]!=null) { model.CL_RECEIPT_CODE=row["CL_RECEIPT_CODE"].ToString(); } if(row["CL_CODE"]!=null) { model.CL_CODE=row["CL_CODE"].ToString(); } if(row["CASHIER"]!=null) { model.CASHIER=row["CASHIER"].ToString(); } if(row["RECEICPT_CODE"]!=null) { model.RECEICPT_CODE=row["RECEICPT_CODE"].ToString(); } if(row["RECIVER_TIME"]!=null && row["RECIVER_TIME"].ToString()!="") { model.RECIVER_TIME=DateTime.Parse(row["RECIVER_TIME"].ToString()); } if(row["CASH_AMT"]!=null && row["CASH_AMT"].ToString()!="") { model.CASH_AMT=decimal.Parse(row["CASH_AMT"].ToString()); } if(row["CARD_AMT"]!=null && row["CARD_AMT"].ToString()!="") { model.CARD_AMT=decimal.Parse(row["CARD_AMT"].ToString()); } if(row["INSURANCE_AMT"]!=null && row["INSURANCE_AMT"].ToString()!="") { model.INSURANCE_AMT=decimal.Parse(row["INSURANCE_AMT"].ToString()); } if(row["SUM_AMT"]!=null && row["SUM_AMT"].ToString()!="") { model.SUM_AMT=decimal.Parse(row["SUM_AMT"].ToString()); } if(row["REFUND_RECP_CODE"]!=null) { model.REFUND_RECP_CODE=row["REFUND_RECP_CODE"].ToString(); } if(row["REFUND_DATE"]!=null && row["REFUND_DATE"].ToString()!="") { model.REFUND_DATE=DateTime.Parse(row["REFUND_DATE"].ToString()); } if(row["REFUND_OPT"]!=null) { model.REFUND_OPT=row["REFUND_OPT"].ToString(); } if(row["REDUCE_AMT"]!=null && row["REDUCE_AMT"].ToString()!="") { model.REDUCE_AMT=int.Parse(row["REDUCE_AMT"].ToString()); } if(row["REDUCE_DATE"]!=null && row["REDUCE_DATE"].ToString()!="") { model.REDUCE_DATE=DateTime.Parse(row["REDUCE_DATE"].ToString()); } if(row["REDUCE_OPT"]!=null) { model.REDUCE_OPT=row["REDUCE_OPT"].ToString(); } if(row["REDUCE_REASON"]!=null) { model.REDUCE_REASON=row["REDUCE_REASON"].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_cl_receipt GetModel(string CL_RECEIPT_CODE,string CL_CODE) { StringBuilder strSql=new StringBuilder(); strSql.Append("select CL_RECEIPT_CODE,CL_CODE,CASHIER,RECEICPT_CODE,RECIVER_TIME,CASH_AMT,CARD_AMT,INSURANCE_AMT,SUM_AMT,REFUND_RECP_CODE,REFUND_DATE,REFUND_OPT,REDUCE_AMT,REDUCE_DATE,REDUCE_OPT,REDUCE_REASON,OPT_USER,OPT_DATE,OPT_TERM,OPT_ORGA from his_bil_cl_receipt "); strSql.Append(" where CL_RECEIPT_CODE=@CL_RECEIPT_CODE and CL_CODE=@CL_CODE "); MySqlParameter[] parameters = { new MySqlParameter("@CL_RECEIPT_CODE", MySqlDbType.VarChar,18), new MySqlParameter("@CL_CODE", MySqlDbType.VarChar,18) }; parameters[0].Value = CL_RECEIPT_CODE; parameters[1].Value = CL_CODE; HisClient.Model.his_bil_cl_receipt model=new HisClient.Model.his_bil_cl_receipt(); DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }