diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index f256911..429572e 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -33,6 +33,6 @@ namespace AIAHTML5.API.Constants public const string GET_LICENSE_BY_SITE_ID = "GetLicenseBySiteId"; public const string GET_LICENSE_EDITIONS_FOR_MODESTY = "GetLicenseEditionsForModesty"; public const string GET_PRODUCT_FEATURES = "GetProductFeatures"; - + public const string GET_MODESTY_FOR_THIS_LICENSE = "usp_GetModestyForThisLicense"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 2ceb681..2bb6536 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -11,7 +11,8 @@ using AIAHTML5.API.Constants; using AIAHTML5.API.Models; using System.Collections; -using System.Data.SqlClient;namespace AIAHTML5.API.Controllers +using System.Data.SqlClient; +namespace AIAHTML5.API.Controllers { public class AuthenticateController : ApiController { @@ -139,12 +140,12 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers userInfo.IsBlocked = true; userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; } - + } - + authenticationRepsonse = JsonConvert.SerializeObject(userInfo); - + } else @@ -153,7 +154,8 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers } return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; } - catch(SqlException e){ + catch (SqlException e) + { logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); @@ -162,7 +164,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; } catch (Exception e) { @@ -173,9 +175,9 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; - + + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; + } } @@ -191,7 +193,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers userInfo.EditionId = editionId; //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN) - if(userInfo.LicenseId == 0) + if (userInfo.LicenseId == 0) { userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); @@ -202,8 +204,9 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers { CheckLicenseStatus(userInfo); - if(!userInfo.IsSubscriptionExpired){ - GetModulesBasedOnLicense(userInfo,false); + if (!userInfo.IsSubscriptionExpired) + { + GetModulesBasedOnLicense(userInfo, false); } } } @@ -235,50 +238,58 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); } - if (isLicenseExpired) + if (isLicenseExpired) { userInfo.IsSubscriptionExpired = isLicenseExpired; userInfo.SubscriptionExpirationDate = expirationDate; } + else + { + //check Modesty settings for this license + + userInfo.IsModestyOn = AIAHTML5.API.Models.Users.IsModestyActiveForThisLicense(userInfo.LicenseId); + + + } } - + else { - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); - logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId); + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= " + userInfo.LicenseId); } } private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired) { - - //05.6.1 - if (userInfo.LicenseInfo.IsActive) + + //05.6.1 + if (userInfo.LicenseInfo.IsActive) + { + if (!userInfo.LicenseInfo.IsTermAccepted) { - if (!userInfo.LicenseInfo.IsTermAccepted) + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); + foreach (Hashtable item in termsList) { - ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); - foreach (Hashtable item in termsList) - { - userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); - userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); - } - } - else - { - userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); } } else { - userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); } - } - + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + + } + } + // PUT api/authenticate/5 diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs.orig b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs.orig new file mode 100644 index 0000000..ef63915 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs.orig @@ -0,0 +1,384 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using log4net; +using AIAHTML5.API.Constants; +using AIAHTML5.API.Models; +using System.Collections; + +<<<<<<< HEAD +using System.Data.SqlClient;namespace AIAHTML5.API.Controllers +======= +using System.Data.SqlClient; +namespace AIAHTML5.API.Controllers +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 +{ + public class AuthenticateController : ApiController + { + // GET api/authenticate + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/authenticate/5 + public string Get(int id) + { + return "value"; + } + + // POST api/authenticate + public HttpResponseMessage Post([FromBody]JObject credentials) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); + + dynamic authenticationRepsonse; + DateTime blockTime; + bool isUserBlocked; + + try + { + + //01.get the user detail to autheticate the user + User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); + + if (userInfo != null) + { + // 02 Check user is authenticated or not by login credential match + bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo); + + if (isUserAuthenticated) + { + if (userInfo.IsActive) + { + //03. check if user is blocked + isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime); + + if (!isUserBlocked) + { + //04.delete past wrong login attempts of user + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); + if (wrongAttemptDeteledCount < 0) + { + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); + } + //05. + GetModulesBasedOnUserType(userInfo); + + // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); + } + + else + { + + //compare block time of user with current time if user is blocked + DateTime blockDuration = blockTime.AddDays(1); + var difference = DateTime.Compare(DateTime.Now, blockDuration); + + //check if credentials are valid credentials + //bool isCorrectLoginId, isCorrectPassword; + //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword); + + if (difference >= 0) + { + //means 24 hours block time is finished + userInfo.IsBlocked = false; + + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); + if (wrongAttemptDeteledCount < 0) + { + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); + } + + //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads + GetModulesBasedOnUserType(userInfo); + + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; + } + } + } + else + { + //CODE REVIW: validate that is this tarnslated by UI because we need to show message to user if he is inactive + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE; + + //05.4 check the License expiration irespective of either user is active + //or not because on AIA, we shows the License expiration message + //for inactive users too + + CheckLicenseStatus(userInfo); + + } + } + + else + { + //this come in picture when user input wrong passowrd + + //get wrong attempt count of user + int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id); + userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1; + userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH; + + //01. insert wrong attempt in dtabase + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts); + + if (updateCount < 0) + { + //Put the log in log file + logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id); + } + //else + //{ + if (userInfo.IncorrectLoginAttemptCount > 4) + { + userInfo.IsBlocked = true; + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; + } +<<<<<<< HEAD + + + } + + authenticationRepsonse = JsonConvert.SerializeObject(userInfo); + +======= + + + } + + authenticationRepsonse = JsonConvert.SerializeObject(userInfo); + +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + + else + { + authenticationRepsonse = AIAConstants.USER_NOT_FOUND; + } + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; + } +<<<<<<< HEAD + catch(SqlException e){ +======= + catch (SqlException e) + { +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + + logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); + + ArrayList supportMailList = UserUtility.GetSupportMailList(); + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); + +<<<<<<< HEAD + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; +======= + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + catch (Exception e) + { + + logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); + + ArrayList supportMailList = UserUtility.GetSupportMailList(); + string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); +<<<<<<< HEAD + + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; + +======= + + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; + +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + + } + + private static void GetModulesBasedOnUserType(User userInfo) + { + //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. + //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin + int licenseId, editionId; + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); + + userInfo.LicenseId = licenseId; + userInfo.EditionId = editionId; + + //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN) +<<<<<<< HEAD + if(userInfo.LicenseId == 0) +======= + if (userInfo.LicenseId == 0) +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + { + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + else + { + CheckLicenseStatus(userInfo); + +<<<<<<< HEAD + if(!userInfo.IsSubscriptionExpired){ + GetModulesBasedOnLicense(userInfo,false); +======= + if (!userInfo.IsSubscriptionExpired) + { + GetModulesBasedOnLicense(userInfo, false); +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + } + } + + private static void CheckLicenseStatus(User userInfo) + { + //05.1 For normal user need to get the license details, get the license id for authenticated user + //int licenseId, editionId; + //AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); + + //userInfo.LicenseId = licenseId; + //userInfo.EditionId = editionId; + + //05.2 get license details + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); + + if (userInfo.LicenseInfo != null) + { + //05.3 get licenseSubscription details + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); + + //05.4 check the License expiration irespective of either user is active or not because on AIA + //we shows the License expiration message for inactive users too + string expirationDate = null; + bool isLicenseExpired = false; + + if (userInfo.LicenseSubscriptions != null) + { + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); + } + +<<<<<<< HEAD + if (isLicenseExpired) +======= + if (isLicenseExpired) +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + { + userInfo.IsSubscriptionExpired = isLicenseExpired; + userInfo.SubscriptionExpirationDate = expirationDate; + } +<<<<<<< HEAD + } + + else + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId); +======= + else + { + //check Modesty settings for this license + + userInfo.IsModestyOn = AIAHTML5.API.Models.Users.IsModestyActiveForThisLicense(userInfo.LicenseId); + + + } + } + + else + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= " + userInfo.LicenseId); +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + } + + private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired) + { +<<<<<<< HEAD + + //05.6.1 + if (userInfo.LicenseInfo.IsActive) + { + if (!userInfo.LicenseInfo.IsTermAccepted) + { + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); + foreach (Hashtable item in termsList) + { + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); + } + } + else + { + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); +======= + + //05.6.1 + if (userInfo.LicenseInfo.IsActive) + { + if (!userInfo.LicenseInfo.IsTermAccepted) + { + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); + foreach (Hashtable item in termsList) + { + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + } + else + { +<<<<<<< HEAD + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + + } + } + +======= + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + + } + } + +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + + + // PUT api/authenticate/5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api/authenticate/5 + public void Delete(int id) + { + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs index 9f619b9..77dd165 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs @@ -217,7 +217,58 @@ namespace AIAHTML5.API.Controllers + //[HttpPost] + //public HttpResponseMessage Hi(int userId) + //{ + // return Request.CreateResponse(HttpStatusCode.OK, userId.ToString()); + //} + [Route("GetUserProfile/{userId}")] + [HttpGet] + public IHttpActionResult GetUserProfile(int userId) + { + //dbContext.Configuration.ProxyCreationEnabled = false; + try + { + return Ok("Hello"); + } + catch (Exception ex) + { + throw ex; + } + //return ToJson(dbContext.AIAUsers.Where(u => u.Id == userId).AsEnumerable()); + } + [Route("api/LabExercise/SendEmail")] + [HttpPost] + public HttpResponseMessage SendEmail([FromBody]JObject User) + { + ArrayList aar = new ArrayList(); + if (User["EmailTo"].ToString().ToLower().Contains(';')) + { + string[] words = User["EmailTo"].ToString().Split(';'); + foreach (string word in words) + { + Console.WriteLine(word); + aar.Add(word); + } + } + else + { + aar.Add(User["EmailTo"].ToString()); + } + if (Convert.ToBoolean(User["ReportCheck"]) == true) + { + aar.Add(User["EmailAdd"].ToString()); + } + AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), User["reportTitle"].ToString(), User["reportImage"].ToString(), true); + return Request.CreateResponse(HttpStatusCode.OK); + } + [Route("api/LabExercise/GetParameter")] + [HttpGet] + public IEnumerable GetParameter() + { + return new string[] { "val1", "val2" }; + } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 11be152..6417794 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -1126,5 +1126,42 @@ namespace AIAHTML5.API.Models return objFeatures; } + + internal Boolean GetModestyInfo(int LicenseId) + { + logger.Debug(" inside GetModestyInfo for licenseId= " + LicenseId); + + Boolean isModestyOn = false; + + DataTable dt = null; + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_MODESTY_FOR_THIS_LICENSE; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@licenseId", LicenseId); + SqlDataAdapter da = new SqlDataAdapter(); + da.SelectCommand = cmd; + dt = new DataTable(); + da.Fill(dt); + + if (dt != null && dt.Rows.Count > 0) + { + string IsModesty = dt.Rows[0]["IsModesty"].ToString(); + if (IsModesty == "True") + { + isModestyOn = true; + } + else + { + isModestyOn = false; + } + } + + + return isModestyOn; + } + } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index a6898d8..dd3a3d7 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -35,7 +35,7 @@ namespace AIAHTML5.API.Models public int LicenseId { get; set; } public int EditionId { get; set; } public Int16 LoginFailureCauseId { get; set; } - + public bool IsModestyOn { get; set; } public ArrayList Modules { get; set; } public License LicenseInfo { get; set; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs b/400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs index 0154fb2..a02ff79 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs @@ -283,7 +283,7 @@ namespace AIAHTML5.API.Models } } - public static bool SendEmail(Newtonsoft.Json.Linq.JObject userInfo, ArrayList mailToList, string sender, string mailSubject = "", string mailBody = "") + public static bool SendEmail(Newtonsoft.Json.Linq.JObject userInfo, ArrayList mailToList, string sender, string mailSubject = "", string mailBody = "", bool isCalForLabExerciseReport=false) { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("Inside SendEmail with UserInfo =" + userInfo); @@ -301,9 +301,10 @@ namespace AIAHTML5.API.Models { lstToAddress.Add(email); } - - emailMessage = "Unable to process request for "; - + if (!isCalForLabExerciseReport) + emailMessage = "Unable to process request for "; + else + emailMessage = " "; if (UserUtility.CheckIfPropertyExists(userInfo, "username") && !string.IsNullOrEmpty(userInfo["username"].ToString())) emailMessage += "username: " + userInfo["username"].ToString() + ""; if (UserUtility.CheckIfPropertyExists(userInfo, "password") && !string.IsNullOrEmpty(userInfo["password"].ToString())) @@ -316,24 +317,26 @@ namespace AIAHTML5.API.Models if (string.IsNullOrEmpty(sender)) senderEmailId = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]); else - senderEmailId = sender; + senderEmailId = sender; emailMessage += mailBody; emailMessage = emailMessage.Replace("\n", "
"); - emailMessage += "

"; - + // emailMessage += "

"; + emailMessage = "" + emailMessage + ""; emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]); emailUtility.sFromAddress = senderEmailId; emailUtility.bIsBodyHtml = true; - emailUtility.bEnableSsl = false; + // emailUtility.bEnableSsl = false; + emailUtility.bEnableSsl = true; emailUtility.sSubject = mailSubject; emailUtility.sBodyText = emailMessage; - emailUtility.iPort = 25; + //emailUtility.iPort = 25; + emailUtility.iPort = 587; emailUtility.sToAddresses = lstToAddress; emailUtility.sBccAddresses = lstBccAddress; - + emailUtility.sUserName = senderEmailId; emailUtility.SendSmtpEmail(); return true; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 1883ca1..b4b4fc4 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -598,5 +598,12 @@ namespace AIAHTML5.API.Models //return intUserId; return userInfo; } + + internal static Boolean IsModestyActiveForThisLicense(int LicenseId) + { + DBModel objModel = new DBModel(); + bool IsModestyOn = objModel.GetModestyInfo(LicenseId); + return IsModestyOn; + } } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs index a2152f0..960420c 100644 --- a/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs +++ b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs @@ -39,7 +39,7 @@ namespace AIAHTML5.API.Utility System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); - + smtp.EnableSsl = false; smtp.Send(mm); } catch (Exception e) diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index ee162e6..dd98f5d 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -32,13 +32,22 @@ - + + + + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index 9bb9c3a..62f3f86 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -39,6 +39,7 @@ 4 + diff --git a/400-SOURCECODE/AIAHTML5.Web/AdobePlayerDownloadLink.html b/400-SOURCECODE/AIAHTML5.Web/AdobePlayerDownloadLink.html new file mode 100644 index 0000000..0e28ab9 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/AdobePlayerDownloadLink.html @@ -0,0 +1,76 @@ + + + + + + + Ebix + + + +
+
+
+

CURRICULUM BUILDER

+
+
+
+
+ Adobe Flash will still be needed to access Curriculum Builder module for now. + In order to utilize this aspect of AIA you will need to enable Adobe Flash Player to be used within your browser. + Below please find the appropriate browser that you are using and follow the + instructions to enable Flash Player and return back to + the Curriculum Builder module to access the module. +
+
+
Chrome –
+
https://support.google.com/chrome/answer/6258784
+
FireFox –
+
https://support.mozilla.org/en-US/kb/set-adobe-flash-click-play-firefox
+
Safari –
+
https://helpx.adobe.com/flash-player/kb/enabling-flash-player-safari.html
+
Edge –
+
https://helpx.adobe.com/flash-player/kb/flash-player-issues-windows-10-edge.html
+
Internet Explorer –
+
https://helpx.adobe.com/flash-player/kb/flash-player-issues-windows-10-ie.html
+
+
+
+ + \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index 3d6f8f7..040acf0 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -10,8 +10,9 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location var selectedModuleName = ''; //set module title angular.forEach($rootScope.userModules, function (value, key) { - if (value.slug === currentURL.replace('/', '')) { - selectedModuleName = value.name; + // if (value.slug === currentURL.replace('/', '')) { + if (value.slug === "3d-anatomy-list") { + selectedModuleName = value.name; } $rootScope.currentActiveModuleTitle = selectedModuleName; }) @@ -114,30 +115,31 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location //once you get id in scope push detail in jspanel content var openViews; - if ($rootScope.openViews.length > 0) { - openViews = new jinqJs() - .from($rootScope.openViews) - .where("BodyViewId==" + $scope.voId3D) - .select(); - } - var counter = 1; + //if ($rootScope.openViews.length > 0) { + // openViews = new jinqJs() + // .from($rootScope.openViews) + // .where("BodyViewId==" + $scope.voId3D) + // .select(); + //} + //var counter = 1; var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); - - if (openViews != null && openViews.length > 0) { - angular.forEach(openViews, function (value, key) { - - if (value.body - views == tittle) { - tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; - $rootScope.currentActiveViewTitle = tittle; - localStorage.setItem("currentViewTitle", tittle); - } - - }); - } - else { - localStorage.setItem("currentViewTitle", tittle); - - } + $rootScope.currentActiveViewTitle = tittle; + localStorage.setItem("currentViewTitle", tittle); + //if (openViews != null && openViews.length > 0) { + // angular.forEach(openViews, function (value, key) { + + // if (value.body - views == tittle) { + // tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; + // $rootScope.currentActiveViewTitle = tittle; + // localStorage.setItem("currentViewTitle", tittle); + // } + + // }); + //} + //else { + // localStorage.setItem("currentViewTitle", tittle); + + //} // alert($rootScope.getLocalStorageValue("currentViewTitle")); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js.orig b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js.orig new file mode 100644 index 0000000..7d0b606 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js.orig @@ -0,0 +1,245 @@ +AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", +function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) { + + + $scope.showTabButton = false; + $scope.threeDAnatomyData; + $scope.Id; + $scope.$on('$viewContentLoaded', function (event) { + var currentURL = $location.path(); + var selectedModuleName = ''; + //set module title + angular.forEach($rootScope.userModules, function (value, key) { +<<<<<<< HEAD + if (value.slug === currentURL.replace('/', '')) { + selectedModuleName = value.name; +======= + // if (value.slug === currentURL.replace('/', '')) { + if (value.slug === "3d-anatomy-list") { + selectedModuleName = value.name; +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + } + $rootScope.currentActiveModuleTitle = selectedModuleName; + }) + if ($rootScope.refreshcheck == null) { + $location.path('/'); + } + $scope.scroll(); + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData; + + $scope.selectedThreeDAdata = new jinqJs() + .from($scope.threeDAnatomyData.root.ThreeDAData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); + + // console.log($scope.selectedCIListViewData); + $('#grid-view').empty(); + angular.forEach($scope.selectedThreeDAdata, function (value, key) { + $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage; + + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); + + + $compile($el)($scope); + + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); + + }); + + }, + function (error) { + // handle errors here + console.log(' $scope.threeDAnatomyData = ' + error.statusText); + } + ); + + }); + $scope.scroll = function () { + // $window.scrollTo(0, 0); + $("html,body").scrollTop(0); + //alert("scroll"); + } + $scope.IsVisible = function () { + //$scope.scroll(); + + $location.url("/3dAnatomy"); + + } + + + $scope.Open3DModel = function ($event) { + $rootScope.currentBodyViewId = $event.currentTarget.id; + if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { + var ThreeDTitle = []; + ThreeDTitle = new jinqJs() + .from($scope.selectedThreeDAdata) + .where('_id = ' + $event.currentTarget.id) + .select('_Title'); + + $rootScope.ViewTitle = ThreeDTitle[0]._Title; + } + else { + $rootScope.ViewTitle = $event.currentTarget.textContent; + + } + + + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); + localStorage.setItem("currentBodyViewId", $event.currentTarget.id); + + var u = $location.url(); + $location.url('/3d-anatomy-details'); + + } + + $scope.Open3DModelBody = function () { + + if ($rootScope.refreshcheck == null) { + $location.path('/'); + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + //alert($rootScope.getLocalStorageValue("currentBodyViewId")); + $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId"); + + //alert($scope.voId3D); + + + //once you get id in scope push detail in jspanel content + + var openViews; +<<<<<<< HEAD + if ($rootScope.openViews.length > 0) { + openViews = new jinqJs() + .from($rootScope.openViews) + .where("BodyViewId==" + $scope.voId3D) + .select(); + } + var counter = 1; + var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); + + if (openViews != null && openViews.length > 0) { + angular.forEach(openViews, function (value, key) { + + if (value.body - views == tittle) { + tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; + $rootScope.currentActiveViewTitle = tittle; + localStorage.setItem("currentViewTitle", tittle); + } + + }); + } + else { + localStorage.setItem("currentViewTitle", tittle); + + } +======= + //if ($rootScope.openViews.length > 0) { + // openViews = new jinqJs() + // .from($rootScope.openViews) + // .where("BodyViewId==" + $scope.voId3D) + // .select(); + //} + //var counter = 1; + var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); + $rootScope.currentActiveViewTitle = tittle; + localStorage.setItem("currentViewTitle", tittle); + //if (openViews != null && openViews.length > 0) { + // angular.forEach(openViews, function (value, key) { + + // if (value.body - views == tittle) { + // tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; + // $rootScope.currentActiveViewTitle = tittle; + // localStorage.setItem("currentViewTitle", tittle); + // } + + // }); + //} + //else { + // localStorage.setItem("currentViewTitle", tittle); + + //} +>>>>>>> a3f0825d877d83f47a713081fef2e780c2d2c693 + + // alert($rootScope.getLocalStorageValue("currentViewTitle")); + + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + var clicked3dAview = []; + clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData) + .where('_id == ' + $scope.voId3D) + .select('_Title', '_3dimagepath'); + $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath; + $scope.threeDBodySystemTitle = clicked3dAview[0]._Title; + + if (clicked3dAview.length > 0) { + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + $.jsPanel({ + id: '3DImagePanel', + selector: '.threeDView', + theme: 'success', + currentController: '3dAController', + parentSlug: '3d-anatomy-list', + content: '
' + + '' + + '
', + title: $rootScope.getLocalStorageValue("currentViewTitle"), + position: { + top: 70, + left: 1, + }, + + size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 }, + + }); + + $rootScope.currentSlug = '3d-anatomy-details'; + + $rootScope.openViews.push( + { + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, + "slug": $rootScope.currentSlug + }); + + + } + + + }, + function (error) { + // handle errors here + console.log(' $scope.CIllustrationData = ' + error.statusText); + } + + ); + $('#ThreeDView').css("height", $(window).outerHeight()); + + $('#ThreeDView').css("width", $(window).outerWidth()); + + } + + + +}] + + + +); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index ebd1e1b..e35382e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -227,6 +227,41 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } else { + //code for modesty setting + if (result.LicenseInfo != null) { + if (result.IsModestyOn) { + $rootScope.isModestyOn = true; + $rootScope.isModestyOff = false; + localStorage.setItem("globalModesty", "Y"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "Y" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + else { + $rootScope.isModestyOn = false; + $rootScope.isModestyOff = true; + localStorage.setItem("globalModesty", "N"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "N" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + } + else { + $rootScope.isModestyOn = true; + $rootScope.isModestyOff = false; + localStorage.setItem("globalModesty", "Y"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "Y" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + //code for modesty setting + if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { if ($("#messageModal").length > 0) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index c3736a0..8720462 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -1288,8 +1288,55 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } } + $scope.reportCopyStatus = false; + $scope.SendLabEXMailToUser = function (User) { + var reportHtml = ''; + reportHtml += ''; + $("#resultLabData tr").each(function () { + reportHtml += ''; + $(this).children("td").each(function () { + if ($(this).text() == " Review") { + } + else{ + reportHtml += ''; + } + }); + reportHtml += ''; + }); + reportHtml += '
QuestionActivity TitleStatus
' + $(this).text() + '
'; + $scope.reportImage = "
"+$("#submitResultHtml .panel-heading .row div:nth-child(1)").text()+"Performance Report" + $("#submitResultHtml .panel-heading .row div:nth-child(3)").text() + "
Total QuestionCorrect AnswersIncorrect Answers
" + $("#questionStatus tbody tr td:nth-child(1)").text() + "" + $("#questionStatus tbody tr td:nth-child(2)").text() + "" + $("#questionStatus tbody tr td:nth-child(3)").text() + "


" + reportHtml + ""; + $scope.reportTitle = "Lab Exercise Report for " + $("#submitResultHtml .panel-heading .row div:nth-child(1)").text(); + $scope.senderEmails = $("#emailTo").val(); + + + LabExerciseService.LabExerciseReport(User, $scope.reportImage, $scope.reportTitle, $scope.reportCopyStatus, $scope.senderEmails).then( + function (result) { + console.log(result); + }, + function (error) { + console.log(error.statusText); + } + ) + // for closing email popup + $rootScope.closeLabExEmailModel(); + } + $rootScope.closeLabExEmailModel = function () { + document.getElementById("LabExerciseForm").reset(); + $scope.LabExForm.$setPristine(); + $scope.LabExForm.$setUntouched(); + document.body.style.overflow = "scroll"; + document.getElementById('labExModalbackground').style.display = "none"; + document.getElementById('labExModalID').style.display = "none"; + $scope.reportCopyStatus = false; + } + $rootScope.sendMail = function () { + window.scrollTo(0, 0); + document.body.style.overflow = "hidden"; + document.getElementById('labExModalbackground').style.display = "block"; + document.getElementById('labExModalID').style.display = "block"; + } }] diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js index 71e274f..fbd29f4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js @@ -49,5 +49,34 @@ }); return deferred.promise; }, + + // code of email report + LabExerciseReport: function (User, reportImage, reportTitle, reportCopyStatus, senderEmail) { + User.reportImage = reportImage; + User.reportTitle = reportTitle; + User.ReportCheck = reportCopyStatus; + User.EmailTo = senderEmail; + var deferred = $q.defer(); + // var jsonData = { 'EmailTo': User.EmailTo, 'EmailAdd': User.EmailAdd }; + $http.post('/API/api/LabExercise/SendEmail', JSON.stringify(User), { + + headers: { + 'Content-Type': 'application/json' + }, + // data: { Users: JSON.stringify(jsonData) } + }) + + .success(function (data, status, headers, config) { + + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + + console.log('error') + deferred.reject(data); + }); + return deferred.promise; + } + } }) \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html index 06cfb89..2106c46 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html @@ -11,6 +11,111 @@
+ + + + + + + +
+ +
+ +
+ + + + + + + + + +

LAB Ex ...

@@ -100,7 +205,7 @@
- +
@@ -135,7 +240,7 @@
Total Question