Пример #1
0
        public IApplicationResponse Search(string application, string searchFields, string searchText, string schema = "list")
        {
            var user    = SecurityFacade.CurrentUser();
            var app     = MetadataProvider.Application(application);
            var schemas = app.Schemas();
            var key     = new ApplicationMetadataSchemaKey(schema, SchemaMode.input, ClientPlatform.Web);
            ApplicationSchemaDefinition appSchema;

            if (!schemas.TryGetValue(key, out appSchema))
            {
                throw new InvalidOperationException("schema not found");
            }

            var searchRequestDto = PaginatedSearchRequestDto.DefaultInstance(appSchema);

            searchRequestDto.SetFromSearchString(appSchema, searchFields.Split(','), searchText);

            var dataResponse = Get(application, new DataRequestAdapter()
            {
                Key = key, SearchDTO = searchRequestDto
            });

            //fixing the filter parameters used so that it is applied on next queries
            ((ApplicationListResult)dataResponse).PageResultDto.BuildFixedWhereClause(searchRequestDto, app.Entity);
            dataResponse.Title = appSchema.Title;
            dataResponse.Mode  = SchemaMode.input.ToString().ToLower();
            return(dataResponse);
            //            return View("Index", new ApplicationModel(application, "list", SchemaMode.input.ToString().ToLower(), appSchema.Title, dataResponse));
        }
Пример #2
0
        public ActionResult Index()
        {
            var user        = SecurityFacade.CurrentUser();
            var securedMenu = user.Menu(ClientPlatform.Web);
            var indexItemId = securedMenu.ItemindexId;
            var indexItem   = securedMenu.Leafs.FirstOrDefault(l => indexItemId.EqualsIc(l.Id));

            if (indexItem == null)
            {
                //first we´ll try to get the item declared, if it´s null (that item is role protected for that user, for instance, let´s pick the first leaf one as a fallback to avoid problems
                indexItem = securedMenu.Leafs.FirstOrDefault(a => a.Leaf);
            }

            HomeModel model = null;

            if (indexItem is ApplicationMenuItemDefinition)
            {
                var app     = (ApplicationMenuItemDefinition)indexItem;
                var key     = new ApplicationMetadataSchemaKey(app.Schema, app.Mode, ClientPlatform.Web);
                var adapter = new DataRequestAdapter(null, key);
                model = new HomeModel(GetUrlFromApplication(app.Application, adapter), app.Title, FetchConfigs(), user, HasPopupLogo(), _i18NResolver.FetchCatalogs(), ApplicationConfiguration.ClientName, indexItem.Module);
            }
            else if (indexItem is ActionMenuItemDefinition)
            {
                var actItem = (ActionMenuItemDefinition)indexItem;
                var action  = actItem.Action;
                model = new HomeModel(GetUrlFromAction(actItem), actItem.Title, FetchConfigs(), user, HasPopupLogo(), _i18NResolver.FetchCatalogs(), ApplicationConfiguration.ClientName, indexItem.Module);
            }
            return(View(model));
        }
Пример #3
0
        public void FillContext(ApplicationMetadataSchemaKey key)
        {
            var context = (ContextHolder)ReflectionUtil.Clone(new ContextHolder(), LookupContext());

            Log.DebugFormat("filling {0} into context {1}", key, context);
            if (context.ApplicationLookupContext == null)
            {
                Log.DebugFormat("no context found");
                context.ApplicationLookupContext = new ApplicationLookupContext();
            }
            var appContext = (ApplicationLookupContext)ReflectionUtil.Clone(new ApplicationLookupContext(), context.ApplicationLookupContext);

            appContext.Schema = key.SchemaId;
            appContext.Mode   = key.Mode.ToString();
            context.ApplicationLookupContext = appContext;

            var isHttp = System.Web.HttpContext.Current != null;

            if (isHttp)
            {
                System.Web.HttpContext.Current.Items["context"] = context;
            }
            else
            {
                LogicalThreadContext.SetData("context", context);
            }
        }
Пример #4
0
        private static GenericResponseResult <IList <DashboardDefinition> > DoGetFromList(List <DashboardDefinition> dashboardDefinitionList)
        {
            InMemoryUser user          = SecurityFacade.CurrentUser();
            var          dataObjectSet = new BaseApplicationDataSet();

            DashboardModuleHandler(dashboardDefinitionList);

            foreach (var definition in dashboardDefinitionList)
            {
                var key = new ApplicationMetadataSchemaKey(definition.SchemaId, definition.Mode, ClientPlatform.Web);
                var searchRequestDto = new SearchRequestDto {
                    SearchParams = definition.SearchParams,
                    SearchValues = definition.SearchValues,
                    Context      = new ApplicationLookupContext {
                        MetadataId = definition.Id
                    }
                };
                var applicationMetadata = MetadataProvider.Application(definition.ApplicationName)
                                          .ApplyPolicies(key, user, ClientPlatform.Web);

                definition.TotalCount = dataObjectSet.GetCount(applicationMetadata, searchRequestDto);
            }
            return(new GenericResponseResult <IList <DashboardDefinition> >(dashboardDefinitionList, null)
            {
                Title = new I18NResolver().I18NValue("_headermenu.serviceit", "ServiceIT")
            });
        }
Пример #5
0
        public SynchronizationResultDto SyncData(SynchronizationRequestDto synchronizationRequest)
        {
            //TODO> the method should return only the fields
            //specified in the metadata, and not all entities
            //attributes.

            var user = SecurityFacade.CurrentUser();

            if (null == user)
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }
            var syncResult = new SynchronizationResultDto();

            foreach (var application in synchronizationRequest.Applications)
            {
                var applicationMetadata = MetadataProvider
                                          .Application(application.appName)
                                          .ApplyPolicies(ApplicationMetadataSchemaKey.GetSyncInstance(), user, ClientPlatform.Mobile);
                var syncAppData = _dataSetProvider.LookupAsBaseDataSet(application.appName)
                                  .Sync(applicationMetadata, application);
                if (!application.FetchMetadata)
                {
                    //used to reduce the amount of data sent
                    syncAppData.Metadata = null;
                }
                syncResult.SynchronizationData.Add(syncAppData);
            }
            return(syncResult);
        }
Пример #6
0
 public DetailRequest(string id, string faqid, string lang, ApplicationMetadataSchemaKey key)
 {
     _id    = id;
     _lang  = lang;
     _faqid = faqid;
     Key    = key;
 }
Пример #7
0
        /// <summary>
        /// First tries to locate the next schema from the command. If its not specified, then fallbacks for locating it from a schema property.
        ///  if not specified, continues on the current schema
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="currentschemaKey"></param>
        /// <param name="platform"></param>
        /// <param name="applicationMetadata"></param>
        /// <returns></returns>
        public ApplicationMetadataSchemaKey ResolveNextSchemaKey(string operation,
                                                                 ApplicationMetadataSchemaKey currentschemaKey, ClientPlatform platform,
                                                                 ApplicationMetadata applicationMetadata)
        {
            string nextSchemaId;
            var    applicationCommand = ApplicationCommandUtils.GetApplicationCommand(applicationMetadata, operation);

            if (applicationCommand != null && !String.IsNullOrWhiteSpace(applicationCommand.NextSchemaId))
            {
                nextSchemaId = applicationCommand.NextSchemaId;
            }
            else
            {
                //TODO: adjust metadatas to allow the entire schema string representation as a property ==> "nextschema.schema"
                nextSchemaId = applicationMetadata.Schema.Properties["nextschema.schemaid"];
            }

            if (String.IsNullOrWhiteSpace(nextSchemaId))
            {
                //if none set, consider that the application should stay on the same schema
                return(currentschemaKey);
            }
            //TODO: what about the mode?suppose the scenario, where we have to schemas named detail, one for input other for output...
            return(GetSchemaKeyFromString(applicationMetadata.Name, nextSchemaId + ".." + platform, platform));
        }
Пример #8
0
        private static ApplicationSchemaDefinition GetListSchema(ApplicationCompositionSchema applicationCompositionSchema, CompleteApplicationMetadataDefinition compositionApplication)
        {
            var collectionSchema = (ApplicationCompositionCollectionSchema)applicationCompositionSchema;
            var listKey          = new ApplicationMetadataSchemaKey(collectionSchema.CollectionProperties.ListSchema,
                                                                    applicationCompositionSchema.RenderMode, ClientPlatform.Web);

            return(compositionApplication.Schemas()[listKey]);
        }
 public ApplicationSchemaDefinition Schema(ApplicationMetadataSchemaKey key, bool throwException = false)
 {
     if (Schemas().ContainsKey(key))
     {
         return(Schemas()[key]);
     }
     if (throwException)
     {
         throw key.NotFoundException();
     }
     return(null);
 }
Пример #10
0
        /// <summary>
        /// If there´s a schema named print, use it, otherwise fallback to detail
        /// </summary>
        /// <param name="compositionSchema"></param>
        /// <param name="compositionApplication"></param>
        /// <returns></returns>
        private static ApplicationSchemaDefinition GetPrintSchema(ApplicationCompositionSchema compositionSchema,
                                                                  CompleteApplicationMetadataDefinition compositionApplication, ApplicationSchemaDefinition detailSchema, ApplicationSchemaDefinition listSchema)
        {
            var applicationSchemaDefinitions = compositionApplication.Schemas();
            var printKey = new ApplicationMetadataSchemaKey(compositionSchema.PrintSchema, compositionSchema.RenderMode, ClientPlatform.Web);

            if (applicationSchemaDefinitions.ContainsKey(printKey))
            {
                return(applicationSchemaDefinitions[printKey]);
            }
            return(detailSchema ?? listSchema);
        }
Пример #11
0
        private IApplicationResponse DoExecute(string application, JObject json, string id, string operation,
                                               ApplicationMetadataSchemaKey currentschemaKey, bool mockMaximo, ApplicationMetadataSchemaKey nextSchemaKey, ClientPlatform platform)
        {
            MockingUtils.EvalMockingErrorModeActive(json, Request);
            var user = SecurityFacade.CurrentUser();

            if (null == user)
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            if (Log.IsDebugEnabled)
            {
                Log.Debug(json.ToString(Newtonsoft.Json.Formatting.Indented, new StringEnumConverter()));
            }
            var applicationMetadata = MetadataProvider
                                      .Application(application)
                                      .ApplyPolicies(currentschemaKey, user, platform);

            ContextLookuper.SetInternalQueryExecution();

            var maximoResult = new MaximoResult(id, null);

            if (!mockMaximo)
            {
                maximoResult = DataSetProvider.LookupAsBaseDataSet(application)
                               .Execute(applicationMetadata, json, id, operation);
            }
            if (currentschemaKey.Platform == ClientPlatform.Mobile)
            {
                //mobile requests doesn´t have to handle success messages or redirections
                return(null);
            }
            if (nextSchemaKey == null)
            {
                //keep on same schema unless explicetely told otherwise
                nextSchemaKey = currentschemaKey;
            }

            if (nextSchemaKey != null)
            {
                var response = _nextSchemaRouter.RedirectToNextSchema(applicationMetadata, operation,
                                                                      maximoResult.Id, platform, currentschemaKey, nextSchemaKey, mockMaximo);
                response.SuccessMessage = _successMessageHandler.FillSucessMessage(applicationMetadata, maximoResult.Id, operation);
                return(response);
            }
            return(new BlankApplicationResponse()
            {
                SuccessMessage = _successMessageHandler.FillSucessMessage(applicationMetadata, maximoResult.Id, operation)
            });
        }
        public static ApplicationMetadata ApplyPolicies([NotNull] this CompleteApplicationMetadataDefinition application,
                                                        ApplicationMetadataSchemaKey schemaKey, [NotNull] InMemoryUser user, ClientPlatform platform)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            return(new ApplicationMetadataPolicyApplier(application, schemaKey, user, platform).Apply());
        }
        public ApplicationMetadataPolicyApplier([NotNull] CompleteApplicationMetadataDefinition application, ApplicationMetadataSchemaKey schemaKey, [NotNull] InMemoryUser user, ClientPlatform platform)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            _application = application;
            _user        = user;
            _schemaKey   = schemaKey;
            _platform    = platform;
            _result      = new Lazy <ApplicationMetadata>(ApplyImpl);
        }
Пример #14
0
        private static ApplicationSchemaDefinition GetDetailSchema(CompleteApplicationMetadataDefinition compositionApplication,
                                                                   ApplicationCompositionSchema compositionSchema)
        {
            if (compositionSchema.DetailSchema == "")
            {
                //This means that the composition is only needed for list visualization
                return(null);
            }
            var detailKey = new ApplicationMetadataSchemaKey(compositionSchema.DetailSchema, compositionSchema.RenderMode, ClientPlatform.Web);
            var applicationSchemaDefinitions = compositionApplication.Schemas();

            if (!applicationSchemaDefinitions.ContainsKey(detailKey))
            {
                throw ExceptionUtil.MetadataException(
                          "detail composition schema {0} not found for application {1}. Use \"\" if you want to specify that this is used only for list", detailKey, compositionApplication.ApplicationName);
            }
            return(applicationSchemaDefinitions[detailKey]);
        }
Пример #15
0
        public IApplicationResponse RedirectToNextSchema(ApplicationMetadata applicationMetadata, string operation, string id, ClientPlatform platform,
                                                         ApplicationMetadataSchemaKey currentschemaKey, ApplicationMetadataSchemaKey nextSchemaKey, bool maximoMocked = false)
        {
            var applicationName = applicationMetadata.Name;

            if (nextSchemaKey == null)
            {
                if (HasActionRedirectionDefinedByProperties(applicationMetadata.Schema, operation))
                {
                    return(ActionRedirection(applicationMetadata.Schema, operation));
                }
                nextSchemaKey = ResolveNextSchemaKey(operation, currentschemaKey, platform, applicationMetadata);
            }
            //            var applicationName = currentMetadata.Name;
            var metadata     = MetadataProvider.Application(applicationName);
            var resultSchema = metadata.Schema(nextSchemaKey, true);
            var user         = SecurityFacade.CurrentUser();
            var nextMetadata = metadata.ApplyPolicies(nextSchemaKey, user, ClientPlatform.Web);
            var dataSet      = _dataSetProvider.LookupAsBaseDataSet(applicationName);

            if (resultSchema.Stereotype == SchemaStereotype.Detail)
            {
                if (maximoMocked && id == null)
                {
                    return(mockUtils.GetMockedDataMap(applicationName, resultSchema, nextMetadata));
                }
                var detailRequest = new DetailRequest(nextSchemaKey, null)
                {
                    Id = id
                };
                detailRequest.CompositionsToFetch = operation != OperationConstants.CRUD_CREATE ? "#all" : null;
                var response = dataSet.Get(nextMetadata, SecurityFacade.CurrentUser(), detailRequest);
                return(response);
            }
            if (resultSchema.Stereotype == SchemaStereotype.List)
            {
                var paginatedSearchRequestDto = PaginatedSearchRequestDto.DefaultInstance(resultSchema);
                return(dataSet.Get(nextMetadata, user, new DataRequestAdapter(paginatedSearchRequestDto)));
            }
            throw new NotImplementedException("missing implementation for this kind of schema redirection");
        }
Пример #16
0
 private static void BuildSlicedMetadataCache()
 {
     SlicedEntityMetadataCache.Clear();
     foreach (var app in _applicationMetadata)
     {
         var entityName     = app.Entity;
         var entityMetadata = Entity(entityName);
         if (app.IsMobileSupported())
         {
             app.Schemas().Add(ApplicationMetadataSchemaKey.GetSyncInstance(),
                               ApplicationSchemaFactory.GetSyncInstance(app.ApplicationName, app.IdFieldName));
         }
         foreach (var webSchema in app.Schemas())
         {
             var schema = webSchema.Value;
             schema.DepandantFields(DependencyBuilder.BuildDependantFields(schema.Fields, schema.DependableFields));
             schema._fieldWhichHaveDeps = schema.DependantFields.Keys;
             var instance = SlicedEntityMetadataBuilder.GetInstance(entityMetadata, schema, app.FetchLimit);
             SlicedEntityMetadataCache[new SlicedEntityMetadataKey(webSchema.Key, entityName)] = instance;
         }
     }
 }
Пример #17
0
        private static ApplicationSchemaDefinition BuildMobileSchema(IEnumerable <ApplicationSchemaDefinition> schemas, IDictionary <string, string> parameters)
        {
            ApplicationSchemaDefinitionExtensions.Preview previewTitle = null, previewSubtitle = null, previewExcerpt = null, previewFeatured = null;
            var detailKey = new ApplicationMetadataSchemaKey(ApplicationMetadataConstants.Detail, null, ClientPlatform.Mobile);
            //            ApplicationSchemaDefinition listSchema, detailSchema;
            var applicationSchemaDefinitions = schemas as ApplicationSchemaDefinition[] ?? schemas.ToArray();
            var detailSchema = applicationSchemaDefinitions.FirstOrDefault(f => Equals(f.GetSchemaKey(), detailKey));
            var listSchema = applicationSchemaDefinitions.FirstOrDefault(f => Equals(f.GetSchemaKey(), new ApplicationMetadataSchemaKey(ApplicationMetadataConstants.List, null, ClientPlatform.Mobile)));

            if (detailSchema == null)
            {
                //should never happen while this class exists... only list/detail schema allowed for now
                return(null);
            }
            if (listSchema != null)
            {
                detailSchema.PreviewTitle(BuildPreview(listSchema.Fields.FirstOrDefault(r => r.Qualifier == ApplicationMetadataConstants.PreviewTitle)));
                detailSchema.PreviewSubtitle(BuildPreview(listSchema.Fields.FirstOrDefault(r => r.Qualifier == ApplicationMetadataConstants.PreviewSubTitle)));
                detailSchema.PreviewFeatured(BuildPreview(listSchema.Fields.FirstOrDefault(r => r.Qualifier == ApplicationMetadataConstants.PreviewFeatured)));
                detailSchema.PreviewExcerpt(BuildPreview(listSchema.Fields.FirstOrDefault(r => r.Qualifier == ApplicationMetadataConstants.PreviewExcerpt)));
                var hiddenFields = listSchema.Fields.Where(f => f.IsHidden);
                foreach (var hiddenField in hiddenFields)
                {
                    if (!detailSchema.Displayables.Contains(hiddenField))
                    {
                        //All of the hidden fields could be useful for making the relationships on the single mobile schema
                        detailSchema.Displayables.Add(hiddenField);
                    }
                }
            }
//            ConvertAssociationsToLookups(detailSchema.ApplicationName, detailSchema.Displayables);

            string userInteractionEnabled;

            parameters.TryGetValue(ApplicationMetadataConstants.IsUserInteractionEnabledProperty, out userInteractionEnabled);
            //            detailSchema.IsUserInteractionEnabled(userInteractionEnabled != null && bool.Parse(userInteractionEnabled));
            return(detailSchema);
        }
Пример #18
0
        public FileContentResult Export(string application, [FromUri] ApplicationMetadataSchemaKey key,
                                        [FromUri] PaginatedSearchRequestDto searchDTO, string module)
        {
            searchDTO.PageSize = searchDTO.TotalCount + 1;
            if (module != null)
            {
                _contextLookuper.LookupContext().Module = module;
            }


            var before  = Stopwatch.StartNew();
            var before2 = Stopwatch.StartNew();

            var user = SecurityFacade.CurrentUser();
            var applicationMetadata = MetadataProvider
                                      .Application(application)
                                      .ApplyPolicies(key, user, ClientPlatform.Web);


            var dataResponse = _dataController.Get(application, new DataRequestAdapter {
                Key       = key,
                SearchDTO = searchDTO
            });

            Log.Debug(LoggingUtil.BaseDurationMessageFormat(before, "finished gathering export excel data"));
            var excelBytes = _excelUtil.ConvertGridToExcel(user, applicationMetadata.Schema, ((ApplicationListResult)dataResponse).ResultObject);

            Log.Info(LoggingUtil.BaseDurationMessageFormat(before2, "finished export excel data"));
            var fileName = GetFileName(application, key.SchemaId) + ".xls";
            var result   = new FileContentResult(excelBytes, System.Net.Mime.MediaTypeNames.Application.Octet)
            {
                FileDownloadName = (string)StringUtil.FirstLetterToUpper(fileName)
            };

            return(result);
        }
Пример #19
0
 public static SlicedEntityMetadata SlicedEntityMetadata(ApplicationMetadataSchemaKey key, string entityName)
 {
     return(SlicedEntityMetadataCache[new SlicedEntityMetadataKey(key, entityName)]);
 }
Пример #20
0
 public DataRequestAdapter(PaginatedSearchRequestDto searchDTO, ApplicationMetadataSchemaKey key)
 {
     SearchDTO = searchDTO;
     Key       = key;
 }
Пример #21
0
 public ReportRequest(PaginatedSearchRequestDto searchDTO, ApplicationMetadataSchemaKey key)
     : base(searchDTO, key)
 {
 }
 public static ApplicationMetadata ApplyPoliciesWeb([NotNull] this CompleteApplicationMetadataDefinition application,
                                                    ApplicationMetadataSchemaKey schemaKey)
 {
     return(new ApplicationMetadataPolicyApplier(application, schemaKey, SecurityFacade.CurrentUser(), ClientPlatform.Web).Apply());
 }
        public static ApplicationSchemaDefinition SchemaForPlatform([NotNull] this CompleteApplicationMetadataDefinition application, ApplicationMetadataSchemaKey metadataSchemaKey)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            ApplicationSchemaDefinition resultingSchema;

            if (!application.Schemas().TryGetValue(metadataSchemaKey, out resultingSchema))
            {
                throw new InvalidOperationException(String.Format(NoSchemaFound, metadataSchemaKey, application.ApplicationName));
            }
            return((ApplicationSchemaDefinition)resultingSchema);
        }
Пример #24
0
        private IEnumerable <AttributeHolder> HandleITCReport(IEnumerable <AttributeHolder> resultObject, ApplicationMetadata application, PaginatedSearchRequestDto searchDto)
        {
            var user = SecurityFacade.CurrentUser();
            var applicationSchemaKey          = new ApplicationMetadataSchemaKey("itcreportregionandarea");
            var complementApplicationMetadata = MetadataProvider.Application(application.Name).ApplyPolicies(applicationSchemaKey, user, ClientPlatform.Web);
            var complementSearchDTO           = new PaginatedSearchRequestDto();

            complementSearchDTO.SearchParams   = searchDto.SearchParams.Replace("persongroup_.", "locationpersongroup_.");
            complementSearchDTO.SearchValues   = searchDto.SearchValues;
            complementSearchDTO.SearchSort     = searchDto.SearchSort;
            complementSearchDTO.ShouldPaginate = false;

            ContextLookuper.FillContext(applicationSchemaKey);
            var complementaryList = base.GetList(complementApplicationMetadata, complementSearchDTO);

            resultObject = resultObject.Union(complementaryList.ResultObject);

            foreach (var attributeHolder in resultObject)
            {
                try {
                    var persongroup = attributeHolder.Attributes["persongroup"];
                    if (persongroup != null)
                    {
                        var groupDefault = attributeHolder.Attributes["groupdefault"];

                        if (persongroup.ToString().StartsWith(HapagPersonGroupConstants.BaseHapagLocationPrefix))
                        {
                            attributeHolder.Attributes["itcrole"]  = groupDefault.Equals(1) ? "Location ITC" : "Location ITC Delegate";
                            attributeHolder.Attributes["hlagsite"] = persongroup.ToString().Substring(HapagPersonGroupConstants.BaseHapagLocationPrefix.Length, 3);

                            var persongroupdescription = attributeHolder.Attributes["persongroup_.description"];
                            if (persongroupdescription != null)
                            {
                                attributeHolder.Attributes["hlagcostcenter"] = persongroupdescription.ToString().Substring(persongroupdescription.ToString().LastIndexOf("-") + 1);

                                var costcenterDescription = attributeHolder.Attributes["costcenterdescription"];
                                if (costcenterDescription != null)
                                {
                                    attributeHolder.Attributes["hlagcostcenter"] += " // " + costcenterDescription;
                                }
                            }

                            // Add blank fields just to match the second union iterator (Region and Area)
                            attributeHolder.Attributes["locationcostcenterdescription"]    = String.Empty;
                            attributeHolder.Attributes["locationpersongroup_.persongroup"] = String.Empty;
                            attributeHolder.Attributes["locationpersongroup_.description"] = String.Empty;
                        }
                        else if (persongroup.ToString().StartsWith(HapagPersonGroupConstants.BaseHapagAreaPrefix) ||
                                 persongroup.ToString().StartsWith(HapagPersonGroupConstants.BaseHapagRegionPrefix))
                        {
                            var locationpersongroup = attributeHolder.Attributes["locationpersongroup_.persongroup"];
                            attributeHolder.Attributes["hlagsite"] = locationpersongroup.ToString().Substring(HapagPersonGroupConstants.BaseHapagLocationPrefix.Length, 3);

                            var locationpersongroupdescription = attributeHolder.Attributes["locationpersongroup_.description"];
                            if (locationpersongroupdescription != null)
                            {
                                attributeHolder.Attributes["hlagcostcenter"] = locationpersongroupdescription.ToString().Substring(locationpersongroupdescription.ToString().LastIndexOf("-") + 1);

                                var locationcostcenterdescription = attributeHolder.Attributes["locationcostcenterdescription"];
                                if (locationcostcenterdescription != null)
                                {
                                    attributeHolder.Attributes["hlagcostcenter"] += " // " + locationcostcenterdescription;
                                }
                            }

                            if (persongroup.ToString().StartsWith(HapagPersonGroupConstants.BaseHapagAreaPrefix))
                            {
                                attributeHolder.Attributes["itcrole"] = groupDefault.Equals(1) ? "Area ITC" : "Area ITC Delegate";
                            }
                            else if (persongroup.ToString().StartsWith(HapagPersonGroupConstants.BaseHapagRegionPrefix))
                            {
                                attributeHolder.Attributes["itcrole"] = groupDefault.Equals(1) ? "Region ITC" : "Region ITC Delegate";
                            }

                            // Add blank fields just to match the first union iterator (Location)
                            attributeHolder.Attributes["costcenterdescription"] = String.Empty;
                        }
                    }
                }
                catch (ArgumentOutOfRangeException ae) {
                }
            }

            return(resultObject.ToList());
        }
Пример #25
0
 public DetailRequest(string id, ApplicationMetadataSchemaKey key)
 {
     _id = id;
     Key = key;
 }
Пример #26
0
 public DetailRequest(ApplicationMetadataSchemaKey key, IDictionary <string, string> customParameters)
 {
     Key = key;
     CustomParameters = customParameters;
 }
Пример #27
0
 public SlicedEntityMetadataKey(ApplicationMetadataSchemaKey schema, string entityName)
 {
     _schema          = schema;
     this._entityName = entityName;
 }