public UpdateEnterprisesSync(IEnterprisesManagementService entMgr,
                                     IApplicationsIoTService appIoTArch, IIdentityAccessService idMgr, ILogger <UpdateEnterprisesSync> log)
        {
            this.appIoTArch = appIoTArch;

            this.entMgr = entMgr;

            this.idMgr = idMgr;

            this.log = log;
        }
예제 #2
0
        public virtual async Task SetActiveEnterprise(IApplicationsIoTService appIoTArch, string entLookup)
        {
            State.ActiveEnterpriseConfig.ActiveEnterprise = State.EnterpriseConfig.ChildEnterprises.FirstOrDefault(ent =>
                                                                                                                   ent.Lookup == entLookup
                                                                                                                   );

            State.ActiveEnterpriseConfig.Page = 1;


            await LoadActiveEnterpriseDetails(appIoTArch, State.ActiveEnterpriseConfig.Page, State.ActiveEnterpriseConfig.PageSize);
        }
예제 #3
0
        public RemoveChildEnterprise(IApplicationsIoTService appIoTArch,
                                     IEnterprisesManagementService entMgr, IIdentityAccessService idMgr, ILogger <RemoveChildEnterprise> log)
        {
            this.appIoTArch = appIoTArch;

            this.entMgr = entMgr;

            this.idMgr = idMgr;

            this.log = log;
        }
예제 #4
0
        public virtual async Task LoadChildEnterprises(IEnterprisesManagementService entMgr, string parentEntLookup,
                                                       IApplicationsIoTService appIoTArch, IIdentityAccessService idMgr)
        {
            var childEntsResp = await entMgr.ListChildEnterprises(parentEntLookup);

            State.EnterpriseConfig.TotalChildEnterprisesCount = childEntsResp.Model?.Count;

            var pagedChildEnts = childEntsResp.Model?.Page(State.EnterpriseConfig.Page, State.EnterpriseConfig.PageSize);

            var iotChildEnts = new List <IoTEnsembleChildEnterprise>();

            await pagedChildEnts.Items.Each(async childEnt =>
            {
                var devicesResp = await appIoTArch.ListEnrolledDevices(childEnt.Lookup);

                var licenses = await idMgr.ListLicensesByUsername(parentEntLookup, childEnt.Name, new List <string>()
                {
                    "iot"
                });

                DateTime?StartDate = null;

                foreach (License token in licenses.Model)
                {
                    if (token.AccessStartDate != null)
                    {
                        StartDate = token.AccessStartDate.UtcDateTime;
                    }
                }

                var iotChildEnt = new IoTEnsembleChildEnterprise()
                {
                    Name        = childEnt.Name,
                    Lookup      = childEnt.Lookup,
                    DeviceCount = devicesResp.Model?.TotalRecords ?? 0,
                    SignUpDate  = StartDate
                };

                iotChildEnt.Devices = devicesResp.Model?.Items?.Select(device =>
                {
                    var devInfo = device.JSONConvert <IoTEnsembleDeviceInfo>();

                    devInfo.DeviceName = devInfo.DeviceID.Replace($"{childEnt.Lookup}-", String.Empty);

                    return(devInfo);
                }).ToList();

                iotChildEnts.Add(iotChildEnt);
            });

            State.EnterpriseConfig.ChildEnterprises = iotChildEnts;
        }
예제 #5
0
        public virtual async Task UpdateActiveEnterpriseSync(IApplicationsIoTService appIoTArch, IIdentityAccessService idMgr, string parentEntLookup,
                                                             int page, int pageSize)
        {
            if (State.ActiveEnterpriseConfig != null)
            {
                State.ActiveEnterpriseConfig.Page = page;

                State.ActiveEnterpriseConfig.PageSize = pageSize;

                await LoadActiveEnterpriseDetails(appIoTArch, State.ActiveEnterpriseConfig.Page, State.ActiveEnterpriseConfig.PageSize);
            }

            else
            {
                throw new Exception("Unable to load the enterprise config, please try again or contact support.");
            }
        }
예제 #6
0
        public Refresh(IApplicationsIoTService appIoTArch, IEnterprisesAPIManagementService entApiArch, IEnterprisesAsCodeService eacSvc, IEnterprisesManagementService entMgr, IEnterprisesHostingManagerService entHostMgr,
                       IIdentityAccessService idMgr, ILogger <Refresh> log, ISecurityDataTokenService secMgr)
        {
            this.appIoTArch = appIoTArch;

            this.entApiArch = entApiArch;

            this.eacSvc = eacSvc;

            this.entMgr = entMgr;

            this.entHostMgr = entHostMgr;

            this.idMgr = idMgr;

            this.log = log;

            this.secMgr = secMgr;
        }
예제 #7
0
        public SendCloudMessage(IApplicationsIoTService appIoTArch, ILogger <SendCloudMessage> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }
        public EnrollDevice(IApplicationsIoTService appIoTArch, ILogger <EnrollDevice> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }
        public UpdateConnectedDevicesSync(IApplicationsIoTService appIoTArch, ILogger <UpdateConnectedDevicesSync> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }
예제 #10
0
        public SetActiveEnterprise(IApplicationsIoTService appIoTArch, ILogger <SetActiveEnterprise> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }
예제 #11
0
        public IssueDeviceSASToken(IApplicationsIoTService appIoTArch, ILogger <IssueDeviceSASToken> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }
        public ListAllDeviceNames(IApplicationsIoTService appIoTArch, ILogger <ListAllDeviceNames> log)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;
        }