Пример #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HisClient.Model.his_ds_importinfo DataRowToModel(DataRow row)
 {
     HisClient.Model.his_ds_importinfo model=new HisClient.Model.his_ds_importinfo();
     if (row != null)
     {
         if(row["ID"]!=null)
         {
             model.ID=row["ID"].ToString();
         }
         if(row["IMPORT_CODE"]!=null)
         {
             model.IMPORT_CODE=row["IMPORT_CODE"].ToString();
         }
         if(row["MED_CODE"]!=null)
         {
             model.MED_CODE=row["MED_CODE"].ToString();
         }
         if(row["MED_NAME"]!=null)
         {
             model.MED_NAME=row["MED_NAME"].ToString();
         }
         if(row["PAKAGE_UNIT"]!=null)
         {
             model.PAKAGE_UNIT=row["PAKAGE_UNIT"].ToString();
         }
         if(row["PAKAGE_AMOUNT"]!=null && row["PAKAGE_AMOUNT"].ToString()!="")
         {
             model.PAKAGE_AMOUNT=int.Parse(row["PAKAGE_AMOUNT"].ToString());
         }
         if(row["MENUFACTURE_CODE"]!=null)
         {
             model.MENUFACTURE_CODE=row["MENUFACTURE_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_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["VALIDITY_DATE"]!=null && row["VALIDITY_DATE"].ToString()!="")
         {
             model.VALIDITY_DATE=DateTime.Parse(row["VALIDITY_DATE"].ToString());
         }
         if(row["BATCHNO"]!=null)
         {
             model.BATCHNO=row["BATCHNO"].ToString();
         }
         if(row["MED_MADETIME"]!=null && row["MED_MADETIME"].ToString()!="")
         {
             model.MED_MADETIME=DateTime.Parse(row["MED_MADETIME"].ToString());
         }
         if(row["WHOLESALE_PRICE"]!=null && row["WHOLESALE_PRICE"].ToString()!="")
         {
             model.WHOLESALE_PRICE=decimal.Parse(row["WHOLESALE_PRICE"].ToString());
         }
     }
     return model;
 }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HisClient.Model.his_ds_importinfo GetModel(string ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,IMPORT_CODE,MED_CODE,MED_NAME,PAKAGE_UNIT,PAKAGE_AMOUNT,MENUFACTURE_CODE,MEDINFO_CODE,MED_SPC,MED_PRICE,PURCHASE_PRICE,VALIDITY_DATE,BATCHNO,MED_MADETIME,WHOLESALE_PRICE from his_ds_importinfo ");
            strSql.Append(" where ID=@ID ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@ID", MySqlDbType.VarChar,18)			};
            parameters[0].Value = ID;

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