예제 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HisClient.Model.his_pm_exportinfo DataRowToModel(DataRow row)
 {
     HisClient.Model.his_pm_exportinfo model=new HisClient.Model.his_pm_exportinfo();
     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["MEDINFO_CODE"]!=null)
         {
             model.MEDINFO_CODE=row["MEDINFO_CODE"].ToString();
         }
         if(row["MED_SPC"]!=null)
         {
             model.MED_SPC=row["MED_SPC"].ToString();
         }
         if(row["MED_UNIT"]!=null)
         {
             model.MED_UNIT=row["MED_UNIT"].ToString();
         }
         if(row["MED_AMOUNT"]!=null && row["MED_AMOUNT"].ToString()!="")
         {
             model.MED_AMOUNT=decimal.Parse(row["MED_AMOUNT"].ToString());
         }
         if(row["MED_PRICE"]!=null && row["MED_PRICE"].ToString()!="")
         {
             model.MED_PRICE=decimal.Parse(row["MED_PRICE"].ToString());
         }
         if(row["PURCHASE_PRICE"]!=null && row["PURCHASE_PRICE"].ToString()!="")
         {
             model.PURCHASE_PRICE=decimal.Parse(row["PURCHASE_PRICE"].ToString());
         }
         if(row["WHOLESALE_PRICE"]!=null && row["WHOLESALE_PRICE"].ToString()!="")
         {
             model.WHOLESALE_PRICE=decimal.Parse(row["WHOLESALE_PRICE"].ToString());
         }
         if(row["VALIDITY_DATE"]!=null && row["VALIDITY_DATE"].ToString()!="")
         {
             model.VALIDITY_DATE=DateTime.Parse(row["VALIDITY_DATE"].ToString());
         }
         if(row["MED_MADETIME"]!=null && row["MED_MADETIME"].ToString()!="")
         {
             model.MED_MADETIME=DateTime.Parse(row["MED_MADETIME"].ToString());
         }
         if(row["BATCHNO"]!=null)
         {
             model.BATCHNO=row["BATCHNO"].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());
         }
     }
     return model;
 }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HisClient.Model.his_pm_exportinfo GetModel(string ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,EXPORT_CODE,MEDINFO_CODE,MED_SPC,MED_UNIT,MED_AMOUNT,MED_PRICE,PURCHASE_PRICE,WHOLESALE_PRICE,VALIDITY_DATE,MED_MADETIME,BATCHNO,CREATE_BY,CREATE_DATE from his_pm_exportinfo ");
            strSql.Append(" where ID=@ID ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@ID", MySqlDbType.VarChar,18)			};
            parameters[0].Value = ID;

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