Exemple #1
0
        public async Task <Solution> CreateSolutionAsync(string name, string key, EntityHeader org, EntityHeader user, DateTime createTimestamp,
                                                         PlannerConfiguration planner, DeviceConfiguration deviceConfig, ListenerConfiguration listener)
        {
            await _storageUtils.DeleteIfExistsAsync <Solution>(key, org);

            var solution = new Solution()
            {
                Name = name,
                Key  = key
            };

            AddId(solution);
            AddOwnedProperties(solution, org);
            AddAuditProperties(solution, createTimestamp, org, user);

            solution.Planner = new EntityHeader <PlannerConfiguration>()
            {
                Id = planner.Id, Text = planner.Name
            };
            solution.DeviceConfigurations.Add(new EntityHeader <DeviceConfiguration>()
            {
                Id = deviceConfig.Id, Text = deviceConfig.Name
            });
            solution.Listeners.Add(new EntityHeader <ListenerConfiguration>()
            {
                Id = listener.Id, Text = listener.Name
            });


            var setting = new CustomField
            {
                DefaultValue = "32",
                FieldType    = EntityHeader <ParameterTypes> .Create(ParameterTypes.Integer),
                Label        = "Example Settung 1",
                Key          = "example1",
                Name         = "Example Setting 1",
                HelpText     = "You can create custom settings for your solution you can access from our API or from the scripting environment."
            };

            solution.Settings.Add(setting);

            var setting2 = new CustomField
            {
                DefaultValue = "32",
                FieldType    = EntityHeader <ParameterTypes> .Create(ParameterTypes.Integer),
                Label        = "Example Setting 2",
                Key          = "example2",
                Name         = "Example Setting 2",
                HelpText     = "A second optional setting for your solution."
            };

            solution.Settings.Add(setting2);

            await _solutionMgr.AddSolutionsAsync(solution, org, user);

            return(solution);
        }
Exemple #2
0
        public async Task <InvokeResult> CreateDeployableApp(EntityHeader org, EntityHeader user)
        {
            var creationDate = DateTime.UtcNow;

            var subscription         = CreateFreeSubscription(org, user, creationDate);
            var createSolutionResult = await CreateSimpleSolutionAsync(org, user, creationDate);

            var deviceRepo = CreateDevice(subscription, org, user, creationDate);

            await _solutionMgr.AddSolutionsAsync(createSolutionResult.Result, org, user);


            return(InvokeResult.Success);
        }
Exemple #3
0
 public Task <InvokeResult> AddSolutionAsync([FromBody] Solution deploymentConfiguration)
 {
     return(_solutionManager.AddSolutionsAsync(deploymentConfiguration, OrgEntityHeader, UserEntityHeader));
 }