Commit 6302a6003d5043da0735ee05d3afc30db184821b

Authored by Utkarsh Singh
1 parent 1548b92e

Committed updated files

400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -170,14 +170,34 @@ namespace AIAHTML5.API.Models
170 170  
171 171 if (licenseId != 0)
172 172 {
173   - ArrayList allModulesList = objModel.GetUserModules();
174   - ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId);
175   -
176   - ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList);
177   -
178   - objUser.Modules = userModuleList;
  173 + objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId);
  174 + if (objUser.LicenseSubscriptions != null)
  175 + {
  176 + DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough;
  177 +
  178 + objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId);
  179 +
  180 + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date > DateTime.Now.Date)
  181 + {
  182 + if (objUser.License.IsActive)
  183 + {
  184 + ArrayList allModulesList = objModel.GetUserModules();
  185 + ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId);
  186 +
  187 + ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList);
  188 +
  189 + objUser.Modules = userModuleList;
  190 + }
  191 + }
  192 + else
  193 + {
  194 + objUser.IsSubscriptionExpired = true;
  195 + objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString();
  196 + }
  197 + }
179 198 }
180 199  
  200 +
181 201 else
182 202 {
183 203 objUser.Modules = null;
... ... @@ -415,5 +435,176 @@ namespace AIAHTML5.API.Models
415 435 return result;
416 436 }
417 437  
  438 + protected LicenseSubscriptionDetails GetLicenseSubscriptionDetailsByLicenseId(int iLicenseId)
  439 + {
  440 + LicenseSubscriptionDetails lsd = new LicenseSubscriptionDetails();
  441 + try
  442 + {
  443 + conn = new SqlConnection(dbConnectionString);
  444 + cmd = new SqlCommand();
  445 + SqlDataAdapter adapter;
  446 + SqlParameter param;
  447 + DataSet ds = new DataSet();
  448 +
  449 + cmd.Connection = conn;
  450 + cmd.CommandText = "GetSubscriptionDetailsByLicenseId";
  451 + cmd.CommandType = CommandType.StoredProcedure;
  452 +
  453 + param = new SqlParameter("@iLicenseId", iLicenseId);
  454 + param.Direction = ParameterDirection.Input;
  455 + param.DbType = DbType.Int32;
  456 + cmd.Parameters.Add(param);
  457 +
  458 + adapter = new SqlDataAdapter(cmd);
  459 + adapter.Fill(ds);
  460 + DataTable dt = ds.Tables[0];
  461 +
  462 + foreach (DataRow dr in dt.Rows)
  463 + {
  464 + foreach (DataColumn dc in dt.Columns)
  465 + {
  466 + if (dc.ColumnName == "Id")
  467 + lsd.Id = Convert.ToInt32(dr[dc]);
  468 + if (dc.ColumnName == "LicenseId")
  469 + lsd.LicenseId = Convert.ToInt32(dr[dc]);
  470 + if (dc.ColumnName == "SubscriptionPlanId")
  471 + {
  472 + int tempVal;
  473 + lsd.SubscriptionPlanId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
  474 + }
  475 + if (dc.ColumnName == "SubscriptionValidFrom")
  476 + {
  477 + DateTime date;
  478 + lsd.SubscriptionValidFrom = DateTime.TryParse(dr[dc].ToString(), out date) ? date : (DateTime?)null;
  479 + }
  480 + if (dc.ColumnName == "SubscriptionValidThrough")
  481 + {
  482 + DateTime date;
  483 + lsd.SubscriptionValidThrough = DateTime.TryParse(dr[dc].ToString(), out date) ? date : (DateTime?)null;
  484 + }
  485 + if (dc.ColumnName == "RenewelDate")
  486 + {
  487 + DateTime? date;
  488 + if (dr[dc] == DBNull.Value)
  489 + date = null;
  490 + else
  491 + date = (DateTime)dr[dc];
  492 +
  493 + lsd.RenewelDate = date;
  494 + }
  495 + if (dc.ColumnName == "PaymentMode")
  496 + lsd.PaymentMode = dr[dc].ToString();
  497 + if (dc.ColumnName == "TotalAmount")
  498 + lsd.TotalAmount = Convert.ToDouble(dr[dc]);
  499 + if (dc.ColumnName == "AmountPaid")
  500 + lsd.AmountPaid = Convert.ToDouble(dr[dc]);
  501 + if (dc.ColumnName == "AmountPending")
  502 + lsd.AmountPending = Convert.ToDouble(dr[dc]);
  503 + if (dc.ColumnName == "NoofImages")
  504 + lsd.NoOfImages = Convert.ToInt32(dr[dc]);
  505 + }
  506 + }
  507 + }
  508 + catch (Exception ex)
  509 + {
  510 +
  511 + }
  512 +
  513 + return lsd;
  514 + }
  515 +
  516 + protected License GetLicenseDetailsByLicenseId(int iLicenseId)
  517 + {
  518 + License lic = new License();
  519 + try
  520 + {
  521 + conn = new SqlConnection(dbConnectionString);
  522 + cmd = new SqlCommand();
  523 + SqlDataAdapter adapter;
  524 + SqlParameter param;
  525 + DataSet ds = new DataSet();
  526 +
  527 + cmd.Connection = conn;
  528 + cmd.CommandText = "GetLicenseDetailsById";
  529 + cmd.CommandType = CommandType.StoredProcedure;
  530 +
  531 + param = new SqlParameter("@Id", iLicenseId);
  532 + param.Direction = ParameterDirection.Input;
  533 + param.DbType = DbType.Int32;
  534 + cmd.Parameters.Add(param);
  535 +
  536 + adapter = new SqlDataAdapter(cmd);
  537 + adapter.Fill(ds);
  538 + DataTable dt = ds.Tables[0];
  539 +
  540 + foreach (DataRow dr in dt.Rows)
  541 + {
  542 + foreach (DataColumn dc in dt.Columns)
  543 + {
  544 + if (dc.ColumnName == "Id")
  545 + lic.Id = Convert.ToInt32(dr[dc]);
  546 + if (dc.ColumnName == "AccountNumber")
  547 + lic.AccountNumber = dr[dc].ToString();
  548 + if (dc.ColumnName == "LicenseeFirstName")
  549 + lic.LicenseeFirstName = dr[dc].ToString();
  550 + if (dc.ColumnName == "LicenseeLastName")
  551 + lic.LicenseeLastName = dr[dc].ToString();
  552 + if (dc.ColumnName == "LicenseTypeId")
  553 + lic.LicenseTypeId = Convert.ToInt32(dr[dc]);
  554 + if (dc.ColumnName == "InstitutionName")
  555 + lic.InstitutionName = dr[dc].ToString();
  556 + if (dc.ColumnName == "Adress1")
  557 + lic.Address1 = dr[dc].ToString();
  558 + if (dc.ColumnName == "Adress2")
  559 + lic.Address2 = dr[dc].ToString();
  560 + if (dc.ColumnName == "CountryId")
  561 + lic.CountryId = Convert.ToInt32(dr[dc]);
  562 + if (dc.ColumnName == "StateId")
  563 + lic.StateId = Convert.ToInt32(dr[dc]);
  564 + if (dc.ColumnName == "City")
  565 + lic.City = dr[dc].ToString();
  566 + if (dc.ColumnName == "Zip")
  567 + lic.Zip = dr[dc].ToString();
  568 + if (dc.ColumnName == "Phone")
  569 + lic.Phone = dr[dc].ToString();
  570 + if (dc.ColumnName == "EmailId")
  571 + lic.EmailId = dr[dc].ToString();
  572 + if (dc.ColumnName == "TotalLogin")
  573 + lic.TotalLogins = Convert.ToInt32(dr[dc]);
  574 + if (dc.ColumnName == "AccountTypeId")
  575 + lic.AccountTypeId = Convert.ToInt32(dr[dc]);
  576 + if (dc.ColumnName == "IsActive")
  577 + lic.IsActive = Convert.ToBoolean(dr[dc]);
  578 + if (dc.ColumnName == "IsDistrictSiteLicense")
  579 + lic.IsDistrictSiteLicense = Convert.ToBoolean(dr[dc]);
  580 + if (dc.ColumnName == "CreationDate")
  581 + lic.CreationDate = Convert.ToDateTime(dr[dc]);
  582 + if (dc.ColumnName == "ModifiedDate")
  583 + {
  584 + DateTime? date;
  585 + if (dr[dc] == DBNull.Value)
  586 + date = null;
  587 + else
  588 + date = (DateTime)dr[dc];
  589 +
  590 + lic.ModifiedDate = date;
  591 + }
  592 +
  593 + if (dc.ColumnName == "NoOfRenewals")
  594 + lic.NoOfRenewals = Convert.ToInt32(dr[dc]);
  595 + if (dc.ColumnName == "IsTermAccepted")
  596 + lic.IsTermAccepted = Convert.ToBoolean(dr[dc]);
  597 + if (dc.ColumnName == "ProductId")
  598 + lic.ProductId = dr[dc].ToString();
  599 + }
  600 + }
  601 + }
  602 + catch (Exception ex)
  603 + {
  604 +
  605 + }
  606 +
  607 + return lic;
  608 + }
418 609 }
419 610 }
420 611 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... ... @@ -26,6 +26,11 @@ namespace AIAHTML5.API.Models
26 26  
27 27 public ArrayList Modules { get; set; }
28 28  
  29 + public License License { get; set; }
  30 + public LicenseSubscriptionDetails LicenseSubscriptions { get; set; }
  31 + public bool IsSubscriptionExpired { get; set; }
  32 + public string SubscriptionExpirationDateString { get; set; }
  33 +
29 34 public const string SUPER_ADMIN = "Super Admin";
30 35 public const string GENERAL_ADMIN = "General Admin";
31 36 public const string DISTRICT_ADMIN = "District Admin";
... ... @@ -36,4 +41,50 @@ namespace AIAHTML5.API.Models
36 41 public const string TEST_ACCOUNT = "Test Account";
37 42 public const string SITE_USER = "Site User";
38 43 }
  44 +
  45 + public class License
  46 + {
  47 + public int Id { get; set; }
  48 + public string AccountNumber { get; set; }
  49 + public string LicenseeFirstName { get; set; }
  50 + public string LicenseeLastName { get; set; }
  51 + public int LicenseTypeId { get; set; }
  52 + public string InstitutionName { get; set; }
  53 + public string Address1 { get; set; }
  54 + public string Address2 { get; set; }
  55 + public int CountryId { get; set; }
  56 + public int StateId { get; set; }
  57 + public string City { get; set; }
  58 + public string Zip { get; set; }
  59 + public string Phone { get; set; }
  60 + public string EmailId { get; set; }
  61 + public int TotalLogins { get; set; }
  62 + public int AccountTypeId { get; set; }
  63 + public bool IsActive { get; set; }
  64 + public bool IsDistrictSiteLicense { get; set; }
  65 + public DateTime CreationDate { get; set; }
  66 + public DateTime? ModifiedDate { get; set; }
  67 + public DateTime? CancellationDate { get; set; }
  68 + public int NoOfRenewals { get; set; }
  69 + public bool IsTermAccepted { get; set; }
  70 + public int CardNumber { get; set; }
  71 + public string ProductId { get; set; }
  72 +
  73 +
  74 + }
  75 +
  76 + public class LicenseSubscriptionDetails
  77 + {
  78 + public int Id { get; set; }
  79 + public int LicenseId { get; set; }
  80 + public int? SubscriptionPlanId { get; set; }
  81 + public DateTime? SubscriptionValidFrom { get; set; }
  82 + public DateTime? SubscriptionValidThrough { get; set; }
  83 + public DateTime? RenewelDate { get; set; }
  84 + public string PaymentMode { get; set; }
  85 + public double TotalAmount { get; set; }
  86 + public double AmountPaid { get; set; }
  87 + public double AmountPending { get; set; }
  88 + public int NoOfImages { get; set; }
  89 + }
39 90 }
40 91 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -18,6 +18,8 @@ namespace AIAHTML5.API.Models
18 18 {
19 19 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
20 20 logger.Debug("inside AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString());
  21 + dynamic userDetails = null;
  22 +
21 23 try
22 24 {
23 25 //var client = new MongoClient();
... ... @@ -43,16 +45,14 @@ namespace AIAHTML5.API.Models
43 45 User oUser = DBModel.GetUserDetailsByLoginIdAndPassword(credentials["username"].ToString(), credentials["password"].ToString());
44 46 //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString());
45 47  
46   - dynamic userDetails;
47   -
48 48 if (oUser != null)
49 49 {
50 50 logger.Debug("userDetails.loginId= " + oUser.LoginId); // .loginId);
51   - return userDetails = JsonConvert.SerializeObject(oUser);
  51 + userDetails = JsonConvert.SerializeObject(oUser);
52 52 }
53 53 else
54 54 {
55   - return AIAConstants.USER_NOT_FOUND;
  55 + userDetails = AIAConstants.USER_NOT_FOUND;
56 56 }
57 57  
58 58 }
... ... @@ -62,9 +62,9 @@ namespace AIAHTML5.API.Models
62 62 logger.Fatal("Exception in AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message);
63 63  
64 64 string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS;
65   - return errorMessage;
  65 + userDetails = errorMessage;
66 66 }
67   -
  67 + return userDetails;
68 68 }
69 69  
70 70 internal static dynamic GetUserByEmail(Newtonsoft.Json.Linq.JObject userInfo)
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
... ... @@ -30,7 +30,7 @@
30 30 </root>
31 31 </log4net>
32 32  
33   - <!--<appSettings>
  33 + <appSettings>
34 34 <add key="SenderEmailAddress" value="support@interactiveanatomy.com" />
35 35 <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" />
36 36 <add key="SenderPassword" value="" />
... ... @@ -42,21 +42,7 @@
42 42 <add key="isUserAuthenticated" value="false"/>
43 43 <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/>
44 44 <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>
45   - </appSettings>-->
46   - <appSettings>
47   - <add key="SenderEmailAddress" value="utkarsh.singh@ebix.com" />
48   - <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" />
49   - <add key="SenderPassword" value="utkarsh@3bix" />
50   - <add key="SMTPAddress" value="smtp.emailsrvr.com" />
51   - <add key="SMTPPort" value="587" />
52   - <add key="EnableSSL" value="false" />
53   - <add key="Site_Url" value ="//192.168.83.135:82/AIA"/>
54   - <add key ="HostAddress" value="10.100.12.13" />
55   - <add key="isUserAuthenticated" value="false"/>
56   - <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/>
57   - <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>
58 45 </appSettings>
59   -
60 46 <system.web>
61 47 <compilation debug="true" targetFramework="4.5" />
62 48 <httpRuntime targetFramework="4.5" />
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -144,20 +144,35 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
144 144 if ($("#messageModal").length > 0){
145 145  
146 146 $("#messageModal").modal('hide');
147   - }
148   - $rootScope.userData = result;
149   - $rootScope.userModules = result.Modules;
150   - $rootScope.isVisibleLogin = false;
151   -
152   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
153   - $('#dvUserModulesInfo').modal('show');
154   -
155   - var userType = result.UserType + '';
156   -
157   - if (userType === UserTypeConstants.SUPER_ADMIN)
158   - $rootScope.haveRoleAdmin = false;
159   - else
160   - $rootScope.haveRoleAdmin = true;
  147 + }
  148 +
  149 + if ((!result.IsSubscriptionExpired) && (result.License.IsActive)) {
  150 +
  151 + $rootScope.userData = result;
  152 + $rootScope.userModules = result.Modules;
  153 + $rootScope.isVisibleLogin = false;
  154 +
  155 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  156 + $('#dvUserModulesInfo').modal('show');
  157 +
  158 + var userType = result.UserType + '';
  159 +
  160 + if (userType === UserTypeConstants.SUPER_ADMIN)
  161 + $rootScope.haveRoleAdmin = false;
  162 + else
  163 + $rootScope.haveRoleAdmin = true;
  164 + }
  165 + else if ((result.IsSubscriptionExpired) && (result.License.IsActive)) {
  166 + $rootScope.isVisibleLogin = true;
  167 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  168 + $("#messageModal").modal('show');
  169 + }
  170 + else if ((result.IsSubscriptionExpired) && !(result.License.IsActive)) {
  171 + $rootScope.isVisibleLogin = true;
  172 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  173 + $rootScope.errorMessage = $rootScope.errorMessage + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
  174 + $("#messageModal").modal('show');
  175 + }
161 176 }
162 177  
163 178 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -322,7 +322,9 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
322 322 "USER_NOT_FOUND": "User not found.",
323 323 "NEW_PASSWORD_FIELD_IS_EMPTY": "Please enter new password to reset your password.",
324 324 "PASSWORD_UPDATE_SUCCESS": "Password updated successfully",
325   - "PASSWORD_UPDATE_FAILED": "Password update failed"
  325 + "PASSWORD_UPDATE_FAILED": "Password update failed",
  326 + "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ",
  327 + "LICENSE_INACTIVE_MESSAGE": "Your license is inactive."
326 328 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
327 329 //"MAIL_NOT_SENT": "Mail not sent."
328 330  
... ...