Ejemplo n.º 1
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool Join_MbtiResultsEdit(Entity.Join_MbtiResults info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",        SqlDbType.Int,      4, info.Id),
                SqlDB.MakeInParam("@StudentId", SqlDbType.Int,      4, info.StudentId),
                SqlDB.MakeInParam("@E",         SqlDbType.Int,      4, info.E),
                SqlDB.MakeInParam("@I",         SqlDbType.Int,      4, info.I),
                SqlDB.MakeInParam("@S",         SqlDbType.Int,      4, info.S),
                SqlDB.MakeInParam("@N",         SqlDbType.Int,      4, info.N),
                SqlDB.MakeInParam("@T",         SqlDbType.Int,      4, info.T),
                SqlDB.MakeInParam("@F",         SqlDbType.Int,      4, info.F),
                SqlDB.MakeInParam("@J",         SqlDbType.Int,      4, info.J),
                SqlDB.MakeInParam("@P",         SqlDbType.Int,      4, info.P),
                SqlDB.MakeInParam("@AddTime",   SqlDbType.DateTime, 8, info.AddTime),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "Join_MbtiResultsEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public static Entity.Join_MbtiResults Join_MbtiResultsEntityGetByStudentId(int StudentId)
        {
            Entity.Join_MbtiResults info = new Entity.Join_MbtiResults();
            DataTable dt = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT top 1 * FROM [Join_MbtiResults] WHERE StudentId = " + StudentId + " ORDER BY Id DESC").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id        = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.StudentId = Basic.Utils.StrToInt(dt.Rows[0]["StudentId"].ToString(), 0);
                info.E         = Basic.Utils.StrToInt(dt.Rows[0]["E"].ToString(), 0);
                info.I         = Basic.Utils.StrToInt(dt.Rows[0]["I"].ToString(), 0);
                info.S         = Basic.Utils.StrToInt(dt.Rows[0]["S"].ToString(), 0);
                info.N         = Basic.Utils.StrToInt(dt.Rows[0]["N"].ToString(), 0);
                info.T         = Basic.Utils.StrToInt(dt.Rows[0]["T"].ToString(), 0);
                info.F         = Basic.Utils.StrToInt(dt.Rows[0]["F"].ToString(), 0);
                info.J         = Basic.Utils.StrToInt(dt.Rows[0]["J"].ToString(), 0);
                info.P         = Basic.Utils.StrToInt(dt.Rows[0]["P"].ToString(), 0);
                info.AddTime   = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString());

                return(info);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int Join_MbtiResultsAdd(Entity.Join_MbtiResults info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@StudentId", SqlDbType.Int, 4, info.StudentId),
         SqlDB.MakeInParam("@E",         SqlDbType.Int, 4, info.E),
         SqlDB.MakeInParam("@I",         SqlDbType.Int, 4, info.I),
         SqlDB.MakeInParam("@S",         SqlDbType.Int, 4, info.S),
         SqlDB.MakeInParam("@N",         SqlDbType.Int, 4, info.N),
         SqlDB.MakeInParam("@T",         SqlDbType.Int, 4, info.T),
         SqlDB.MakeInParam("@F",         SqlDbType.Int, 4, info.F),
         SqlDB.MakeInParam("@J",         SqlDbType.Int, 4, info.J),
         SqlDB.MakeInParam("@P",         SqlDbType.Int, 4, info.P),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "Join_MbtiResultsAdd", prams).ToString(), -1));
 }