public Model.CreditLeavlInfo GetLastItem() { XYECOM.Model.CreditLeavlInfo info = null; string sql = "select top 1 * from XY_CreditLeavl order by leavl Desc"; using (SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (reader.Read()) { info = new XYECOM.Model.CreditLeavlInfo(); info.Id = Core.MyConvert.GetInt32(reader["Id"].ToString()); info.LeavlName = reader["LeavlName"].ToString(); info.Leavl = Core.MyConvert.GetInt32(reader["Leavl"].ToString()); info.UpPoint = Core.MyConvert.GetInt32(reader["UpPoint"].ToString()); info.DownPoint = Core.MyConvert.GetInt32(reader["DownPoint"].ToString()); info.ImagePath = reader["ImagePath"].ToString(); } } return info; }
public Model.CreditLeavlInfo GetItemByPoint(decimal points) { XYECOM.Model.CreditLeavlInfo info = null; string sql = "select top 1 * from XY_CreditLeavl where (DownPoint<= " + points + " and (UpPoint>=" + points + " or UpPoint=-1))"; using (SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (reader.Read()) { info = new XYECOM.Model.CreditLeavlInfo(); info.Id = Core.MyConvert.GetInt32(reader["Id"].ToString()); info.LeavlName = reader["LeavlName"].ToString(); info.Leavl = Core.MyConvert.GetInt32(reader["Leavl"].ToString()); info.UpPoint = Core.MyConvert.GetInt32(reader["UpPoint"].ToString()); info.DownPoint = Core.MyConvert.GetInt32(reader["DownPoint"].ToString()); info.ImagePath = reader["ImagePath"].ToString(); } } return info; }
/// <summary> /// 根据Id获取实体信息 /// </summary> /// <param name="infoId">信息主键Id</param> /// <returns>数据实体对象</returns> public XYECOM.Model.CreditLeavlInfo GetItem(int infoId) { XYECOM.Model.CreditLeavlInfo info = null; SqlParameter[] parame = new SqlParameter[] { new SqlParameter("@Id",infoId) }; string sql = "select * from XY_CreditLeavl where Id = @Id"; using (SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, parame)) { if (reader.Read()) { info = new XYECOM.Model.CreditLeavlInfo(); info.Id = Core.MyConvert.GetInt32(reader["Id"].ToString()); info.LeavlName = reader["LeavlName"].ToString(); info.Leavl = Core.MyConvert.GetInt32(reader["Leavl"].ToString()); info.UpPoint = Core.MyConvert.GetInt32(reader["UpPoint"].ToString()); info.DownPoint = Core.MyConvert.GetInt32(reader["DownPoint"].ToString()); info.ImagePath = reader["ImagePath"].ToString(); } } return info; }