diff options
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | 29 | ||||
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml | 18 |
2 files changed, 44 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 6f5eed749..d8dc4a7b8 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -74,11 +74,32 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException("The specified serial number could not be found."); } - if (machine.SetupActivation && machine.OsKey == null) + if (machine.SetupActivation && String.IsNullOrWhiteSpace(machine.OsKey)) { throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key."); } + if (String.IsNullOrWhiteSpace(request.DeviceID)) + { + throw new InvalidDataException("Device id not set."); + } + + if (String.IsNullOrWhiteSpace(request.DeviceName)) + { + throw new InvalidDataException("Device name not set."); + } + + if (machine.IsDeviceRegistered && machine.DeviceId != request.DeviceID) + { + throw new InvalidDataException("The specified machine is already registered and device id is invalid."); + } + + machine.DeviceName = request.DeviceName; + machine.DeviceId = request.DeviceID; + machine.IsDeviceRegistered = true; + + db.SaveChanges(); + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); @@ -122,7 +143,6 @@ namespace Tango.MachineService.Controllers response.SetupUWF = machine.SetupUwf; response.SetupFirmware = machine.SetupFirmware; response.IsDemo = machine.IsDemo; - } return response; @@ -216,6 +236,11 @@ namespace Tango.MachineService.Controllers } response.Version = latest_machine_version.Version; + + if (machine.ForceVersionUpdate) + { + response.IsUpdateAvailable = true; + } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml index 5fb79879e..60d445532 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml @@ -9,7 +9,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt <ResourceId>/subscriptions/10c8aa60-3b15-4e0d-b412-6aeef90e5e91/resourceGroups/Tango/providers/Microsoft.Web/sites/machineservice/slots/MachineService-DEV</ResourceId> <ResourceGroup>Tango</ResourceGroup> <PublishProvider>AzureWebSite</PublishProvider> - <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> + <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration> <LastUsedPlatform>Any CPU</LastUsedPlatform> <SiteUrlToLaunchAfterPublish>http://machineservice-machineservice-dev.azurewebsites.net</SiteUrlToLaunchAfterPublish> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> @@ -24,5 +24,21 @@ by editing this MSBuild file. In order to learn more about this please visit htt <UserName>$machineservice__MachineService-DEV</UserName> <_SavePWD>True</_SavePWD> <_DestinationType>AzureWebSite</_DestinationType> + <PublishDatabaseSettings> + <Objects xmlns=""> + <ObjectGroup Name="Tango.BL.ObservablesContext" Order="1" Enabled="False"> + <Destination Path="" /> + <Object Type="DbCodeFirst"> + <Source Path="DBContext" DbContext="Tango.BL.ObservablesContext, Tango.BL" Origin="Convention" /> + </Object> + </ObjectGroup> + </Objects> + </PublishDatabaseSettings> </PropertyGroup> + <ItemGroup> + <MSDeployParameterValue Include="$(DeployParameterPrefix)Tango.BL.ObservablesContext-Web.config Connection String" /> + </ItemGroup> + <ItemGroup> + <_ConnectionStringsToInsert Include="Tango.BL.ObservablesContext" /> + </ItemGroup> </Project>
\ No newline at end of file |
