private void SearchRequest(SearchRequestEvent searchRequestEvent)
        {
            searchRequestEvent.Search.SearchOptions.OrderBy = "ReferenceKey";

            this.entityService.ExecuteAsyncSearchRD(
                this.search = searchRequestEvent.Search,
                response =>
            {
                ReferenceDataList searchResults             = response;
                Dictionary <string, string> combinedResults = new Dictionary <string, string>();
                foreach (var rd in searchResults)
                {
                    if (combinedResults.ContainsKey(rd.ReferenceKey))
                    {
                        combinedResults[rd.ReferenceKey] = combinedResults[rd.ReferenceKey] + "|" + rd.Value;
                    }
                    else
                    {
                        combinedResults.Add(rd.ReferenceKey, rd.Value);
                    }
                }

                this.ReferenceDatas =
                    new ObservableCollection <ReferenceDataViewModel>(
                        combinedResults.Select(
                            x => new ReferenceDataViewModel(x.Key, x.Value, this.eventAggregator))
                        .OrderBy(y => y.ReferenceKey));
            },
                this.eventAggregator);
        }
        public ReferenceDataList List(string key)
        {
            if (key == "{}")
            {
                return(this.GetHandler(
                           key,
                           () =>
                {
                    var entries = this.repository.Queryable <MDM.ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new ReferenceData {
                        ReferenceKey = entry.Key, Value = entry.Value
                    }));

                    return list;
                }));
            }
            else
            {
                return(this.GetHandler(
                           key,
                           () =>
                {
                    var entries = this.repository.Queryable <MDM.ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new ReferenceData {
                        ReferenceKey = entry.Key, Value = entry.Value
                    }));

                    return list;
                }));
            }
        }
Пример #3
0
        private void PopulateReferenceData()
        {
            ReferenceDataList message = null;

            message = this.container.Resolve <IMessageRequester>().Request <ReferenceDataList>(
                Server.Name + "ReferenceData/list/PartyAccountabilityType").Message;
            IList <string> partyaccountabilitytype = message != null?
                                                     message.Select(data => data.Value).OrderBy(s => s).ToList() : new List <string>();

            this.container.RegisterInstance("partyaccountabilitytypes", partyaccountabilitytype, new ContainerControlledLifetimeManager());
        }
        private IHttpActionResult ListAll()
        {
            return(GetHandler(
                       "{}",
                       () =>
            {
                var entries = repository.Queryable <ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                var list = new ReferenceDataList();
                list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData {
                    ReferenceKey = entry.Key, Value = entry.Value
                }));
                Logger.DebugFormat("ReferenceData list created. Key: {0}", "{}");
                return Ok(list);
            }));
        }
        public IHttpActionResult List(string key = null)
        {
            if (string.IsNullOrEmpty(key) || key == "{}")
            {
                return(ListAll());
            }

            return(GetHandler(
                       key,
                       () =>
            {
                var entries = repository.Queryable <ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                var list = new ReferenceDataList();
                list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData {
                    ReferenceKey = entry.Key, Value = entry.Value
                }));
                Logger.DebugFormat("ReferenceData list created. Key: {0}", key);
                return Ok(list);
            }));
        }
        public ReferenceDataList List(string key)
        {
            if (key == "{}")
            {
                return this.GetHandler(
                    key,
                    () =>
                    {
                        var entries = this.repository.Queryable<MDM.ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                        var list = new ReferenceDataList();
                        list.AddRange(entries.Select(entry => new ReferenceData {ReferenceKey = entry.Key, Value = entry.Value }));

                        return list;
                    });
            }
            else
            {
                return this.GetHandler(
                    key,
                    () =>
                    {
                        var entries = this.repository.Queryable<MDM.ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                        var list = new ReferenceDataList();
                        list.AddRange(entries.Select(entry => new ReferenceData {ReferenceKey = entry.Key,  Value = entry.Value }));

                        return list;
                    });
            }
        }
Пример #7
0
        protected static void Because_of()
        {
            var getResponse = client.Get(ServiceUrl["ReferenceData"] + string.Format("/list/{0}", refData.Key));

            response = getResponse.Content.ReadAsDataContract <Contracts.ReferenceDataList>();
        }
 protected static void Because_of()
 {
     var getResponse = client.Get(ServiceUrl["ReferenceData"] + string.Format("/list/{0}", refData.Key));
     response = getResponse.Content.ReadAsDataContract<Contracts.ReferenceDataList>();
 }
        private IHttpActionResult ListAll()
        {
            return GetHandler(
                "{}",
                () =>
                {
                    var entries = repository.Queryable<ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData { ReferenceKey = entry.Key, Value = entry.Value }));
                    Logger.DebugFormat("ReferenceData list created. Key: {0}", "{}");
                    return Ok(list);
                });
        }
        public IHttpActionResult List(string key = null)
        {
            if (string.IsNullOrEmpty(key) || key == "{}")
            {
                return ListAll();
            }

            return GetHandler(
                key,
                () =>
                {
                    var entries = repository.Queryable<ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData { ReferenceKey = entry.Key, Value = entry.Value }));
                    Logger.DebugFormat("ReferenceData list created. Key: {0}", key);
                    return Ok(list);
                });
        }