示例#1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int ShiJuan2TiMuAdd(Entity.ShiJuan2TiMu info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@exam_id",     SqlDbType.Int,      4, info.exam_id),
         SqlDB.MakeInParam("@question_id", SqlDbType.VarChar, 64, info.question_id),
         SqlDB.MakeInParam("@q_index",     SqlDbType.Int,      4, info.q_index),
         SqlDB.MakeInParam("@subject_id",  SqlDbType.Int,      4, info.subject_id),
         SqlDB.MakeInParam("@Id",          SqlDbType.Int,      4, info.Id),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "ShiJuan2TiMuAdd", prams).ToString(), -1));
 }
示例#2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="OldId">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.ShiJuan2TiMu ShiJuan2TiMuEntityGet(int OldId)
        {
            Entity.ShiJuan2TiMu info = new Entity.ShiJuan2TiMu();
            DataTable           dt   = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT * FROM [ShiJuan2TiMu] WHERE OldId = " + OldId + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.OldId       = Basic.Utils.StrToInt(dt.Rows[0]["OldId"].ToString(), 0);
                info.exam_id     = Basic.Utils.StrToInt(dt.Rows[0]["exam_id"].ToString(), 0);
                info.question_id = dt.Rows[0]["question_id"].ToString();
                info.q_index     = Basic.Utils.StrToInt(dt.Rows[0]["q_index"].ToString(), 0);
                info.subject_id  = Basic.Utils.StrToInt(dt.Rows[0]["subject_id"].ToString(), 0);
                info.Id          = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
            }
            return(info);
        }
示例#3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool ShiJuan2TiMuEdit(Entity.ShiJuan2TiMu info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@OldId",       SqlDbType.Int,      4, info.OldId),
                SqlDB.MakeInParam("@exam_id",     SqlDbType.Int,      4, info.exam_id),
                SqlDB.MakeInParam("@question_id", SqlDbType.VarChar, 64, info.question_id),
                SqlDB.MakeInParam("@q_index",     SqlDbType.Int,      4, info.q_index),
                SqlDB.MakeInParam("@subject_id",  SqlDbType.Int,      4, info.subject_id),
                SqlDB.MakeInParam("@Id",          SqlDbType.Int,      4, info.Id),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "ShiJuan2TiMuEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }