コード例 #1
0
        /// <summary>
        /// 取得表权限控制数据表实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="name">字段名称</param>
        /// <param name="value">字段值</param>
        /// <returns>实体</returns>
        public PiTablePermissionScopeEntity GetTablePermissionScopeEntity(UserInfo userInfo, string name, object value)
        {
            PiTablePermissionScopeEntity entity = null;
            var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                entity = new TablePermissionScopeManager(dbProvider, userInfo).GetEntity(name, value);
            });
            return(entity);
        }
コード例 #2
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder"></param>
 /// <param name="piTablePermissionScopeEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, PiTablePermissionScopeEntity piTablePermissionScopeEntity)
 {
     SetEntityExpand(sqlBuilder, piTablePermissionScopeEntity);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldParentId, piTablePermissionScopeEntity.ParentId);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldItemCode, piTablePermissionScopeEntity.ItemCode);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldItemName, piTablePermissionScopeEntity.ItemName);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldItemValue, piTablePermissionScopeEntity.ItemValue);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldEnabled, piTablePermissionScopeEntity.Enabled);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldIsPublic, piTablePermissionScopeEntity.IsPublic);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldAllowEdit, piTablePermissionScopeEntity.AllowEdit);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldAllowDelete, piTablePermissionScopeEntity.AllowDelete);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldDeleteMark, piTablePermissionScopeEntity.DeleteMark);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldSortCode, piTablePermissionScopeEntity.SortCode);
     sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldDescription, piTablePermissionScopeEntity.Description);
 }
コード例 #3
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="piTablePermissionScopeEntity">实体</param>
        public int UpdateEntity(PiTablePermissionScopeEntity piTablePermissionScopeEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, piTablePermissionScopeEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(PiTablePermissionScopeTable.FieldModifiedOn);
            sqlBuilder.SetWhere(PiTablePermissionScopeTable.FieldId, piTablePermissionScopeEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
コード例 #4
0
        //==========================================================================================
        //===================================TablePermissionScope控制相关===========================
        //==========================================================================================

        #region public string AddTablePermissionScope(UserInfo userInfo, PiTablePermissionScopeEntity entity, out string statusCode, out string statusMessage) 增加可做表权限控制的数据表
        /// <summary>
        /// 增加可做表权限控制的数据表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="statusCode">返回状态码</param>
        /// <param name="statusMessage">返回状态信息</param>
        /// <returns>主键</returns>
        public string AddTablePermissionScope(UserInfo userInfo, PiTablePermissionScopeEntity entity, out string statusCode, out string statusMessage)
        {
            string returnValue   = string.Empty;
            string returnCode    = string.Empty;
            string returnMessage = string.Empty;
            var    parameter     = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.TableColumnsService_AddTablePermissionScope);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager   = new TablePermissionScopeManager(dbProvider, userInfo);
                returnValue   = manager.Add(entity, out returnCode);
                returnMessage = manager.GetStateMessage(returnCode);
            });
            statusCode    = returnCode;
            statusMessage = returnMessage;
            return(returnValue);
        }
コード例 #5
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="piTablePermissionScopeEntity">实体</param>
        /// <param name="statusCode">返回状态码</param>
        /// <returns>返回</returns>
        public string Add(PiTablePermissionScopeEntity piTablePermissionScopeEntity, out string statusCode)
        {
            var returnValue = string.Empty;

            // 检查名称是否重复
            string[] names  = { PiTablePermissionScopeTable.FieldDeleteMark, PiTablePermissionScopeTable.FieldItemCode, PiTablePermissionScopeTable.FieldItemName, PiTablePermissionScopeTable.FieldItemValue };
            object[] values = { 0, piTablePermissionScopeEntity.ItemCode, piTablePermissionScopeEntity.ItemName, piTablePermissionScopeEntity.ItemValue };
            if (this.Exists(names, values))
            {
                // 名称已重复
                statusCode = StatusCode.ErrorCodeExist.ToString();
            }
            else
            {
                returnValue = this.AddEntity(piTablePermissionScopeEntity);
                // 添加成功
                statusCode = StatusCode.OKAdd.ToString();
            }

            return(returnValue);
        }
コード例 #6
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="piTablePermissionScopeEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(PiTablePermissionScopeEntity piTablePermissionScopeEntity)
 {
     return(this.AddEntity(piTablePermissionScopeEntity));
 }
コード例 #7
0
 // 这个是声明扩展方法
 partial void SetEntityExpand(SQLBuilder sqlBuilder, PiTablePermissionScopeEntity piTablePermissionScopeEntity);
コード例 #8
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="piTablePermissionScopeEntity">实体</param>
        public string AddEntity(PiTablePermissionScopeEntity piTablePermissionScopeEntity)
        {
            var sequence = string.Empty;

            if (piTablePermissionScopeEntity.SortCode == null || piTablePermissionScopeEntity.SortCode == 0)
            {
                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                sequence = sequenceManager.GetSequence(this.CurrentTableName, sequenceManager.DefaultSequence);
                piTablePermissionScopeEntity.SortCode = int.Parse(sequence);
            }
            this.Identity = false;
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, PiTablePermissionScopeTable.FieldId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(piTablePermissionScopeEntity.Id))
                {
                    sequence = BusinessLogic.NewGuid();
                    piTablePermissionScopeEntity.Id = sequence;
                }
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldId, piTablePermissionScopeEntity.Id);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(PiTablePermissionScopeTable.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(PiTablePermissionScopeTable.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (piTablePermissionScopeEntity.Id == null)
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            piTablePermissionScopeEntity.Id = sequence;
                        }
                        sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldId, piTablePermissionScopeEntity.Id);
                    }
                }
            }
            this.SetEntity(sqlBuilder, piTablePermissionScopeEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldCreateBy, UserInfo.RealName);
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(PiTablePermissionScopeTable.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(PiTablePermissionScopeTable.FieldCreateOn);
            sqlBuilder.SetDBNow(PiTablePermissionScopeTable.FieldModifiedOn);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
コード例 #9
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="piTablePermissionScopeEntity">实体</param>
 public int Update(PiTablePermissionScopeEntity piTablePermissionScopeEntity)
 {
     return(this.UpdateEntity(piTablePermissionScopeEntity));
 }
コード例 #10
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="piTablePermissionScopeEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(PiTablePermissionScopeEntity piTablePermissionScopeEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(piTablePermissionScopeEntity));
 }