Exemple #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HisClient.Model.his_cl_order_item DataRowToModel(DataRow row)
 {
     HisClient.Model.his_cl_order_item model=new HisClient.Model.his_cl_order_item();
     if (row != null)
     {
         if(row["ID"]!=null)
         {
             model.ID=row["ID"].ToString();
         }
         if(row["CL_PRES_CODE"]!=null)
         {
             model.CL_PRES_CODE=row["CL_PRES_CODE"].ToString();
         }
         if(row["CL_CODE"]!=null)
         {
             model.CL_CODE=row["CL_CODE"].ToString();
         }
         if(row["ITEM_CODE"]!=null)
         {
             model.ITEM_CODE=row["ITEM_CODE"].ToString();
         }
         if(row["ITEM_NAME"]!=null)
         {
             model.ITEM_NAME=row["ITEM_NAME"].ToString();
         }
         if(row["COUNT"]!=null && row["COUNT"].ToString()!="")
         {
             model.COUNT=decimal.Parse(row["COUNT"].ToString());
         }
         if(row["PRICE"]!=null && row["PRICE"].ToString()!="")
         {
             model.PRICE=decimal.Parse(row["PRICE"].ToString());
         }
         if(row["ITEM_TYPE"]!=null)
         {
             model.ITEM_TYPE=row["ITEM_TYPE"].ToString();
         }
         if(row["SPEC"]!=null)
         {
             model.SPEC=row["SPEC"].ToString();
         }
         if(row["UNIT"]!=null)
         {
             model.UNIT=row["UNIT"].ToString();
         }
         if(row["SUM_AMT"]!=null && row["SUM_AMT"].ToString()!="")
         {
             model.SUM_AMT=decimal.Parse(row["SUM_AMT"].ToString());
         }
         if(row["STATUS"]!=null)
         {
             model.STATUS=row["STATUS"].ToString();
         }
         if(row["HERB_NUM"]!=null && row["HERB_NUM"].ToString()!="")
         {
             model.HERB_NUM=decimal.Parse(row["HERB_NUM"].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;
 }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HisClient.Model.his_cl_order_item GetModel(string ID,string CL_PRES_CODE,string CL_CODE)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,CL_PRES_CODE,CL_CODE,ITEM_CODE,ITEM_NAME,COUNT,PRICE,ITEM_TYPE,SPEC,UNIT,SUM_AMT,STATUS,HERB_NUM,OPT_USER,OPT_DATE,OPT_TERM,OPT_ORGA from his_cl_order_item ");
            strSql.Append(" where ID=@ID and CL_PRES_CODE=@CL_PRES_CODE and CL_CODE=@CL_CODE ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@ID", MySqlDbType.VarChar,18),
                    new MySqlParameter("@CL_PRES_CODE", MySqlDbType.VarChar,18),
                    new MySqlParameter("@CL_CODE", MySqlDbType.VarChar,18)			};
            parameters[0].Value = ID;
            parameters[1].Value = CL_PRES_CODE;
            parameters[2].Value = CL_CODE;

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