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

            if (dt.Rows.Count > 0)
            {
                info.AnswerId      = Basic.Utils.StrToInt(dt.Rows[0]["AnswerId"].ToString(), 0);
                info.TestId        = Basic.Utils.StrToInt(dt.Rows[0]["TestId"].ToString(), 0);
                info.AnswerContent = dt.Rows[0]["AnswerContent"].ToString();
                info.Fraction      = Basic.Utils.StrToInt(dt.Rows[0]["Fraction"].ToString(), 0);
                info.Opetion       = dt.Rows[0]["Opetion"].ToString();
            }
            return(info);
        }
示例#3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool Join_StudyAbroadAnswerEdit(Entity.Join_StudyAbroadAnswer info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@AnswerId",      SqlDbType.Int,       4, info.AnswerId),
                SqlDB.MakeInParam("@TestId",        SqlDbType.Int,       4, info.TestId),
                SqlDB.MakeInParam("@AnswerContent", SqlDbType.NVarChar, 50, info.AnswerContent),
                SqlDB.MakeInParam("@Fraction",      SqlDbType.Int,       4, info.Fraction),
                SqlDB.MakeInParam("@Opetion",       SqlDbType.NVarChar, 50, info.Opetion),
            };
            int intReturnValue = 0;

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