Ejemplo n.º 1
0
        /// <summary>
        /// 得到  tb_point_statistics 数据实体
        /// </summary>
        /// <param name="dr">dr</param>
        /// <returns>tb_point_statistics 数据实体</returns>
        public tb_Point_StatisticsEntity Populate_tb_Point_StatisticsEntity_FromDr(IDataReader dr)
        {
            tb_Point_StatisticsEntity Obj = new tb_Point_StatisticsEntity();

            Obj.Id       = ((dr["Id"]) == DBNull.Value)?0:Convert.ToInt32(dr["Id"]);
            Obj.SchoolId = ((dr["SchoolId"]) == DBNull.Value)?0:Convert.ToInt32(dr["SchoolId"]);
            Obj.UserId   = ((dr["UserId"]) == DBNull.Value)?0:Convert.ToInt32(dr["UserId"]);
            Obj.Point    = ((dr["Point"]) == DBNull.Value)?0:Convert.ToInt32(dr["Point"]);

            return(Obj);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 向数据表tb_Point_Statistics更新一条记录。
        /// </summary>
        /// <param name="_tb_Point_StatisticsModel">_tb_Point_StatisticsModel</param>
        /// <returns>影响的行数</returns>
        public int Update(tb_Point_StatisticsEntity _tb_Point_StatisticsModel)
        {
            string sqlStr = "update tb_Point_Statistics set [SchoolId]=@SchoolId,[UserId]=@UserId,[Point]=@Point where Id=@Id";

            SqlParameter[] _param =
            {
                new SqlParameter("@Id",       SqlDbType.Int),
                new SqlParameter("@SchoolId", SqlDbType.Int),
                new SqlParameter("@UserId",   SqlDbType.Int),
                new SqlParameter("@Point",    SqlDbType.Int)
            };
            _param[0].Value = _tb_Point_StatisticsModel.Id;
            _param[1].Value = _tb_Point_StatisticsModel.SchoolId;
            _param[2].Value = _tb_Point_StatisticsModel.UserId;
            _param[3].Value = _tb_Point_StatisticsModel.Point;
            return(SqlHelper.ExecuteNonQuery(WebConfig.ExamRW, CommandType.Text, sqlStr, _param));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 向数据库中插入一条新记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_tb_Point_StatisticsModel">tb_Point_Statistics实体</param>
        /// <returns>新插入记录的编号</returns>
        public int Insert(SqlTransaction sp, tb_Point_StatisticsEntity _tb_Point_StatisticsModel)
        {
            string sqlStr = "insert into tb_Point_Statistics([SchoolId],[UserId],[Point]) values(@SchoolId,@UserId,@Point) select @@identity";
            int    res;

            SqlParameter[] _param =
            {
                new SqlParameter("@SchoolId", SqlDbType.Int),
                new SqlParameter("@UserId",   SqlDbType.Int),
                new SqlParameter("@Point",    SqlDbType.Int)
            };
            _param[0].Value = _tb_Point_StatisticsModel.SchoolId;
            _param[1].Value = _tb_Point_StatisticsModel.UserId;
            _param[2].Value = _tb_Point_StatisticsModel.Point;
            res             = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param));
            return(res);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到  tb_point_statistics 数据实体
        /// </summary>
        /// <param name="row">row</param>
        /// <returns>tb_point_statistics 数据实体</returns>
        public tb_Point_StatisticsEntity Populate_tb_Point_StatisticsEntity_FromDr(DataRow row)
        {
            tb_Point_StatisticsEntity Obj = new tb_Point_StatisticsEntity();

            if (row != null)
            {
                Obj.Id       = ((row["Id"]) == DBNull.Value)?0:Convert.ToInt32(row["Id"]);
                Obj.SchoolId = ((row["SchoolId"]) == DBNull.Value)?0:Convert.ToInt32(row["SchoolId"]);
                Obj.UserId   = ((row["UserId"]) == DBNull.Value)?0:Convert.ToInt32(row["UserId"]);
                Obj.Point    = ((row["Point"]) == DBNull.Value)?0:Convert.ToInt32(row["Point"]);
            }
            else
            {
                return(null);
            }
            return(Obj);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据ID,返回一个tb_Point_Statistics对象
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>tb_Point_Statistics对象</returns>
        public tb_Point_StatisticsEntity Get_tb_Point_StatisticsEntity(int id)
        {
            tb_Point_StatisticsEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@Id", SqlDbType.Int)
            };
            _param[0].Value = id;
            string sqlStr = "select * from tb_Point_Statistics with(nolock) where Id=@Id";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.ExamRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_tb_Point_StatisticsEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
Ejemplo n.º 6
0
 public void Update(tb_Point_StatisticsEntity tb_Point_StatisticsEntity)
 {
     tb_Point_Statisticsdal.Update(tb_Point_StatisticsEntity);
 }
Ejemplo n.º 7
0
 public int Insert(tb_Point_StatisticsEntity tb_Point_StatisticsEntity)
 {
     return tb_Point_Statisticsdal.Insert(tb_Point_StatisticsEntity);            
 }