예제 #1
0
        /// <summary>
        /// 获取倒序序列号
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户</param>
        /// <param name="fullName">序列名称</param>
        /// <returns>序列号</returns>
        public string GetReduction(IDbHelper dbHelper, BaseUserInfo userInfo, string fullName)
        {
            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            BaseSequenceManager sequenceManager = new BaseSequenceManager(dbHelper);
            return(sequenceManager.GetReduction(fullName));
        }
예제 #2
0
        public const string CommandSwap      = "Swap";          // 交换排序方法命名定义

        //
        // 排序操作针对数据库的运算方式定义(好用高效的排序顺序设定方法)
        //

        #region public static int SetTop(IDbHelper dbHelper, string tableName, string id) 置顶排序命令
        /// <summary>
        /// 置顶排序方法
        /// </summary>
        /// <param name="dbHelper">当前数据库连接</param>
        /// <param name="tableName">表名</param>
        /// <param name="id">主键</param>
        /// <returns>影响行数</returns>
        public static int SetTop(IDbHelper dbHelper, string tableName, string id)
        {
            BaseSequenceManager sequenceManager = new BaseSequenceManager(dbHelper);
            string sequence = sequenceManager.GetReduction(tableName);
            List <KeyValuePair <string, object> > whereParameters = new List <KeyValuePair <string, object> >();

            whereParameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, id));
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldSortCode, sequence));
            return(DbLogic.SetProperty(dbHelper, tableName, whereParameters, parameters));
        }
예제 #3
0
        //
        // 排序操作针对数据库的运算方式定义(好用高效的排序顺序设定方法)
        //

        #region 置顶排序(SortCode变小)
        /// <summary>
        /// 置顶排序(SortCode变小)
        /// </summary>
        /// <param name="dbHelper">当前数据库连接</param>
        /// <param name="tableName">表名</param>
        /// <param name="id">主键</param>
        /// <returns>影响行数</returns>
        public static int SetTop(IDbHelper dbHelper, string tableName, string id)
        {
            var managerSequence = new BaseSequenceManager(dbHelper);

            //先重置一下,避免手动添加的数据造成功能无效
            managerSequence.Reset(tableName);
            var sequence        = managerSequence.GetReduction(tableName);
            var whereParameters =
                new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(BaseUtil.FieldId, id)
            };
            var parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(BaseUtil.FieldSortCode, sequence)
            };

            return(DbUtil.SetProperty(dbHelper, tableName, whereParameters, parameters));
        }
예제 #4
0
        /// <summary>
        /// 获取倒序序列号
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户</param>
        /// <param name="fullName">序列名称</param>
        /// <returns>序列号</returns>
        public string GetReduction(IDbHelper dbHelper, BaseUserInfo userInfo, string fullName)
        {
            var sequenceManager = new BaseSequenceManager(dbHelper);

            return(sequenceManager.GetReduction(fullName));
        }
예제 #5
0
        /// <summary>
        /// 获取倒序序列号
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户</param>
        /// <param name="name">序列名称</param>
        /// <returns>序列号</returns>
        public string GetReduction(IDbHelper dbHelper, BaseUserInfo userInfo, string name)
        {
            var managerSequence = new BaseSequenceManager(dbHelper, userInfo);

            return(managerSequence.GetReduction(name));
        }