Ejemplo n.º 1
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool shijuanEdit(Entity.shijuan info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",          SqlDbType.Int,         4, info.Id),
                SqlDB.MakeInParam("@OldId",       SqlDbType.Int,         4, info.OldId),
                SqlDB.MakeInParam("@name",        SqlDbType.NVarChar,  128, info.name),
                SqlDB.MakeInParam("@exam_type",   SqlDbType.Int,         4, info.exam_type),
                SqlDB.MakeInParam("@subject_id",  SqlDbType.Int,         4, info.subject_id),
                SqlDB.MakeInParam("@section_id",  SqlDbType.Int,         4, info.section_id),
                SqlDB.MakeInParam("@grade_id",    SqlDbType.Int,         4, info.grade_id),
                SqlDB.MakeInParam("@province_id", SqlDbType.VarChar,     6, info.province_id),
                SqlDB.MakeInParam("@content",     SqlDbType.NVarChar, 4000, info.content),
                SqlDB.MakeInParam("@year",        SqlDbType.NVarChar,   50, info.year),
                SqlDB.MakeInParam("@score",       SqlDbType.Int,         4, info.score),
                SqlDB.MakeInParam("@source",      SqlDbType.NVarChar,  200, info.source),
                SqlDB.MakeInParam("@exam_time",   SqlDbType.Int,         4, info.exam_time),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "shijuanEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int shijuanAdd(Entity.shijuan info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@OldId",       SqlDbType.Int,         4, info.OldId),
         SqlDB.MakeInParam("@name",        SqlDbType.NVarChar,  128, info.name),
         SqlDB.MakeInParam("@exam_type",   SqlDbType.Int,         4, info.exam_type),
         SqlDB.MakeInParam("@subject_id",  SqlDbType.Int,         4, info.subject_id),
         SqlDB.MakeInParam("@section_id",  SqlDbType.Int,         4, info.section_id),
         SqlDB.MakeInParam("@grade_id",    SqlDbType.Int,         4, info.grade_id),
         SqlDB.MakeInParam("@province_id", SqlDbType.VarChar,     6, info.province_id),
         SqlDB.MakeInParam("@content",     SqlDbType.NVarChar, 4000, info.content),
         SqlDB.MakeInParam("@year",        SqlDbType.NVarChar,   50, info.year),
         SqlDB.MakeInParam("@score",       SqlDbType.Int,         4, info.score),
         SqlDB.MakeInParam("@source",      SqlDbType.NVarChar,  200, info.source),
         SqlDB.MakeInParam("@exam_time",   SqlDbType.Int,         4, info.exam_time),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "shijuanAdd", prams).ToString(), -1));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.shijuan shijuanEntityGet(int Id)
        {
            Entity.shijuan info = new Entity.shijuan();
            DataTable      dt   = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT * FROM [shijuan] WHERE Id = " + Id + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id          = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.OldId       = Basic.Utils.StrToInt(dt.Rows[0]["OldId"].ToString(), 0);
                info.name        = dt.Rows[0]["name"].ToString();
                info.exam_type   = Basic.Utils.StrToInt(dt.Rows[0]["exam_type"].ToString(), 0);
                info.subject_id  = Basic.Utils.StrToInt(dt.Rows[0]["subject_id"].ToString(), 0);
                info.section_id  = Basic.Utils.StrToInt(dt.Rows[0]["section_id"].ToString(), 0);
                info.grade_id    = Basic.Utils.StrToInt(dt.Rows[0]["grade_id"].ToString(), 0);
                info.province_id = dt.Rows[0]["province_id"].ToString();
                info.content     = dt.Rows[0]["content"].ToString();
                info.year        = dt.Rows[0]["year"].ToString();
                info.score       = Basic.Utils.StrToInt(dt.Rows[0]["score"].ToString(), 0);
                info.source      = dt.Rows[0]["source"].ToString();
                info.exam_time   = Basic.Utils.StrToInt(dt.Rows[0]["exam_time"].ToString(), 0);
            }
            return(info);
        }