Esempio n. 1
0
        private void LoadRoomUsages()
        {
            RoomUsages = new DataServiceCollection <RoomUsage>(m_Context);
            var query = m_Context.RoomUsages;

            RoomUsages.Load(query);
        }
Esempio n. 2
0
        public void SetUp()
        {
            m_DialogManagerMock          = new Mock <IDialogManager>();
            m_EnergyViewModelFactoryMock = new Mock <IEnergyViewModelFactory>();
            m_Repository = new Mock <IEnergyRepository>();


            var items = new Consumer[]
            {
                new Consumer(), new Consumer(),
            }.AsQueryable();

            var sdf = new DataServiceCollection <Consumer>();

            sdf.Load(items);

            m_Repository.SetupGet(r => r.Consumers)
            .Returns(sdf);

            m_EnergyManagementViewModel = new EnergyManagementViewModel(m_Repository.Object, m_EnergyViewModelFactoryMock.Object, m_DialogManagerMock.Object);

            m_EnergyManagementViewModel.SelectedConsumerGroup = new ConsumerGroupViewModel(new ConsumerGroup()
            {
                GroupName = "Consumer"
            }, m_Repository.Object);
            m_EnergyManagementViewModel.SelectedDistributor = new DistributorViewModel(new Distributor()
            {
                Name = "Verteiler"
            }, m_Repository.Object);
            m_EnergyManagementViewModel.NewConsumerName = "NeuerVerbraucher";

            m_EnergyManagementViewModel.AddNewConsumer();
        }
Esempio n. 3
0
        private void LoadRooms()
        {
            Rooms = new DataServiceCollection <Room>(m_Context);
            var query = m_Context.Rooms.Expand("RoomInformation");

            Rooms.Load(query);
        }
        private void LoadMeasures()
        {
            Measures = new DataServiceCollection <Approval_Measure>(m_Context);
            var query = m_Context.Measures.Expand("AttachedDocuments").Expand("ResponsibleSubject").Expand("DueDate").Expand("EntryDate").OfType <Approval_Measure>();;

            Measures.Load(query);
        }
Esempio n. 5
0
        private void LoadInspectionAttributes()
        {
            InspectionAttributes = new DataServiceCollection <InspectionAttribute>(m_Context);
            var query = m_Context.InspectionAttributes;

            InspectionAttributes.Load(query);
        }
        private void LoadAuxillaryConditions()
        {
            AuxillaryConditions = new DataServiceCollection <AuxillaryCondition>(m_Context);
            var query = Context.AuxillaryConditions.Expand("ConditionInspections");

            AuxillaryConditions.Load(query);
        }
        private void LoadConditionInspections()
        {
            ConditionInspections = new DataServiceCollection <ConditionInspection>(m_Context);
            var query = m_Context.ConditionInspections.Expand("Measures").Expand("EntryDate");

            ConditionInspections.Load(query);
        }
        private void LoadPermissions()
        {
            Permissions = new DataServiceCollection <Permission>(m_Context);
            var query = Context.Permissions.Expand("AuxillaryConditions").Expand("Plants").Expand("AttachedDocuments").Expand("AuxillaryConditions/ConditionInspections");

            Permissions.Load(query);
        }
        private void LoadPlants()
        {
            Plants = new DataServiceCollection <Plant>(m_Context);
            var query = Context.Plants.Expand("Permissions").Expand("PlantImageSource").Expand("AttachedDocuments/DocumentSource");

            Plants.Load(query);
        }
        public void ClientShouldRequestAllMetadataWithProjectionIntoDataServiceCollection()
        {
            RunClientIntegrationTestWithPagingAndTrackingOnly(ctx =>
            {
                var clientType = typeof(OrderWithBinding);
                var serverType = typeof(Order);

                ctx.ResolveType = name =>
                {
                    Assert.AreEqual(serverType.FullName, name);
                    return(clientType);
                };
                ctx.ResolveName = type =>
                {
                    Assert.AreEqual(clientType, type);
                    return(serverType.FullName);
                };

                var dsc = new DataServiceCollection <OrderWithBinding>(ctx.CreateQuery <OrderWithBinding>("Orders"));
                Assert.IsNotNull(dsc.Continuation, "Expected first continuation to be non-null since server paging is enabled.");
                while (dsc.Continuation != null)
                {
                    dsc.Load(ctx.Execute <OrderWithBinding>(dsc.Continuation.NextLinkUri));
                }
            });
        }
Esempio n. 11
0
        private void LoadResponsibleSubjects()
        {
            ResponsibleSubjects = new DataServiceCollection <ResponsibleSubject>(Context);
            var query = Context.ResponsibleSubjects.Expand("OpenResKit.DomainModel.Employee/Groups");

            ResponsibleSubjects.Load(query);
        }
Esempio n. 12
0
        private void LoadBuildings()
        {
            Buildings = new DataServiceCollection <DomainModelService.Building>(m_Context);
            var query = m_Context.Buildings.Expand("Rooms, Address");

            Buildings.Load(query);
        }
Esempio n. 13
0
        private void LoadCustomers()
        {
            Customers = new DataServiceCollection <Customer>(m_Context);
            var query = m_Context.Customers;

            Customers.Load(query);
        }
Esempio n. 14
0
        private static void DataServiceCollectionTrackingItems(
            DataServiceContextWrapper <DefaultContainer> contextWrapper)
        {
            var query = from p in contextWrapper.Context.Customer
                        where p.CustomerId > -100000
                        // try to get many for paging
                        select new Customer()
            {
                CustomerId = p.CustomerId,
                Name       = p.Name
            };
            DataServiceCollection <Customer> collection = new DataServiceCollection <Customer>(query);

            // the collection to track items
            int tmpCount = collection.Count;

            collection.Load(contextWrapper.Context.Execute(collection.Continuation));

            // for testing newly loaded item's tracking
            Assert.IsTrue(collection.Count > tmpCount, "Should have loaded another page.");
            bool someItemNotTracked = false;

            collection.ToList().ForEach(s =>
            {
                s.Name             = "value to test tracking";
                EntityStates state = contextWrapper.Context.GetEntityDescriptor(s).State;
                someItemNotTracked = (state == EntityStates.Unchanged) || someItemNotTracked;
            });
            Assert.IsFalse(someItemNotTracked, "All items should have been tracked.");
        }
Esempio n. 15
0
        private void LoadPersons()
        {
            Persons = new DataServiceCollection <Person>(m_Context);
            var query = m_Context.People;

            Persons.Load(query);
        }
Esempio n. 16
0
        private static void DataServiceCollectionSubQueryTrackingItems(
            DataServiceContextWrapper <DefaultContainer> contextWrapper)
        {
            var query = from p in contextWrapper.Context.Customer
                        where p.Name != null
                        select new Customer()
            {
                Name   = p.Name,
                Orders = new DataServiceCollection <Order>(
                    from r in p.Orders
                    select new Order()
                {
                    OrderId    = r.OrderId,
                    CustomerId = r.CustomerId
                })
            };
            var tmpResult0 = query.ToList()[0];
            DataServiceCollection <Order> collection = tmpResult0.Orders; // the collection tracking items
            int tmpCount = collection.Count;

            collection.Load(contextWrapper.Context.Execute(collection.Continuation));

            // for testing newly loaded item's tracking
            Assert.IsTrue(collection.Count > tmpCount, "Should have loaded another page.");
            bool someItemNotTracked = false;

            tmpResult0.Orders.ToList().ForEach(s =>
            {
                EntityStates state = contextWrapper.Context.GetEntityDescriptor(s).State;
                s.CustomerId       = s.CustomerId + 1;
                state = contextWrapper.Context.GetEntityDescriptor(s).State;
                someItemNotTracked = (state == EntityStates.Unchanged) || someItemNotTracked;
            });
            Assert.IsFalse(someItemNotTracked, "All items should have been tracked.");
        }
Esempio n. 17
0
        private void LoadQuestions()
        {
            Questions = new DataServiceCollection <Question>(m_Context);
            var query = m_Context.Questions;

            Questions.Load(query);
        }
Esempio n. 18
0
        private void LoadActivities()
        {
            Activities = new DataServiceCollection <Activity>(m_Context);
            var query = m_Context.Activities;

            Activities.Load(query);
        }
        private void LoadInventoryTypes()
        {
            InventoryTypes = new DataServiceCollection <InventoryType>(m_Context);
            var query = m_Context.InventoryTypes.Expand("Inventories");

            InventoryTypes.Load(query);
        }
        private void LoadInventories()
        {
            Inventories = new DataServiceCollection <DomainModelService.Inventory>(m_Context);
            var query = m_Context.Inventories.Expand("Room/Building, InventoryType");

            Inventories.Load(query);
        }
Esempio n. 21
0
        private void LoadRooms()
        {
            Rooms = new DataServiceCollection <BuildingRoom>(m_Context);
            var query = m_Context.BuildingRooms.Expand("Building");

            Rooms.Load(query);
        }
Esempio n. 22
0
        private void LoadAddresses()
        {
            Addresses = new DataServiceCollection <Address>(m_Context);
            var query = m_Context.Addresses.Expand(i => i.Buildings);

            Addresses.Load(query);
        }
Esempio n. 23
0
        private void LoadMeters()
        {
            Meter = new DataServiceCollection <DomainModelService.Meter>(m_Context);

            var query = m_Context.Meters.Expand("MapPosition/Map");

            Meter.Load(query);
        }
Esempio n. 24
0
        private void LoadWorkplaceCategories()
        {
            WorkplaceCategories = new DataServiceCollection <WorkplaceCategory>(m_Context);
            var query = m_Context.WorkplaceCategories.Expand("Workplace")
                        .Expand("Category");

            WorkplaceCategories.Load(query);
        }
Esempio n. 25
0
        private void LoadGFactors()
        {
            GFactors = new DataServiceCollection <GFactor>(m_Context);
            var query = m_Context.GFactors.Expand("Questions")
                        .Expand("Dangerpoints");

            GFactors.Load(query);
        }
Esempio n. 26
0
        private void LoadMeter()
        {
            Meters = new DataServiceCollection <Meter>(m_Context);

            var query = m_Context.Meters;

            Meters.Load(query);
        }
Esempio n. 27
0
        private void LoadMaps()
        {
            Maps = new DataServiceCollection <DomainModelService.Map>(m_Context);

            var query = m_Context.Maps.Expand("MapSource");

            Maps.Load(query);
        }
        private void LoadData()
        {
            Comparisons = new DataServiceCollection <Comparison>(m_Context);

            var query = m_Context.Calculations.OfType <Comparison>();

            Comparisons.Load(query);
        }
Esempio n. 29
0
        private void LoadSeries()
        {
            Series = new DataServiceCollection <Series>(m_Context);

            var query = m_Context.Series;

            Series.Load(query);
        }
Esempio n. 30
0
        private void LoadWasteContainers()
        {
            WasteContainers = new DataServiceCollection <WasteContainer>(m_Context);

            var query = m_Context.WasteContainers;

            WasteContainers.Load(query);
        }
        private void LinkExistingRuleGroups(ManagementService client, Action<LogInfo> logAction)
        {
            foreach (var linkedRuleGroup in this.relyingPartySpec.LinkedRuleGroups())
            {
                var @group = linkedRuleGroup;
                DataServiceCollection<RuleGroup> ruleGroups = new DataServiceCollection<RuleGroup>(client.RuleGroups);

                while (ruleGroups.Continuation != null)
                {
                    ruleGroups.Load(client.Execute<RuleGroup>(ruleGroups.Continuation));
                }

                foreach (var ruleGroup in ruleGroups.Where(rg => System.Text.RegularExpressions.Regex.IsMatch(rg.Name, group)))
                {
                    var relyingParty = client.RelyingParties.Where(rp => rp.Name.Equals(this.relyingPartySpec.Name())).Single();

                    var relyingPartyRuleGroup = new RelyingPartyRuleGroup
                    {
                        RuleGroupId = ruleGroup.Id,
                        RelyingParty = relyingParty
                    };

                    this.LogMessage(logAction, string.Format("Linking Relying Party '{0}' to Rule Group '{1}'", this.relyingPartySpec.Name(), ruleGroup.Name));
                    client.AddRelatedObject(relyingParty, "RelyingPartyRuleGroups", relyingPartyRuleGroup);
                }
            }

            if (this.relyingPartySpec.LinkedRuleGroups().Any())
            {
                client.SaveChanges(SaveChangesOptions.Batch);
                this.LogSavingChangesMessage(logAction);
            }
        }
            public void Collection_ServerDrivenPaging_DataServiceCollection()
            {
                Action<DataServiceContext, DSPContext, int?, bool> test = (ctx, data, pageSize, customPaging) =>
                {
                    DataServiceCollection<XFeatureTestsEntity> dsc = 
                        new DataServiceCollection<XFeatureTestsEntity>(ctx.CreateQuery<XFeatureTestsEntity>("Entities").Execute(), TrackingMode.None);

                    int serverEntitiesCount = data.GetResourceSetEntities("Entities").Count();
                        
                    int pagesCount = 1;

                    while(dsc.Continuation != null)
                    {
                        pagesCount++;
                        dsc.Load(ctx.Execute<XFeatureTestsEntity>(dsc.Continuation));
                    }

                    Assert.AreEqual(serverEntitiesCount, dsc.Count, "the number of materialized entities is different than number of entities on the server.");
                    Assert.AreEqual(pagesCount, GetExpectedPageCount(pageSize, serverEntitiesCount, customPaging), "Unexpected number of pages");
                    VerifyEntitySetsMatch(new List<object>(dsc), (IList<object>)data.GetResourceSetEntities("Entities").Cast<object>());
                };

                CollectionAndServerDrivenPagingTestRunner(test);
            }
        private static void DataServiceCollectionTrackingItems(
            DataServiceContextWrapper<DefaultContainer> contextWrapper)
        {
            var query = from p in contextWrapper.Context.Customer
                where p.CustomerId > -100000
                // try to get many for paging
                select new Customer()
                {
                    CustomerId = p.CustomerId,
                    Name = p.Name
                };
            DataServiceCollection<Customer> collection = new DataServiceCollection<Customer>(query);

            // the collection to track items
            int tmpCount = collection.Count;
            collection.Load(contextWrapper.Context.Execute(collection.Continuation));

            // for testing newly loaded item's tracking
            Assert.IsTrue(collection.Count > tmpCount, "Should have loaded another page.");
            bool someItemNotTracked = false;
            collection.ToList().ForEach(s =>
            {
                s.Name = "value to test tracking";
                EntityStates state = contextWrapper.Context.GetEntityDescriptor(s).State;
                someItemNotTracked = (state == EntityStates.Unchanged) || someItemNotTracked;
            });
            Assert.IsFalse(someItemNotTracked, "All items should have been tracked.");
        }