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

            if (dt.Rows.Count > 0)
            {
                info.TestId     = Basic.Utils.StrToInt(dt.Rows[0]["TestId"].ToString(), 0);
                info.TestNumber = Basic.Utils.StrToInt(dt.Rows[0]["TestNumber"].ToString(), 0);
                info.TestTitle  = dt.Rows[0]["TestTitle"].ToString();
                info.TestType   = dt.Rows[0]["TestType"].ToString();
                info.TestGroup  = dt.Rows[0]["TestGroup"].ToString();
            }
            return(info);
        }
Esempio n. 3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool Join_ZhongKeTestEdit(Entity.Join_ZhongKeTest info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@TestId",     SqlDbType.Int,        4, info.TestId),
                SqlDB.MakeInParam("@TestNumber", SqlDbType.Int,        4, info.TestNumber),
                SqlDB.MakeInParam("@TestTitle",  SqlDbType.NVarChar, 100, info.TestTitle),
                SqlDB.MakeInParam("@TestType",   SqlDbType.NVarChar,   1, info.TestType),
                SqlDB.MakeInParam("@TestGroup",  SqlDbType.VarChar,  100, info.TestGroup),
            };
            int intReturnValue = 0;

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