示例#1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int SchoolCategoryAdd(Entity.SchoolCategory info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@CategoryName", SqlDbType.NVarChar, 200, info.CategoryName),
         SqlDB.MakeInParam("@Sort",         SqlDbType.Int,        4, info.Sort),
         SqlDB.MakeInParam("@IsPause",      SqlDbType.Int,        4, info.IsPause),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "SchoolCategoryAdd", prams).ToString(), -1));
 }
示例#2
0
        /// <summary>
        /// 暂停该值
        /// </summary>
        /// <param name="Int">自增id的值</param>
        /// <returns>暂停成功返回ture,否则返回false</returns>
        public static bool SchoolCategoryPause(Entity.SchoolCategory info)
        {
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.Text, "UPDATE [SchoolCategory] SET IsPause = " + info.IsPause + "  WHERE Int =  " + info.Int);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Int">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.SchoolCategory SchoolCategoryEntityGet(int Int)
        {
            Entity.SchoolCategory info = new Entity.SchoolCategory();
            DataTable             dt   = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [SchoolCategory] WHERE Int = " + Int + ";").Tables[0];

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

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