Exemplo n.º 1
0
        public static DbSetPermit GetDbSetPermissions(DbSetInfo dbInfo, IAuthorizer authorizer)
        {
            MethodInfo methInfo = null;
            DbSetPermit permit = new DbSetPermit();

            methInfo = dbInfo.getOperationMethodInfo(OperationNames.CREATE);
            permit.canAddRow = methInfo != null && CanAccessMethod(methInfo,authorizer);

            methInfo = dbInfo.getOperationMethodInfo(OperationNames.UPDATE);
            permit.canEditRow = methInfo != null && CanAccessMethod(methInfo, authorizer);

            methInfo = dbInfo.getOperationMethodInfo(OperationNames.DELETE);
            permit.canDeleteRow = methInfo != null && CanAccessMethod(methInfo, authorizer);

            methInfo = dbInfo.getOperationMethodInfo(OperationNames.REFRESH);
            permit.canRefreshRow = methInfo != null && CanAccessMethod(methInfo, authorizer);
            return permit;
        }
Exemplo n.º 2
0
        public static DbSetPermit GetDbSetPermissions(DbSetInfo dbInfo, IAuthorizer authorizer)
        {
            MethodInfo  methInfo = null;
            DbSetPermit permit   = new DbSetPermit();

            methInfo         = dbInfo.getOperationMethodInfo(OperationNames.CREATE);
            permit.canAddRow = methInfo != null && CanAccessMethod(methInfo, authorizer);

            methInfo          = dbInfo.getOperationMethodInfo(OperationNames.UPDATE);
            permit.canEditRow = methInfo != null && CanAccessMethod(methInfo, authorizer);

            methInfo            = dbInfo.getOperationMethodInfo(OperationNames.DELETE);
            permit.canDeleteRow = methInfo != null && CanAccessMethod(methInfo, authorizer);

            methInfo             = dbInfo.getOperationMethodInfo(OperationNames.REFRESH);
            permit.canRefreshRow = methInfo != null && CanAccessMethod(methInfo, authorizer);
            return(permit);
        }
Exemplo n.º 3
0
 public static MethodInfo GetCRUDMethodInfo(DbSetInfo dbInfo, RowInfo rowInfo)
 {
     MethodInfo methInfo = null;
     switch (rowInfo.changeType)
     {
         case ChangeType.Added:
             methInfo = dbInfo.getOperationMethodInfo(OperationNames.CREATE);
             break;
         case ChangeType.Deleted:
             methInfo = dbInfo.getOperationMethodInfo(OperationNames.DELETE);
             break;
         case ChangeType.Updated:
             methInfo = dbInfo.getOperationMethodInfo(OperationNames.UPDATE);
             break;
         default:
             throw new DomainServiceException(string.Format(ErrorStrings.ERR_REC_CHANGETYPE_INVALID, dbInfo.EntityType.Name, rowInfo.changeType));
     }
     return methInfo;
 }
Exemplo n.º 4
0
        public static MethodInfo GetCRUDMethodInfo(DbSetInfo dbInfo, RowInfo rowInfo)
        {
            MethodInfo methInfo = null;

            switch (rowInfo.changeType)
            {
            case ChangeType.Added:
                methInfo = dbInfo.getOperationMethodInfo(OperationNames.CREATE);
                break;

            case ChangeType.Deleted:
                methInfo = dbInfo.getOperationMethodInfo(OperationNames.DELETE);
                break;

            case ChangeType.Updated:
                methInfo = dbInfo.getOperationMethodInfo(OperationNames.UPDATE);
                break;

            default:
                throw new DomainServiceException(string.Format(ErrorStrings.ERR_REC_CHANGETYPE_INVALID, dbInfo.EntityType.Name, rowInfo.changeType));
            }
            return(methInfo);
        }