Commit 6de4dfa877ea0cb19b66746b59c6f49dabaf949a
1 parent
e75b61c2
email msg on succesful email
Showing
4 changed files
with
60 additions
and
27 deletions
400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs
... | ... | @@ -260,8 +260,11 @@ namespace AIAHTML5.API.Controllers |
260 | 260 | { |
261 | 261 | aar.Add(User["EmailAdd"].ToString()); |
262 | 262 | } |
263 | - AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), User["reportTitle"].ToString(), User["reportImage"].ToString(), true); | |
264 | - return Request.CreateResponse(HttpStatusCode.OK); | |
263 | + // AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), User["reportTitle"].ToString(), User["reportImage"].ToString(), true); | |
264 | + // return Request.CreateResponse(HttpStatusCode.OK); | |
265 | + bool isEMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), User["reportTitle"].ToString(), User["reportImage"].ToString(), true); | |
266 | + // return Request.CreateResponse(HttpStatusCode.OK,); | |
267 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(isEMailSent.ToString()) }; | |
265 | 268 | } |
266 | 269 | [Route("api/LabExercise/GetParameter")] |
267 | 270 | [HttpGet] | ... | ... |
400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs
... | ... | @@ -31,6 +31,9 @@ namespace AIAHTML5.API.Utility |
31 | 31 | |
32 | 32 | public void SendMail(MailMessage mm) |
33 | 33 | { |
34 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
35 | + //logger.Debug("inside SendMail"); | |
36 | + | |
34 | 37 | try |
35 | 38 | { |
36 | 39 | SmtpClient smtp = new SmtpClient(); |
... | ... | @@ -43,7 +46,9 @@ namespace AIAHTML5.API.Utility |
43 | 46 | smtp.Send(mm); |
44 | 47 | } |
45 | 48 | catch (Exception e) |
46 | - { | |
49 | + { | |
50 | + logger.Fatal("Exception inside SendMail. Ex= " + e.Message + "....STACKTRACE = " + e.StackTrace); | |
51 | + | |
47 | 52 | throw; |
48 | 53 | } |
49 | 54 | } |
... | ... | @@ -136,7 +141,7 @@ namespace AIAHTML5.API.Utility |
136 | 141 | catch (Exception ex) |
137 | 142 | { |
138 | 143 | logger.Fatal("exception in SendSmtpEmail.msg= " + ex.Message + ", stacktarce= " + ex.StackTrace); |
139 | - throw ex; | |
144 | + throw ; | |
140 | 145 | } |
141 | 146 | } |
142 | 147 | } | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
1 | 1 | /// <reference path="../../content/data/json/le/LabExercise.js" /> |
2 | -AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', '$timeout', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService", "AIAConstants", | |
3 | -function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $location, $document, $sce, $compile, $location, LabExerciseService, AIAConstants) { | |
2 | +AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', '$timeout', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", "$location", "LabExerciseService", "AIAConstants","LoginConstants", | |
3 | +function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $location, $document, $sce, $compile, $location, LabExerciseService, AIAConstants, LoginConstants) { | |
4 | 4 | $scope.$sce = $sce; |
5 | 5 | $scope.LabExerciseName; |
6 | 6 | $scope.LabExerciseQuiz = null; |
... | ... | @@ -1409,8 +1409,27 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1409 | 1409 | return false; |
1410 | 1410 | } |
1411 | 1411 | } |
1412 | - | |
1413 | - | |
1412 | + | |
1413 | + $scope.isUserNameValid = false; | |
1414 | + var userName = $("#userName").val(); | |
1415 | + if (userName.length == 0 || userName == 'undefined' || userName == ' ') { | |
1416 | + $("#alertPopUp").css("display", "block"); | |
1417 | + $("#messageBody").text("Please enter User name"); | |
1418 | + $scope.isUserNameValid = false; | |
1419 | + return false; | |
1420 | + } | |
1421 | + // else { | |
1422 | + var filterName = /^([a-zA-Z]+\s?)*$/; | |
1423 | + if (filterName.test(userName)) { | |
1424 | + $scope.isUserNameValid = true; | |
1425 | + } | |
1426 | + else { | |
1427 | + $("#alertPopUp").css("display", "block"); | |
1428 | + $("#messageBody").text("User Name is not valid"); | |
1429 | + $scope.isUserNameValid = false; | |
1430 | + return false; | |
1431 | + } | |
1432 | + // } | |
1414 | 1433 | $scope.isReceiverEmailValid = false; |
1415 | 1434 | var receiverEmail = $("#userEmailID").val(); |
1416 | 1435 | var rEmail = receiverEmail; |
... | ... | @@ -1433,7 +1452,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1433 | 1452 | // email validation code ends |
1434 | 1453 | |
1435 | 1454 | |
1436 | - if ($scope.isSenderEmailValid == true && $scope.isReceiverEmailValid == true) { | |
1455 | + if ($scope.isSenderEmailValid == true && $scope.isReceiverEmailValid == true && $scope.isUserNameValid == true) { | |
1437 | 1456 | |
1438 | 1457 | var reportHtml = ''; |
1439 | 1458 | |
... | ... | @@ -1475,21 +1494,27 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1475 | 1494 | |
1476 | 1495 | |
1477 | 1496 | LabExerciseService.LabExerciseReport(User, $scope.reportImage, $scope.reportTitle, $scope.reportCopyStatus, $scope.receiverEmails).then( |
1478 | - | |
1479 | - function (result) { | |
1480 | - console.log(result); | |
1481 | - }, | |
1482 | - function (error) { | |
1483 | - console.log(error.statusText); | |
1484 | - } | |
1485 | -) | |
1486 | - // for closing email popup | |
1487 | - $rootScope.closeLabExEmailModel(); | |
1488 | - | |
1489 | - document.getElementById('labExEmailSentModalID').style.display = "block"; | |
1490 | - document.getElementById('labExModalbackground').style.display = "block"; | |
1491 | - | |
1492 | - | |
1497 | + function(result){ | |
1498 | + if (result == "true") { | |
1499 | + document.getElementById('labExEmailSentModalID').style.display = "block"; | |
1500 | + document.getElementById('labExModalbackground').style.display = "block"; | |
1501 | + | |
1502 | + } | |
1503 | + else { | |
1504 | + var message = LoginConstants.MAIL_NOT_SENT | |
1505 | + //alert(message); | |
1506 | + $rootScope.errorMessage = message; | |
1507 | + $("#messageModal").modal('show'); | |
1508 | + } | |
1509 | + console.log(result); | |
1510 | +}, | |
1511 | + function (error) { | |
1512 | + var message = LoginConstants.MAIL_NOT_SENT | |
1513 | + //alert(message); | |
1514 | + $rootScope.errorMessage = message; | |
1515 | + $("#messageModal").modal('show'); | |
1516 | + console.log(error.statusText); | |
1517 | + } | |
1493 | 1518 | |
1494 | 1519 | |
1495 | 1520 | } | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
... | ... | @@ -58,8 +58,8 @@ |
58 | 58 | <label>*Your name:</label> |
59 | 59 | </div> |
60 | 60 | <div class="col-sm-7"> |
61 | - <input type="text" name="name" class="form-control" ng-model="User.Name" ng-pattern="/^([a-zA-Z]+\s?)*$/" required="required" /> | |
62 | - <div class="help-block" style="color:red;" ng-if="LabExForm.name.$error.pattern"> Please enter your Name</div> | |
61 | + <input type="text" name="name" class="form-control" ng-model="User.Name" id="userName" /> | |
62 | + <!--<div class="help-block" style="color:red;" ng-if="LabExForm.name.$error.pattern"> Please enter your Name</div>--> | |
63 | 63 | <!--<div class="help-block" style="color:red;" id="nameHelpBlock"> Please Enter your Name </div>--> |
64 | 64 | </div> |
65 | 65 | </div> |
... | ... | @@ -168,7 +168,7 @@ |
168 | 168 | </div> |
169 | 169 | <div class="modal-body "> |
170 | 170 | <div class="modal-body" style="padding:10px;font-size:15px;"> |
171 | - Your report has been sent. A copy has been emailed to you for your records. | |
171 | + Your report has been sent. | |
172 | 172 | </div> |
173 | 173 | </div> |
174 | 174 | <div class="modal-footer"> | ... | ... |