Commit dd330b0c1f1caee9e98314df1a045dbd12595a90

Authored by unknown
1 parent f725cce2

Email Sending Functionality

400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs
1   -using System;
2   -using System.Collections.Generic;
3   -using System.Linq;
4   -using System.Web.Http;
5   -
6   -namespace AIAHTML5.API
7   -{
8   - public static class WebApiConfig
9   - {
10   - public static void Register(HttpConfiguration config)
11   - {
12   - // Web API configuration and services
13   -
14   - // Web API routes
15   - config.MapHttpAttributeRoutes();
16   -
17   - config.Routes.MapHttpRoute(
18   - name: "DefaultApi",
19   - routeTemplate: "api/{controller}/{id}",
20   - defaults: new { id = RouteParameter.Optional }
21   - );
22   - }
23   - }
24   -}
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Web.Http;
  5 +
  6 +namespace AIAHTML5.API
  7 +{
  8 + public static class WebApiConfig
  9 + {
  10 + public static void Register(HttpConfiguration config)
  11 + {
  12 + // Web API configuration and services
  13 +
  14 + // Web API routes
  15 + config.MapHttpAttributeRoutes();
  16 +
  17 + config.Routes.MapHttpRoute(
  18 + name: "DefaultApi",
  19 + routeTemplate: "api/{controller}/{id}",
  20 + defaults: new { id = RouteParameter.Optional }
  21 + );
  22 + }
  23 + }
  24 +}
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs
... ... @@ -217,7 +217,58 @@ namespace AIAHTML5.API.Controllers
217 217  
218 218  
219 219  
  220 + [HttpPost]
  221 + public HttpResponseMessage Hi(int userId)
  222 + {
  223 + return Request.CreateResponse(HttpStatusCode.OK, userId.ToString());
  224 + }
  225 + [Route("GetUserProfile/{userId}")]
  226 + [HttpGet]
  227 + public IHttpActionResult GetUserProfile(int userId)
  228 + {
  229 + //dbContext.Configuration.ProxyCreationEnabled = false;
  230 + try
  231 + {
  232 + return Ok("Hello");
  233 + }
  234 + catch (Exception ex)
  235 + {
  236 + throw ex;
  237 + }
  238 + //return ToJson(dbContext.AIAUsers.Where(u => u.Id == userId).AsEnumerable());
220 239  
  240 + }
  241 + [Route("api/LabExercise/SendEmail")]
  242 + [HttpPost]
  243 + public HttpResponseMessage SendEmail([FromBody]JObject User)
  244 + {
  245 + ArrayList aar = new ArrayList();
  246 + if (User["EmailTo"].ToString().ToLower().Contains(';'))
  247 + {
  248 + string[] words = User["EmailTo"].ToString().Split(';');
  249 + foreach (string word in words)
  250 + {
  251 + Console.WriteLine(word);
  252 + aar.Add(word);
  253 + }
  254 + }
  255 + else
  256 + {
  257 + aar.Add(User["EmailTo"].ToString());
  258 + }
  259 + if (User["ReportCheck"].ToString() == "true")
  260 + {
  261 + aar.Add(User["EmailAdd"].ToString());
  262 + }
  263 + AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), "test", User["reportImage"].ToString());
  264 + return Request.CreateResponse(HttpStatusCode.OK);
  265 + }
  266 + [Route("api/LabExercise/GetParameter")]
  267 + [HttpGet]
  268 + public IEnumerable<string> GetParameter()
  269 + {
  270 + return new string[] { "val1", "val2" };
  271 + }
221 272  
222 273  
223 274  
... ...
400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
... ... @@ -289,8 +289,8 @@ namespace AIAHTML5.API.Models
289 289 lstToAddress.Add(email);
290 290 }
291 291  
292   - emailMessage = "Unable to process request for ";
293   -
  292 + //emailMessage = "Unable to process request for ";
  293 + emailMessage = " ";
294 294 if (UserUtility.CheckIfPropertyExists(userInfo, "username") && !string.IsNullOrEmpty(userInfo["username"].ToString()))
295 295 emailMessage += "username: <b>" + userInfo["username"].ToString() + "</b>";
296 296 if (UserUtility.CheckIfPropertyExists(userInfo, "password") && !string.IsNullOrEmpty(userInfo["password"].ToString()))
... ... @@ -309,18 +309,20 @@ namespace AIAHTML5.API.Models
309 309  
310 310 emailMessage = emailMessage.Replace("\n", "<br/>");
311 311  
312   - emailMessage += "<br/><br/>";
313   -
  312 + // emailMessage += "<br/><br/>";
  313 + emailMessage += "<html><head></head><body>" + emailMessage + "</body></html1>";
314 314 emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
315 315 emailUtility.sFromAddress = senderEmailId;
316 316 emailUtility.bIsBodyHtml = true;
317   - emailUtility.bEnableSsl = false;
  317 + // emailUtility.bEnableSsl = false;
  318 + emailUtility.bEnableSsl = true;
318 319 emailUtility.sSubject = mailSubject;
319 320 emailUtility.sBodyText = emailMessage;
320   - emailUtility.iPort = 25;
  321 + //emailUtility.iPort = 25;
  322 + emailUtility.iPort = 587;
321 323 emailUtility.sToAddresses = lstToAddress;
322 324 emailUtility.sBccAddresses = lstBccAddress;
323   -
  325 + emailUtility.sUserName = senderEmailId;
324 326 emailUtility.SendSmtpEmail();
325 327 return true;
326 328 }
... ...
400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs
... ... @@ -39,7 +39,7 @@ namespace AIAHTML5.API.Utility
39 39 System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]);
40 40 smtp.Credentials = NetworkCred;
41 41 smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]);
42   -
  42 + smtp.EnableSsl = false;
43 43 smtp.Send(mm);
44 44 }
45 45 catch (Exception e)
... ...
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -32,13 +32,22 @@
32 32  
33 33 <appSettings>
34 34 <add key="Copyrightyear" value="2018" />
35   - <add key="SenderEmailAddress" value="support@interactiveanatomy.com" />
  35 +
  36 + <add key="SenderEmailAddress" value="ayush.jain@ebix.com" />
  37 + <add key="ErrorNotificationEmailAddress" value="ayush.jain@ebix.com" />
  38 + <add key="SenderPassword" value="Change1t" />
  39 + <add key="SMTPAddress" value="smtp.emailsrvr.com" />
  40 + <add key="SMTPPort" value="587" />
  41 + <add key="EnableSSL" value="true" />
  42 +
  43 + <!--<add key="SenderEmailAddress" value="support@interactiveanatomy.com" />
36 44 <add key="SenderEmailAddress" value="support@interactiveanatomy.com" />
37 45 <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" />
38 46 <add key="SenderPassword" value="" />
39 47 <add key="SMTPAddress" value="10.100.12.13" />
40 48 <add key="SMTPPort" value="25" />
41   - <add key="EnableSSL" value="false" />
  49 + <add key="EnableSSL" value="false" />-->
  50 +
42 51 <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/>
43 52 <add key ="HostAddress" value="10.100.12.13" />
44 53 <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/>
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -1289,7 +1289,44 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
1289 1289  
1290 1290 }
1291 1291  
  1292 + $scope.SendLabEXMailToUser = function (User) {
  1293 + console.log(User);
  1294 + html2canvas($("#submitResultHtml"), {
  1295 + onrendered: function (canvas) {
  1296 + var dataURL = canvas.toDataURL("image/jpeg");
  1297 + var imageToPrint = new Image();
  1298 + imageToPrint.src = dataURL;
  1299 + console.log(imageToPrint.src);
  1300 + $scope.reportImage = imageToPrint.src;
  1301 + }
  1302 + });
  1303 + debugger;
  1304 + LabExerciseService.LabExerciseReport(User, $scope.reportImage).then(
1292 1305  
  1306 + function (result) {
  1307 + console.log(result);
  1308 + },
  1309 + function (error) {
  1310 + console.log(error.statusText);
  1311 + }
  1312 + )
  1313 +
  1314 +
  1315 + }
  1316 + $rootScope.closeLabExEmailModel = function () {
  1317 + document.getElementById("LabExerciseForm").reset();
  1318 + $scope.LabExForm.$setPristine();
  1319 + $scope.LabExForm.$setUntouched();
  1320 + document.body.style.overflow = "scroll";
  1321 + document.getElementById('labExModalbackground').style.display = "none";
  1322 + document.getElementById('labExModalID').style.display = "none";
  1323 + }
  1324 + $rootScope.sendMail = function () {
  1325 + window.scrollTo(0, 0);
  1326 + document.body.style.overflow = "hidden";
  1327 + document.getElementById('labExModalbackground').style.display = "block";
  1328 + document.getElementById('labExModalID').style.display = "block";
  1329 + }
1293 1330  
1294 1331 }]
1295 1332  
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js
... ... @@ -49,5 +49,32 @@
49 49 });
50 50 return deferred.promise;
51 51 },
  52 +
  53 + // code of email report
  54 + LabExerciseReport: function (User, reportImage) {
  55 + User.reportImage = reportImage;
  56 + var deferred = $q.defer();
  57 + debugger;
  58 + // var jsonData = { 'EmailTo': User.EmailTo, 'EmailAdd': User.EmailAdd };
  59 + $http.post('http://192.168.90.19:91/API/api/LabExercise/SendEmail', JSON.stringify(User), {
  60 +
  61 + headers: {
  62 + 'Content-Type': 'application/json'
  63 + },
  64 + // data: { Users: JSON.stringify(jsonData) }
  65 + })
  66 +
  67 + .success(function (data, status, headers, config) {
  68 + debugger;
  69 + console.log('success')
  70 + deferred.resolve(data);
  71 + }).error(function (data, status, headers, config) {
  72 + debugger;
  73 + console.log('error')
  74 + deferred.reject(data);
  75 + });
  76 + return deferred.promise;
  77 + }
  78 +
52 79 }
53 80 })
54 81 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
... ... @@ -11,6 +11,107 @@
11 11 <div class="clearfix"></div>
12 12 </div>
13 13  
  14 +
  15 +
  16 + <!--report email pop up code-->
  17 +
  18 +
  19 +
  20 +
  21 + <div id="labExModalbackground"></div>
  22 + <!-- Lab Ex -->
  23 + <div class="labExModal" id="labExModalID">
  24 + <div class="modal-content">
  25 + <div class="modal-header">
  26 + <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="closeLabExEmailModel()"><span aria-hidden="true">×</span></button>
  27 + <h4 class="modal-title" id="myModalLabel">Email your performance report</h4>
  28 + </div>
  29 +
  30 + <div class="modal-body paddTop15">
  31 + <div class="modal-body paddTop15">
  32 +
  33 + <form class="form-horizontal" name="LabExForm" id="LabExerciseForm" ng-submit="LabExForm.$valid && SendLabEXMailToUser(User)">
  34 + <div class="form-group">
  35 + <div class="col-sm-5 control-label">
  36 + <label>*Email To: (Email address)</label>
  37 + </div>
  38 + <div class="col-sm-7">
  39 + <input type="text" class="form-control" name="senderEmail" ng-model="User.EmailTo" ng-pattern="/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/" required="required" />
  40 + <div class="help-block">*Use ';' to separate multiple email ids. </div>
  41 + <div class="help-block" style="color:red;" ng-if="LabExForm.senderEmail.$error.pattern">Please Enter valid Email Address</div>
  42 + </div>
  43 + </div>
  44 +
  45 + <div class="form-group">
  46 + <div class="col-sm-5 control-label">
  47 + <label>*Your name:</label>
  48 + </div>
  49 + <div class="col-sm-7">
  50 + <input type="text" name="name" class="form-control" ng-model="User.Name" ng-pattern="/^[a-zA-Z]+$/" required="required" />
  51 + <div class="help-block" style="color:red;" ng-if="LabExForm.name.$error.pattern"> Please enter your Name</div>
  52 + <!--<div class="help-block" style="color:red;" id="nameHelpBlock"> Please Enter your Name </div>-->
  53 + </div>
  54 + </div>
  55 +
  56 + <div class="form-group">
  57 + <div class="col-sm-5 control-label">
  58 + <label for="">*Your Email Address:</label>
  59 + </div>
  60 + <div class="col-sm-7">
  61 + <input type="text" class="form-control" name="receiverEmail" ng-model="User.EmailAdd" ng-pattern="/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/" required="required" />
  62 + <!--<div class="help-block" style="color:red;" id="emailHelpBlock"> Please Enter your Email Address </div>-->
  63 + <div class="help-block" style="color:red;" ng-if="LabExForm.receiverEmail.$error.pattern"> Please Enter valid Email Address</div>
  64 + </div>
  65 + </div>
  66 +
  67 + <div class="form-group">
  68 + <div class="col-sm-5 control-label">
  69 + <label for="">Send me a copy of the report</label>
  70 + </div>
  71 + <div class="col-sm-7">
  72 + <input type="checkbox" style="margin-top: 12px;" ng-model="User.ReportCheck" ng-init="User.ReportCheck = false" />
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="form-group">
  77 + <div class="col-sm-5 control-label">
  78 + <label for="">Note(optional)</label>
  79 + </div>
  80 + <div class="col-sm-7">
  81 + <textarea name="" id="" class="form-control" cols="30" rows="5" ng-model="User.comments"></textarea>
  82 + <div class="help-block">255 character limit </div>
  83 + </div>
  84 + </div>
  85 +
  86 +
  87 + <div class="form-group">
  88 + <div class="col-sm-5 control-label">
  89 +
  90 + </div>
  91 + <div class="col-sm-7">
  92 + <button type="submit" class="btn btn-primary btn-block">Send Mail</button>
  93 +
  94 + </div>
  95 + </div>
  96 +
  97 + </form>
  98 +
  99 + </div>
  100 +
  101 + </div>
  102 +
  103 + </div>
  104 + </div>
  105 +
  106 +
  107 +
  108 +
  109 +
  110 +
  111 +
  112 +
  113 +
  114 +
14 115 <div class="col-sm-12">
15 116 <div class="pull-left btn-group LabEx-Panel-state-minimized" id="LabExMinimizedId">
16 117 <p class="pull-left" style="color:#fff">LAB Ex ...</p>
... ... @@ -135,7 +236,7 @@
135 236 </div>
136 237 <div class="panel-footer">
137 238 <div class="text-center">
138   - <button class="btn btn-sm btn-primary">
  239 + <button class="btn btn-sm btn-primary" ng-click="sendMail()">
139 240 Email
140 241 </button>
141 242  
... ...
400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js
1   -var UpdatedGrayImageDataList = [];
2   -var doneBRID = [];
3   -var abc = 'hello';
4   -
5   -getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
6   - var matchedRGBLocationInBodyRegion = [];
7   - var matched;
8   -
9   - for (var x = 0; x < maskCanvasData.length; x++)
10   - {
11   -
12   - matched = false;
13   - var bodyRegionId = maskCanvasData[x].bodyRegionId;
14   - var canvasId = maskCanvasData[x].canvasId;
15   - var maskData = maskCanvasData[x].maskData;
16   -
17   - var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1];
18   - var grayImageDataVar// = grayImageDataList[bodyRegionId - 1];
19   -
20   - console.log('canvasId =' + canvasId)
21   - //if (canvasId.match('_MR')) {
22   - // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId];
23   - // grayImageDataVar = grayImageMRDataList[bodyRegionId];
24   - //}
25   - //else {
26   - coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1];
27   - grayImageDataVar = grayImageDataList[bodyRegionId-1];
28   - //}
29   - console.log('grayImageDataVar= ' + grayImageDataVar)
30   -
31   - var counter = 0;
32   -
33   - var imageDataVar = maskData.data;
34   -
35   - var machLocationWP = new Worker('match-pixel-wp.js');
36   -
37   -
38   - machLocationWP.postMessage({
39   -
40   - 'termList': termList,
41   - 'maskCanvasData': maskData,
42   - 'coloreImageData': coloredImageDataVar,
43   - 'grayImageData': grayImageDataVar,
44   - 'grayImageMRDataList': grayImageMRDataList,
45   - 'bodyRegionId': bodyRegionId,
46   - 'canvasId': canvasId
47   -
48   - });
49   -
50   - machLocationWP.onmessage = function (e) {
51   -
52   -
53   -
54   - doneBRID.push(e.data.bodyRegionId);
55   - var canvasID = (e.data.canvasId).replace('_mci', '');
56   -
57   - UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value });
58   -
59   - //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value
60   -
61   -
62   - if (doneBRID.length==9) {
63   -
64   - self.postMessage({
65   - 'value': UpdatedGrayImageDataList,
66   -
67   - })
68   - }
69   -
70   - };
71   - machLocationWP.onerror = function (e) {
72   - console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
73   - };
74   -
75   -
76   - }
77   -
78   -
79   -
80   -
81   -}
82   -
83   -self.onmessage = function (e) {
84   - getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,
85   - e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
86   -
87   -}
88   -
89   -
  1 +var UpdatedGrayImageDataList = [];
  2 +var doneBRID = [];
  3 +var abc = 'hello';
  4 +
  5 +getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
  6 + var matchedRGBLocationInBodyRegion = [];
  7 + var matched;
  8 +
  9 + for (var x = 0; x < maskCanvasData.length; x++)
  10 + {
  11 +
  12 + matched = false;
  13 + var bodyRegionId = maskCanvasData[x].bodyRegionId;
  14 + var canvasId = maskCanvasData[x].canvasId;
  15 + var maskData = maskCanvasData[x].maskData;
  16 +
  17 + var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1];
  18 + var grayImageDataVar// = grayImageDataList[bodyRegionId - 1];
  19 +
  20 + console.log('canvasId =' + canvasId)
  21 + //if (canvasId.match('_MR')) {
  22 + // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId];
  23 + // grayImageDataVar = grayImageMRDataList[bodyRegionId];
  24 + //}
  25 + //else {
  26 + coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1];
  27 + grayImageDataVar = grayImageDataList[bodyRegionId-1];
  28 + //}
  29 + console.log('grayImageDataVar= ' + grayImageDataVar)
  30 +
  31 + var counter = 0;
  32 +
  33 + var imageDataVar = maskData.data;
  34 +
  35 + var machLocationWP = new Worker('match-pixel-wp.js');
  36 +
  37 +
  38 + machLocationWP.postMessage({
  39 +
  40 + 'termList': termList,
  41 + 'maskCanvasData': maskData,
  42 + 'coloreImageData': coloredImageDataVar,
  43 + 'grayImageData': grayImageDataVar,
  44 + 'grayImageMRDataList': grayImageMRDataList,
  45 + 'bodyRegionId': bodyRegionId,
  46 + 'canvasId': canvasId
  47 +
  48 + });
  49 +
  50 + machLocationWP.onmessage = function (e) {
  51 +
  52 +
  53 +
  54 + doneBRID.push(e.data.bodyRegionId);
  55 + var canvasID = (e.data.canvasId).replace('_mci', '');
  56 +
  57 + UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value });
  58 +
  59 + //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value
  60 +
  61 +
  62 + if (doneBRID.length==9) {
  63 +
  64 + self.postMessage({
  65 + 'value': UpdatedGrayImageDataList,
  66 +
  67 + })
  68 + }
  69 +
  70 + };
  71 + machLocationWP.onerror = function (e) {
  72 + console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  73 + };
  74 +
  75 +
  76 + }
  77 +
  78 +
  79 +
  80 +
  81 +}
  82 +
  83 +self.onmessage = function (e) {
  84 + getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,
  85 + e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
  86 +
  87 +}
  88 +
  89 +
... ...
400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css
... ... @@ -1281,4 +1281,42 @@ footer .browserIcons
1281 1281 #UserPassword
1282 1282 {
1283 1283 -webkit-text-security: disc;
1284   - }
1285 1284 \ No newline at end of file
  1285 + }
  1286 +
  1287 +/*email pop up css*/
  1288 +
  1289 +#labExModalID {
  1290 + display: none;
  1291 + position: absolute;
  1292 + z-index: 12000001;
  1293 + margin: auto;
  1294 + top: 50px;
  1295 + left: 0;
  1296 + right: 0;
  1297 + bottom: 0;
  1298 + width: 50%;
  1299 +}
  1300 +#labExModalbackground
  1301 +{
  1302 + background-color: black;
  1303 + bottom: 0px;
  1304 + display: none;
  1305 + height: 100%; left: 0px;
  1306 + opacity: 0.5;
  1307 + position: fixed;
  1308 + right: 0px; top: 0px;
  1309 + width: 100%;
  1310 + z-index: 12000000;
  1311 +}
  1312 +#nameHelpBlock
  1313 + {
  1314 + display:none;
  1315 +}
  1316 +#emailHelpBlock
  1317 +{
  1318 + display:none;
  1319 +}
  1320 +#emailToHelpBlock
  1321 +{
  1322 + display:none;
  1323 +}
1286 1324 \ No newline at end of file
... ...