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

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