diff options
Diffstat (limited to 'Software/Visual_Studio/Web')
6 files changed, 45 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 06b2fd232..d8f514c42 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -25,6 +25,9 @@ using Tango.Core.Cryptography; using Tango.MachineService.Filters; using Tango.BL.DTO; using Z.EntityFramework.Plus; +using Twilio; +using Twilio.Rest.Api.V2010.Account; +using Twilio.Types; namespace Tango.MachineService.Controllers { @@ -48,6 +51,7 @@ namespace Tango.MachineService.Controllers { _pendingUploads = new List<PPCPendingUpload>(); _pendingUpdates = new List<PPCPendingUpdate>(); + TwilioClient.Init(MachineServiceConfig.TWILIO_ACCOUNT_SID, MachineServiceConfig.TWILIO_AUTH_TOKEN); } public PPCController() @@ -830,6 +834,27 @@ namespace Tango.MachineService.Controllers #endregion + #region SMS + + [HttpPost] + [JwtTokenFilter] + public SendSMSResponse SendSMS(SendSMSRequest request) + { + var response = new SendSMSResponse(); + + if (MachineServiceConfig.TWILIO_ENABLE_SMS) + { + foreach (var phone in request.PhoneNumbers) + { + MessageResource.Create(from: MachineServiceConfig.TWILIO_FROM_NUMBER, to: new PhoneNumber(phone), body: request.Message); + } + } + + return response; + } + + #endregion + #region Version Upload [HttpPost] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs index bdddbab8f..e8240fd46 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs @@ -25,5 +25,10 @@ namespace Tango.MachineService public static String FSE_TFS_USER_EMAIL => ConfigurationManager.AppSettings[nameof(FSE_TFS_USER_EMAIL)].ToString(); public static String SEND_GRID_API_KEY => ConfigurationManager.AppSettings[nameof(SEND_GRID_API_KEY)].ToString(); + + public static bool TWILIO_ENABLE_SMS => bool.Parse(ConfigurationManager.AppSettings[nameof(TWILIO_ENABLE_SMS)].ToString()); + public static String TWILIO_ACCOUNT_SID => ConfigurationManager.AppSettings[nameof(TWILIO_ACCOUNT_SID)].ToString(); + public static String TWILIO_AUTH_TOKEN => ConfigurationManager.AppSettings[nameof(TWILIO_AUTH_TOKEN)].ToString(); + public static String TWILIO_FROM_NUMBER => ConfigurationManager.AppSettings[nameof(TWILIO_FROM_NUMBER)].ToString(); } }
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index 131483550..5faac7b11 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.22.0")] +[assembly: AssemblyVersion("3.0.23.0")] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index 3cb22c5b1..e011cf63c 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -182,8 +182,8 @@ <HintPath>..\..\packages\Microsoft.SqlServer.SqlManagementObjects.140.17283.0\lib\net40\Microsoft.SqlServer.WmiEnum.dll</HintPath> </Reference> <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> - <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL"> <HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> @@ -269,6 +269,9 @@ <HintPath>..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath> </Reference> <Reference Include="System.Xml.Linq" /> + <Reference Include="Twilio, Version=7.6.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Twilio.7.6.0\lib\net35\Twilio.dll</HintPath> + </Reference> <Reference Include="WebGrease"> <Private>True</Private> <HintPath>..\..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> @@ -507,7 +510,7 @@ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> </FlavorProperties> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Web.config b/Software/Visual_Studio/Web/Tango.MachineService/Web.config index 54cb322d9..8cc11ebb5 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Web.config +++ b/Software/Visual_Studio/Web/Tango.MachineService/Web.config @@ -38,6 +38,11 @@ <add key="FSE_TFS_USER_EMAIL" value="fse@twine-s.com" /> <add key="SEND_GRID_API_KEY" value="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" /> + + <add key="TWILIO_ACCOUNT_SID" value="AC05c701c7c282134811f96a120119ac34" /> + <add key="TWILIO_AUTH_TOKEN" value="e2c4cd2c0d431ed64f5c9832c1322096" /> + <add key="TWILIO_FROM_NUMBER" value="+16466815605" /> + <add key="TWILIO_ENABLE_SMS" value="true" /> </appSettings> <!-- For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367. @@ -90,7 +95,7 @@ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> - <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> diff --git a/Software/Visual_Studio/Web/Tango.MachineService/packages.config b/Software/Visual_Studio/Web/Tango.MachineService/packages.config index f2f83d078..ff05c3063 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/packages.config +++ b/Software/Visual_Studio/Web/Tango.MachineService/packages.config @@ -36,13 +36,14 @@ <package id="Microsoft.SqlServer.SqlManagementObjects" version="140.17283.0" targetFramework="net461" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" /> <package id="Modernizr" version="2.6.2" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" /> <package id="Owin" version="1.0" targetFramework="net461" /> <package id="Respond" version="1.2.0" targetFramework="net45" /> <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" /> + <package id="Twilio" version="7.6.0" targetFramework="net461" /> <package id="WebGrease" version="1.5.2" targetFramework="net45" /> <package id="Z.EntityFramework.Extensions" version="5.1.6" targetFramework="net461" /> <package id="Z.EntityFramework.Plus.EF6" version="5.1.6" targetFramework="net461" /> |
