コード例 #1
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Danyl.SnnuURP.Model.WageAdjustment DataRowToModel(DataRow row)
		{
			Danyl.SnnuURP.Model.WageAdjustment model=new Danyl.SnnuURP.Model.WageAdjustment();
			if (row != null)
			{
				if(row["Id"]!=null && row["Id"].ToString()!="")
				{
					model.Id=int.Parse(row["Id"].ToString());
				}
				if(row["Tid"]!=null && row["Tid"].ToString()!="")
				{
					model.Tid=int.Parse(row["Tid"].ToString());
				}
				if(row["NewSalary"]!=null && row["NewSalary"].ToString()!="")
				{
					model.NewSalary=decimal.Parse(row["NewSalary"].ToString());
				}
				if(row["OldSalary"]!=null && row["OldSalary"].ToString()!="")
				{
					model.OldSalary=decimal.Parse(row["OldSalary"].ToString());
				}
				if(row["Reason"]!=null)
				{
					model.Reason=row["Reason"].ToString();
				}
				if(row["AdjustDate"]!=null && row["AdjustDate"].ToString()!="")
				{
					model.AdjustDate=DateTime.Parse(row["AdjustDate"].ToString());
				}
				if(row["Remark"]!=null)
				{
					model.Remark=row["Remark"].ToString();
				}
			}
			return model;
		}
コード例 #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Danyl.SnnuURP.Model.WageAdjustment GetModel(int Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Id,Tid,NewSalary,OldSalary,Reason,AdjustDate,Remark from WageAdjustment ");
			strSql.Append(" where Id=@Id");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)
			};
			parameters[0].Value = Id;

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