aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-05-08 13:35:30 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-05-08 13:35:30 +0300
commita46fd6cec3dc8aa99e7a3067de4c0617b232ff88 (patch)
treeae7090d620bec62bd29aadfda588beb6a85d6b2a /Software/Visual_Studio
parent84b2368007384d8825eff275e8da05e0a20e322e (diff)
downloadTango-a46fd6cec3dc8aa99e7a3067de4c0617b232ff88.tar.gz
Tango-a46fd6cec3dc8aa99e7a3067de4c0617b232ff88.zip
Working on TCC...
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs16
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs29
2 files changed, 13 insertions, 32 deletions
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
index e2560ff41..d508c2f10 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
@@ -196,19 +196,21 @@ namespace Tango.TCC.Service.Controllers
ResultByEmailResponse response = new ResultByEmailResponse();
var client = new SendGridClient(TCCServiceConfig.SEND_GRID_API_KEY);
- //var from = new EmailAddress(request.From);
- //var subject = "SnapMatch Color Result";
- //var to = new EmailAddress(request.To);
SendGridMessage msg = new SendGridMessage();
msg.SetFrom(request.From);
msg.AddTo(request.To);
msg.Subject = "SnapMatch Color Result";
+ msg.SetTemplateId("d-619b8adc604d4f6fa486d7bbc9e3c2cc");
-
+ var dynamicTemplateData = new
+ {
+ Message = request.Message,
+ R = request.DetectionResponse.ProcessedColor.R,
+ G = request.DetectionResponse.ProcessedColor.G,
+ B = request.DetectionResponse.ProcessedColor.B,
+ };
- //var plainTextContent = request.Message;
- //var htmlContent = $"<div style='color:red;'>{request.Message}.</strong>";
- //var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
+ msg.SetTemplateData(dynamicTemplateData);
DetectionColorFile file = new DetectionColorFile();
file.RawColor = request.DetectionResponse.RawColor;
diff --git a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
index 9465676ef..ca0ba1143 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
@@ -50,26 +50,12 @@ namespace Tango.UnitTesting.SendGrid
msg.Subject = "SnapMatch Color Result";
msg.SetTemplateId("d-619b8adc604d4f6fa486d7bbc9e3c2cc");
- Bitmap rect = new Bitmap(80, 80);
- using (Graphics g = Graphics.FromImage(rect))
+ var dynamicTemplateData = new
{
- g.Clear(Color.FromArgb(255, 0, 0));
- }
-
- String image64 = String.Empty;
-
- using (MemoryStream ms = new MemoryStream())
- {
- rect.Save(ms, ImageFormat.Jpeg);
- ms.Position = 0;
- image64 = Convert.ToBase64String(ms.ToArray());
- }
-
- var dynamicTemplateData = new ExampleTemplateData
- {
- Name = "Roy",
Message = "This is my personal note...",
- ImageSource = image64,
+ R = 0,
+ G = 255,
+ B = 0,
};
msg.SetTemplateData(dynamicTemplateData);
@@ -86,12 +72,5 @@ namespace Tango.UnitTesting.SendGrid
Assert.IsTrue(result.StatusCode == HttpStatusCode.Accepted);
}
-
- public class ExampleTemplateData
- {
- public String Name { get; set; }
- public String ImageSource { get; set; }
- public String Message { get; set; }
- }
}
}