Ejemplo n.º 1
0
        ///
        /// 重新生成排序码
        ///

        #region public int BatchSetSortCode(string[] ids) 重置排序码
        /// <summary>
        /// 重置排序码
        /// </summary>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int BatchSetSortCode(string[] ids)
        {
            int result = 0;
            BaseSequenceManager sequenceManager = new BaseSequenceManager(dbHelper);

            string[] sortCodes = sequenceManager.GetBatchSequence(this.CurrentTableName, ids.Length);
            for (int i = 0; i < ids.Length; i++)
            {
                result += this.SetProperty(ids[i], new KeyValuePair <string, object>(BaseBusinessLogic.FieldSortCode, sortCodes[i]));
            }
            return(result);
        }
Ejemplo n.º 2
0
        public int Grant(string[] userIds, string permissionItemId)
        {
            int returnValue = 0;
            BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper);

            string[] sequenceIds = sequenceManager.GetBatchSequence(BasePermissionEntity.TableName, userIds.Length);
            BasePermissionManager permissionManager = new BasePermissionManager(DbHelper, UserInfo, this.CurrentTableName);

            for (int i = 0; i < userIds.Length; i++)
            {
                this.Grant(permissionManager, sequenceIds[i], userIds[i], permissionItemId);
                returnValue++;
            }
            return(returnValue);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 重置排序码
 /// </summary>
 /// <param name="organizeId">组织机构主键</param>
 public int ResetSortCode(string organizeId)
 {
     int result = 0;
     var dt = this.GetDataTable();
     string id = string.Empty;
     BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper);
     string[] sortCode = sequenceManager.GetBatchSequence(BaseRoleEntity.TableName, dt.Rows.Count);
     int i = 0;
     foreach (DataRow dr in dt.Rows)
     {
         id = dr[BaseRoleEntity.FieldId].ToString();
         result += this.SetProperty(id, new KeyValuePair<string, object>(BaseRoleEntity.FieldSortCode, sortCode[i]));
         i++;
     }
     return result;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 重新设置表的排序码
        /// </summary>
        /// <returns>影响行数</returns>
        public virtual int ResetSortCode()
        {
            int result = 0;
            var dt     = this.GetDataTable(0, BaseBusinessLogic.FieldSortCode);
            BaseSequenceManager sequenceManager = new BaseSequenceManager(dbHelper);

            string[] sortCode = sequenceManager.GetBatchSequence(this.CurrentTableName, dt.Rows.Count);
            int      i        = 0;

            foreach (DataRow dr in dt.Rows)
            {
                result += this.SetProperty(dr[BaseBusinessLogic.FieldId].ToString(), new KeyValuePair <string, object>(BaseBusinessLogic.FieldSortCode, sortCode[i]));
                i++;
            }
            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 重置排序码
        /// </summary>
        /// <param name="organizationId">组织机构主键</param>
        public int ResetSortCode(string organizationId)
        {
            var result          = 0;
            var dt              = GetDataTable();
            var id              = string.Empty;
            var managerSequence = new BaseSequenceManager(DbHelper);
            var sortCode        = managerSequence.GetBatchSequence(BaseRoleEntity.CurrentTableName, dt.Rows.Count);
            var i = 0;

            foreach (DataRow dr in dt.Rows)
            {
                id      = dr[BaseRoleEntity.FieldId].ToString();
                result += SetProperty(id, new KeyValuePair <string, object>(BaseRoleEntity.FieldSortCode, sortCode[i]));
                i++;
            }
            return(result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 重置排序码
        /// </summary>
        /// <param name="parentId">父节点主键</param>
        public int ResetSortCode(string parentId)
        {
            int                 returnValue     = 0;
            DataTable           dataTable       = this.GetDataTableByParent(parentId);
            string              id              = string.Empty;
            BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper);

            string[] sortCode = sequenceManager.GetBatchSequence(BaseModuleEntity.TableName, dataTable.Rows.Count);
            int      i        = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                id           = dataRow[BaseModuleEntity.FieldId].ToString();
                returnValue += this.SetProperty(id, new KeyValuePair <string, object>(BaseModuleEntity.FieldSortCode, sortCode[i]));
                i++;
            }
            return(returnValue);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取序列号
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户</param>
        /// <param name="fullName">序列名称</param>
        /// <param name="count">个数</param>
        /// <returns>序列号</returns>
        public string[] GetBatchSequence(IDbHelper dbHelper, BaseUserInfo userInfo, string fullName, int count)
        {
            var sequenceManager = new BaseSequenceManager(dbHelper);

            return(sequenceManager.GetBatchSequence(fullName, count));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取序列号
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户</param>
        /// <param name="name">序列名称</param>
        /// <param name="count">个数</param>
        /// <returns>序列号</returns>
        public string[] GetBatchSequence(IDbHelper dbHelper, BaseUserInfo userInfo, string name, int count)
        {
            var managerSequence = new BaseSequenceManager(dbHelper, userInfo);

            return(managerSequence.GetBatchSequence(name, count));
        }