Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HisClient.Model.his_hos_account DataRowToModel(DataRow row)
 {
     HisClient.Model.his_hos_account model=new HisClient.Model.his_hos_account();
     if (row != null)
     {
         if(row["HOS_ACC_CODE"]!=null)
         {
             model.HOS_ACC_CODE=row["HOS_ACC_CODE"].ToString();
         }
         if(row["HIS_HOS_CODE"]!=null)
         {
             model.HIS_HOS_CODE=row["HIS_HOS_CODE"].ToString();
         }
         if(row["IP"]!=null)
         {
             model.IP=row["IP"].ToString();
         }
         if(row["SUM_IN"]!=null && row["SUM_IN"].ToString()!="")
         {
             model.SUM_IN=decimal.Parse(row["SUM_IN"].ToString());
         }
         if(row["SUM_OUT"]!=null && row["SUM_OUT"].ToString()!="")
         {
             model.SUM_OUT=decimal.Parse(row["SUM_OUT"].ToString());
         }
         if(row["ACCOUNT_BALANCE"]!=null && row["ACCOUNT_BALANCE"].ToString()!="")
         {
             model.ACCOUNT_BALANCE=decimal.Parse(row["ACCOUNT_BALANCE"].ToString());
         }
         if(row["LOWER_LIMIT"]!=null && row["LOWER_LIMIT"].ToString()!="")
         {
             model.LOWER_LIMIT=decimal.Parse(row["LOWER_LIMIT"].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;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HisClient.Model.his_hos_account GetModel(string HOS_ACC_CODE,string HIS_HOS_CODE)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select HOS_ACC_CODE,HIS_HOS_CODE,IP,SUM_IN,SUM_OUT,ACCOUNT_BALANCE,LOWER_LIMIT,OPT_USER,OPT_DATE,OPT_TERM,OPT_ORGA from his_hos_account ");
            strSql.Append(" where HOS_ACC_CODE=@HOS_ACC_CODE and HIS_HOS_CODE=@HIS_HOS_CODE ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@HOS_ACC_CODE", MySqlDbType.VarChar,18),
                    new MySqlParameter("@HIS_HOS_CODE", MySqlDbType.VarChar,18)			};
            parameters[0].Value = HOS_ACC_CODE;
            parameters[1].Value = HIS_HOS_CODE;

            HisClient.Model.his_hos_account model=new HisClient.Model.his_hos_account();
            DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }