diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj b/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj index abc086a..ea9606b 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj @@ -714,15 +714,48 @@ AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt @@ -747,21 +780,54 @@ AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt + + AIADBEntity.tt + + + AIADBEntity.tt + AIADBEntity.tt diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/CommonController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/CommonController.cs index 1ca3957..3b4ef5d 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/CommonController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/CommonController.cs @@ -94,7 +94,7 @@ namespace AIAHTML5.ADMIN.API.Controllers string sStartDate = DateTime.MinValue.ToShortDateString(); string sEndDate = DateTime.MaxValue.ToShortDateString(); var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstDiscountCode = dbContext.GetDiscountCodes("", "", "", 1, 1, spRecordCount).ToList(); + var lstDiscountCode = dbContext.usp_GetDiscountCodes("", "", "", 1, 1, spRecordCount).ToList(); lstDiscountCode1 = lstDiscountCode.Select(l => new DiscountCodeModel { Id = l.Id, DiscountCode = l.DiscountCode }).ToList(); return Ok(lstDiscountCode1); } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs index 6309cdd..e129023 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs @@ -403,5 +403,22 @@ namespace AIAHTML5.ADMIN.API.Controllers } } + [Route("LicenseSiteAdmin")] + [HttpGet] + public HttpResponseMessage GetLicenseSiteAdmin(string AccountNo) + { + List> LicenseSiteAdminList = new List>(); + try + { + LicenseSiteAdminList = LicenseModel.GetLicenseSiteAdmin(dbContext, AccountNo); + return Request.CreateResponse(HttpStatusCode.OK, new { LicenseSiteAdminList = LicenseSiteAdminList }); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs index 3bbd90e..e00de28 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs @@ -26,7 +26,7 @@ namespace AIAHTML5.ADMIN.API.Controllers { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstUsageReport = dbContext.GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry,pageNo, pageLength, spRecordCount).ToList(); + var lstUsageReport = dbContext.usp_GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { UserUsage = lstUsageReport, RecordCount = spRecordCount.Value }); //return Ok(lstUsageReport); } @@ -36,7 +36,7 @@ namespace AIAHTML5.ADMIN.API.Controllers public IHttpActionResult GetCustomerSummeryReport(string sAccoutNumber, string sLicenseeFullName, Nullable iStartPrice, Nullable iEndPrice, int iLicenseType, int iAccountType, string sZip, int iState, int iCountry, int pageNo, int pageLength) { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstCustomerSummeryReport = dbContext.GetCustomerSummary(sAccoutNumber, sLicenseeFullName, iStartPrice, iEndPrice, (byte)iLicenseType, (byte)iAccountType, sZip, iState, iCountry,pageNo,pageLength,spRecordCount).ToList(); + var lstCustomerSummeryReport = dbContext.usp_GetCustomerSummary(sAccoutNumber, sLicenseeFullName, iStartPrice, iEndPrice, (byte)iLicenseType, (byte)iAccountType, sZip, iState, iCountry, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { CustomerSummery = lstCustomerSummeryReport, RecordCount = spRecordCount.Value }); //return Ok(lstCustomerSummeryReport); } @@ -47,7 +47,7 @@ namespace AIAHTML5.ADMIN.API.Controllers public IHttpActionResult GetExpiringSubscriptionReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId, int pageNo, int pageLength) { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstExpiringSubscriptionReport = dbContext.GetExpiringLicenses(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId, pageNo, pageLength, spRecordCount).ToList(); + var lstExpiringSubscriptionReport = dbContext.usp_GetExpiringLicenses(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { ExpiringSubscription = lstExpiringSubscriptionReport, RecordCount = spRecordCount.Value }); } @@ -65,7 +65,7 @@ namespace AIAHTML5.ADMIN.API.Controllers public IHttpActionResult GetSubscriptionCancellationReport(string sFromDate, string sToDate, decimal icStartPrice, decimal icEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId, int pageNo, int pageLength) { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstExpiringSubscriptionReport = dbContext.GetCancelledLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId, pageNo, pageLength, spRecordCount).ToList(); + var lstExpiringSubscriptionReport = dbContext.usp_GetCancelledLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { SubscriptionCancel = lstExpiringSubscriptionReport, RecordCount = spRecordCount.Value }); } @@ -76,7 +76,7 @@ namespace AIAHTML5.ADMIN.API.Controllers try { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstNetAdSummaryReport = dbContext.GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, pageNo, pageLength, spRecordCount).ToList(); + var lstNetAdSummaryReport = dbContext.usp_GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { NetAdSubscriptionList = lstNetAdSummaryReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) @@ -93,7 +93,7 @@ namespace AIAHTML5.ADMIN.API.Controllers try { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstSiteLicenseUsageReport = dbContext.GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition, pageNo, pageLength, spRecordCount).ToList(); + var lstSiteLicenseUsageReport = dbContext.usp_GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { SiteLicenseUsageList = lstSiteLicenseUsageReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) @@ -109,7 +109,7 @@ namespace AIAHTML5.ADMIN.API.Controllers try { var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstDiscountReport = dbContext.GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); + var lstDiscountReport = dbContext.usp_GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { DiscountReportList = lstDiscountReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) @@ -127,7 +127,7 @@ namespace AIAHTML5.ADMIN.API.Controllers { if (sAccountNumber == null) sAccountNumber = string.Empty; var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); - var lstImageExportReport = dbContext.GetExportedImageDetails(sFromDate, sToDate, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); + var lstImageExportReport = dbContext.usp_GetExportedImageDetails(sFromDate, sToDate, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { ImageExportList = lstImageExportReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 406c24c..031351b 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -154,8 +154,7 @@ namespace AIAHTML5.ADMIN.API.Controllers //var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); //recordCount = (int)spRecordCount.Value; - List Users = dbContext.GetSearchUsers(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, 1, - pageNo, pageLength, spRecordCount).ToList(); + List Users = dbContext.usp_GetSearchUsers(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, 1, pageNo, pageLength, spRecordCount).ToList(); return Ok(new { UserList = Users, RecordCount = spRecordCount.Value }); } catch(Exception ex) @@ -295,7 +294,7 @@ namespace AIAHTML5.ADMIN.API.Controllers short UserType = (short)UserTypeId; dbContext.Configuration.ProxyCreationEnabled = false; List userTypelist = new List(); - var userTypeEntity = dbContext.GetUserTyeByAccountNumber((byte)UserType, LicenseId).ToList(); + var userTypeEntity = dbContext.usp_GetUserTyeByAccountNumber((byte)UserType, LicenseId).ToList(); userTypelist = userTypeEntity.Select(l => new GetUserTyeByAccountNumber_Result() { Id = l.Id, Title = l.Title }).ToList(); if (userTypelist != null && userTypelist.Count==0) { @@ -379,7 +378,7 @@ namespace AIAHTML5.ADMIN.API.Controllers public IHttpActionResult GetBlockedUserByAccNoAndType(int UserTypeId, int LicenseId) { dbContext.Configuration.ProxyCreationEnabled = false; - List Users = dbContext.GetBlockedUserByAccNoAndType((byte)UserTypeId, LicenseId).ToList(); + List Users = dbContext.usp_GetBlockedUserByAccNoAndType((byte)UserTypeId, LicenseId).ToList(); return Ok(Users); } [Route("UnblockedUser")] diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index 15eb578..384e450 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -3930,5 +3930,1036 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_CheckSubscriptionForLicense", idParameter, status); } + + public virtual int usp_UpdateAiaUserPassword(Nullable id, string newPassword, ObjectParameter status) + { + var idParameter = id.HasValue ? + new ObjectParameter("Id", id) : + new ObjectParameter("Id", typeof(int)); + + var newPasswordParameter = newPassword != null ? + new ObjectParameter("NewPassword", newPassword) : + new ObjectParameter("NewPassword", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateAiaUserPassword", idParameter, newPasswordParameter, status); + } + + public virtual int usp_UpdateUserProfile(Nullable id, string firstName, string lastName, string emailId, ObjectParameter status) + { + var idParameter = id.HasValue ? + new ObjectParameter("Id", id) : + new ObjectParameter("Id", typeof(int)); + + var firstNameParameter = firstName != null ? + new ObjectParameter("FirstName", firstName) : + new ObjectParameter("FirstName", typeof(string)); + + var lastNameParameter = lastName != null ? + new ObjectParameter("LastName", lastName) : + new ObjectParameter("LastName", typeof(string)); + + var emailIdParameter = emailId != null ? + new ObjectParameter("EmailId", emailId) : + new ObjectParameter("EmailId", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateUserProfile", idParameter, firstNameParameter, lastNameParameter, emailIdParameter, status); + } + + public virtual ObjectResult usp_EC_GetAccountTypeList() + { + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_EC_GetAccountTypeList"); + } + + public virtual ObjectResult usp_DeleteLicense(Nullable iLicenseId) + { + var iLicenseIdParameter = iLicenseId.HasValue ? + new ObjectParameter("iLicenseId", iLicenseId) : + new ObjectParameter("iLicenseId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_DeleteLicense", iLicenseIdParameter); + } + + public virtual ObjectResult usp_GetModuleStatusByLicenseId(Nullable iLicenseId) + { + var iLicenseIdParameter = iLicenseId.HasValue ? + new ObjectParameter("iLicenseId", iLicenseId) : + new ObjectParameter("iLicenseId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetModuleStatusByLicenseId", iLicenseIdParameter); + } + + public virtual ObjectResult usp_GetSiteAccountAdmin(string accountNumber) + { + var accountNumberParameter = accountNumber != null ? + new ObjectParameter("AccountNumber", accountNumber) : + new ObjectParameter("AccountNumber", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSiteAccountAdmin", accountNumberParameter); + } + + public virtual ObjectResult usp_GetSiteAccountSites(string strAccountNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var strAccountNumberParameter = strAccountNumber != null ? + new ObjectParameter("strAccountNumber", strAccountNumber) : + new ObjectParameter("strAccountNumber", typeof(string)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSiteAccountSites", strAccountNumberParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetSiteAccoutDetail(string strAccountNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var strAccountNumberParameter = strAccountNumber != null ? + new ObjectParameter("strAccountNumber", strAccountNumber) : + new ObjectParameter("strAccountNumber", typeof(string)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSiteAccoutDetail", strAccountNumberParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_InsertNewLicenseAccount(string sAccountNumber, string sLicenseeFname, string sLicenseeLname, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sInstitutionName, string sAddress1, string sAddress2, string sCity, string sZip, Nullable iStateId, Nullable iCountryId, string sPhone, string sEmailId, Nullable iTotalLogins, string sStartDate, string sEndDate, string sMasterIP, string sEditionList, Nullable iPrice, string sProductKey, string sSiteIPTo, string sSiteMasterIPTo, Nullable iNoofImages) + { + var sAccountNumberParameter = sAccountNumber != null ? + new ObjectParameter("sAccountNumber", sAccountNumber) : + new ObjectParameter("sAccountNumber", typeof(string)); + + var sLicenseeFnameParameter = sLicenseeFname != null ? + new ObjectParameter("sLicenseeFname", sLicenseeFname) : + new ObjectParameter("sLicenseeFname", typeof(string)); + + var sLicenseeLnameParameter = sLicenseeLname != null ? + new ObjectParameter("sLicenseeLname", sLicenseeLname) : + new ObjectParameter("sLicenseeLname", typeof(string)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(byte)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var sInstitutionNameParameter = sInstitutionName != null ? + new ObjectParameter("sInstitutionName", sInstitutionName) : + new ObjectParameter("sInstitutionName", typeof(string)); + + var sAddress1Parameter = sAddress1 != null ? + new ObjectParameter("sAddress1", sAddress1) : + new ObjectParameter("sAddress1", typeof(string)); + + var sAddress2Parameter = sAddress2 != null ? + new ObjectParameter("sAddress2", sAddress2) : + new ObjectParameter("sAddress2", typeof(string)); + + var sCityParameter = sCity != null ? + new ObjectParameter("sCity", sCity) : + new ObjectParameter("sCity", typeof(string)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var sPhoneParameter = sPhone != null ? + new ObjectParameter("sPhone", sPhone) : + new ObjectParameter("sPhone", typeof(string)); + + var sEmailIdParameter = sEmailId != null ? + new ObjectParameter("sEmailId", sEmailId) : + new ObjectParameter("sEmailId", typeof(string)); + + var iTotalLoginsParameter = iTotalLogins.HasValue ? + new ObjectParameter("iTotalLogins", iTotalLogins) : + new ObjectParameter("iTotalLogins", typeof(int)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var sMasterIPParameter = sMasterIP != null ? + new ObjectParameter("sMasterIP", sMasterIP) : + new ObjectParameter("sMasterIP", typeof(string)); + + var sEditionListParameter = sEditionList != null ? + new ObjectParameter("sEditionList", sEditionList) : + new ObjectParameter("sEditionList", typeof(string)); + + var iPriceParameter = iPrice.HasValue ? + new ObjectParameter("iPrice", iPrice) : + new ObjectParameter("iPrice", typeof(decimal)); + + var sProductKeyParameter = sProductKey != null ? + new ObjectParameter("sProductKey", sProductKey) : + new ObjectParameter("sProductKey", typeof(string)); + + var sSiteIPToParameter = sSiteIPTo != null ? + new ObjectParameter("sSiteIPTo", sSiteIPTo) : + new ObjectParameter("sSiteIPTo", typeof(string)); + + var sSiteMasterIPToParameter = sSiteMasterIPTo != null ? + new ObjectParameter("sSiteMasterIPTo", sSiteMasterIPTo) : + new ObjectParameter("sSiteMasterIPTo", typeof(string)); + + var iNoofImagesParameter = iNoofImages.HasValue ? + new ObjectParameter("iNoofImages", iNoofImages) : + new ObjectParameter("iNoofImages", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertNewLicenseAccount", sAccountNumberParameter, sLicenseeFnameParameter, sLicenseeLnameParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sInstitutionNameParameter, sAddress1Parameter, sAddress2Parameter, sCityParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, sPhoneParameter, sEmailIdParameter, iTotalLoginsParameter, sStartDateParameter, sEndDateParameter, sMasterIPParameter, sEditionListParameter, iPriceParameter, sProductKeyParameter, sSiteIPToParameter, sSiteMasterIPToParameter, iNoofImagesParameter); + } + + public virtual ObjectResult usp_InsertSingleLicenseAccount(string sAccountNumber, string sLicenseeFname, string sLicenseeLname, Nullable iAccountTypeId, string sInstitutionName, string sAddress1, string sAddress2, string sCity, string sZip, Nullable iStateId, Nullable iCountryId, string sPhone, string sEmailId, Nullable iTotalLogins, string sStartDate, string sEndDate, string sEditionList, Nullable iPrice, string sProductKey, string sLoginId, string sPassword, Nullable iSecurityQuesId, string sSecurityAnswer, Nullable iCreatorId, Nullable iNoofImages) + { + var sAccountNumberParameter = sAccountNumber != null ? + new ObjectParameter("sAccountNumber", sAccountNumber) : + new ObjectParameter("sAccountNumber", typeof(string)); + + var sLicenseeFnameParameter = sLicenseeFname != null ? + new ObjectParameter("sLicenseeFname", sLicenseeFname) : + new ObjectParameter("sLicenseeFname", typeof(string)); + + var sLicenseeLnameParameter = sLicenseeLname != null ? + new ObjectParameter("sLicenseeLname", sLicenseeLname) : + new ObjectParameter("sLicenseeLname", typeof(string)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var sInstitutionNameParameter = sInstitutionName != null ? + new ObjectParameter("sInstitutionName", sInstitutionName) : + new ObjectParameter("sInstitutionName", typeof(string)); + + var sAddress1Parameter = sAddress1 != null ? + new ObjectParameter("sAddress1", sAddress1) : + new ObjectParameter("sAddress1", typeof(string)); + + var sAddress2Parameter = sAddress2 != null ? + new ObjectParameter("sAddress2", sAddress2) : + new ObjectParameter("sAddress2", typeof(string)); + + var sCityParameter = sCity != null ? + new ObjectParameter("sCity", sCity) : + new ObjectParameter("sCity", typeof(string)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var sPhoneParameter = sPhone != null ? + new ObjectParameter("sPhone", sPhone) : + new ObjectParameter("sPhone", typeof(string)); + + var sEmailIdParameter = sEmailId != null ? + new ObjectParameter("sEmailId", sEmailId) : + new ObjectParameter("sEmailId", typeof(string)); + + var iTotalLoginsParameter = iTotalLogins.HasValue ? + new ObjectParameter("iTotalLogins", iTotalLogins) : + new ObjectParameter("iTotalLogins", typeof(int)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var sEditionListParameter = sEditionList != null ? + new ObjectParameter("sEditionList", sEditionList) : + new ObjectParameter("sEditionList", typeof(string)); + + var iPriceParameter = iPrice.HasValue ? + new ObjectParameter("iPrice", iPrice) : + new ObjectParameter("iPrice", typeof(decimal)); + + var sProductKeyParameter = sProductKey != null ? + new ObjectParameter("sProductKey", sProductKey) : + new ObjectParameter("sProductKey", typeof(string)); + + var sLoginIdParameter = sLoginId != null ? + new ObjectParameter("sLoginId", sLoginId) : + new ObjectParameter("sLoginId", typeof(string)); + + var sPasswordParameter = sPassword != null ? + new ObjectParameter("sPassword", sPassword) : + new ObjectParameter("sPassword", typeof(string)); + + var iSecurityQuesIdParameter = iSecurityQuesId.HasValue ? + new ObjectParameter("iSecurityQuesId", iSecurityQuesId) : + new ObjectParameter("iSecurityQuesId", typeof(byte)); + + var sSecurityAnswerParameter = sSecurityAnswer != null ? + new ObjectParameter("sSecurityAnswer", sSecurityAnswer) : + new ObjectParameter("sSecurityAnswer", typeof(string)); + + var iCreatorIdParameter = iCreatorId.HasValue ? + new ObjectParameter("iCreatorId", iCreatorId) : + new ObjectParameter("iCreatorId", typeof(int)); + + var iNoofImagesParameter = iNoofImages.HasValue ? + new ObjectParameter("iNoofImages", iNoofImages) : + new ObjectParameter("iNoofImages", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertSingleLicenseAccount", sAccountNumberParameter, sLicenseeFnameParameter, sLicenseeLnameParameter, iAccountTypeIdParameter, sInstitutionNameParameter, sAddress1Parameter, sAddress2Parameter, sCityParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, sPhoneParameter, sEmailIdParameter, iTotalLoginsParameter, sStartDateParameter, sEndDateParameter, sEditionListParameter, iPriceParameter, sProductKeyParameter, sLoginIdParameter, sPasswordParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iNoofImagesParameter); + } + + public virtual ObjectResult usp_InsertTestLicenseAccount(string sAccountNumber, string sLicenseeFname, string sLicenseeLname, string sLoginId, string sPassword, string sEmailId, Nullable iAccountTypeId, Nullable iEditionId, string sAddress, string sCity, string sZip, Nullable iStateId, Nullable iCountryId, string sPhone, string sStartDate, string sEndDate, Nullable iCreatorId, Nullable iNoofImages) + { + var sAccountNumberParameter = sAccountNumber != null ? + new ObjectParameter("sAccountNumber", sAccountNumber) : + new ObjectParameter("sAccountNumber", typeof(string)); + + var sLicenseeFnameParameter = sLicenseeFname != null ? + new ObjectParameter("sLicenseeFname", sLicenseeFname) : + new ObjectParameter("sLicenseeFname", typeof(string)); + + var sLicenseeLnameParameter = sLicenseeLname != null ? + new ObjectParameter("sLicenseeLname", sLicenseeLname) : + new ObjectParameter("sLicenseeLname", typeof(string)); + + var sLoginIdParameter = sLoginId != null ? + new ObjectParameter("sLoginId", sLoginId) : + new ObjectParameter("sLoginId", typeof(string)); + + var sPasswordParameter = sPassword != null ? + new ObjectParameter("sPassword", sPassword) : + new ObjectParameter("sPassword", typeof(string)); + + var sEmailIdParameter = sEmailId != null ? + new ObjectParameter("sEmailId", sEmailId) : + new ObjectParameter("sEmailId", typeof(string)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var iEditionIdParameter = iEditionId.HasValue ? + new ObjectParameter("iEditionId", iEditionId) : + new ObjectParameter("iEditionId", typeof(byte)); + + var sAddressParameter = sAddress != null ? + new ObjectParameter("sAddress", sAddress) : + new ObjectParameter("sAddress", typeof(string)); + + var sCityParameter = sCity != null ? + new ObjectParameter("sCity", sCity) : + new ObjectParameter("sCity", typeof(string)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var sPhoneParameter = sPhone != null ? + new ObjectParameter("sPhone", sPhone) : + new ObjectParameter("sPhone", typeof(string)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var iCreatorIdParameter = iCreatorId.HasValue ? + new ObjectParameter("iCreatorId", iCreatorId) : + new ObjectParameter("iCreatorId", typeof(int)); + + var iNoofImagesParameter = iNoofImages.HasValue ? + new ObjectParameter("iNoofImages", iNoofImages) : + new ObjectParameter("iNoofImages", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertTestLicenseAccount", sAccountNumberParameter, sLicenseeFnameParameter, sLicenseeLnameParameter, sLoginIdParameter, sPasswordParameter, sEmailIdParameter, iAccountTypeIdParameter, iEditionIdParameter, sAddressParameter, sCityParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, sPhoneParameter, sStartDateParameter, sEndDateParameter, iCreatorIdParameter, iNoofImagesParameter); + } + + public virtual ObjectResult usp_UpdateLicenseAccount(Nullable iLicenseId, string sLicenseeFname, string sLicenseeLname, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sInstitutionName, string sAddress1, string sAddress2, string sCity, string sZip, Nullable iStateId, Nullable iCountryId, string sPhone, string sEmailId, Nullable iIsActive, Nullable iTotalLogins, Nullable iIsRennew, string sStartDate, string sEndDate, string sRenewDate, string sMasterIP, string sEditionList, Nullable iPrice, string sProductKey, string sSiteIPTo, string sSiteMasterIPTo, Nullable iNoofImages) + { + var iLicenseIdParameter = iLicenseId.HasValue ? + new ObjectParameter("iLicenseId", iLicenseId) : + new ObjectParameter("iLicenseId", typeof(int)); + + var sLicenseeFnameParameter = sLicenseeFname != null ? + new ObjectParameter("sLicenseeFname", sLicenseeFname) : + new ObjectParameter("sLicenseeFname", typeof(string)); + + var sLicenseeLnameParameter = sLicenseeLname != null ? + new ObjectParameter("sLicenseeLname", sLicenseeLname) : + new ObjectParameter("sLicenseeLname", typeof(string)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(byte)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var sInstitutionNameParameter = sInstitutionName != null ? + new ObjectParameter("sInstitutionName", sInstitutionName) : + new ObjectParameter("sInstitutionName", typeof(string)); + + var sAddress1Parameter = sAddress1 != null ? + new ObjectParameter("sAddress1", sAddress1) : + new ObjectParameter("sAddress1", typeof(string)); + + var sAddress2Parameter = sAddress2 != null ? + new ObjectParameter("sAddress2", sAddress2) : + new ObjectParameter("sAddress2", typeof(string)); + + var sCityParameter = sCity != null ? + new ObjectParameter("sCity", sCity) : + new ObjectParameter("sCity", typeof(string)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var sPhoneParameter = sPhone != null ? + new ObjectParameter("sPhone", sPhone) : + new ObjectParameter("sPhone", typeof(string)); + + var sEmailIdParameter = sEmailId != null ? + new ObjectParameter("sEmailId", sEmailId) : + new ObjectParameter("sEmailId", typeof(string)); + + var iIsActiveParameter = iIsActive.HasValue ? + new ObjectParameter("iIsActive", iIsActive) : + new ObjectParameter("iIsActive", typeof(byte)); + + var iTotalLoginsParameter = iTotalLogins.HasValue ? + new ObjectParameter("iTotalLogins", iTotalLogins) : + new ObjectParameter("iTotalLogins", typeof(int)); + + var iIsRennewParameter = iIsRennew.HasValue ? + new ObjectParameter("iIsRennew", iIsRennew) : + new ObjectParameter("iIsRennew", typeof(byte)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var sRenewDateParameter = sRenewDate != null ? + new ObjectParameter("sRenewDate", sRenewDate) : + new ObjectParameter("sRenewDate", typeof(string)); + + var sMasterIPParameter = sMasterIP != null ? + new ObjectParameter("sMasterIP", sMasterIP) : + new ObjectParameter("sMasterIP", typeof(string)); + + var sEditionListParameter = sEditionList != null ? + new ObjectParameter("sEditionList", sEditionList) : + new ObjectParameter("sEditionList", typeof(string)); + + var iPriceParameter = iPrice.HasValue ? + new ObjectParameter("iPrice", iPrice) : + new ObjectParameter("iPrice", typeof(decimal)); + + var sProductKeyParameter = sProductKey != null ? + new ObjectParameter("sProductKey", sProductKey) : + new ObjectParameter("sProductKey", typeof(string)); + + var sSiteIPToParameter = sSiteIPTo != null ? + new ObjectParameter("sSiteIPTo", sSiteIPTo) : + new ObjectParameter("sSiteIPTo", typeof(string)); + + var sSiteMasterIPToParameter = sSiteMasterIPTo != null ? + new ObjectParameter("sSiteMasterIPTo", sSiteMasterIPTo) : + new ObjectParameter("sSiteMasterIPTo", typeof(string)); + + var iNoofImagesParameter = iNoofImages.HasValue ? + new ObjectParameter("iNoofImages", iNoofImages) : + new ObjectParameter("iNoofImages", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateLicenseAccount", iLicenseIdParameter, sLicenseeFnameParameter, sLicenseeLnameParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sInstitutionNameParameter, sAddress1Parameter, sAddress2Parameter, sCityParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, sPhoneParameter, sEmailIdParameter, iIsActiveParameter, iTotalLoginsParameter, iIsRennewParameter, sStartDateParameter, sEndDateParameter, sRenewDateParameter, sMasterIPParameter, sEditionListParameter, iPriceParameter, sProductKeyParameter, sSiteIPToParameter, sSiteMasterIPToParameter, iNoofImagesParameter); + } + + public virtual ObjectResult usp_GetDiscountCodes(string sDiscountCode, string sStartDate, string sEndDate, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sDiscountCodeParameter = sDiscountCode != null ? + new ObjectParameter("sDiscountCode", sDiscountCode) : + new ObjectParameter("sDiscountCode", typeof(string)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetDiscountCodes", sDiscountCodeParameter, sStartDateParameter, sEndDateParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_InsertNewDiscount(Nullable dPercentage, string sStartDate, string sEndDate, string sDiscountCode) + { + var dPercentageParameter = dPercentage.HasValue ? + new ObjectParameter("dPercentage", dPercentage) : + new ObjectParameter("dPercentage", typeof(decimal)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var sDiscountCodeParameter = sDiscountCode != null ? + new ObjectParameter("sDiscountCode", sDiscountCode) : + new ObjectParameter("sDiscountCode", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertNewDiscount", dPercentageParameter, sStartDateParameter, sEndDateParameter, sDiscountCodeParameter); + } + + public virtual ObjectResult usp_UpdateDiscount(Nullable iDiscountId, Nullable dPercentage, string sStartDate, string sEndDate, Nullable iActive, string sDiscountCode) + { + var iDiscountIdParameter = iDiscountId.HasValue ? + new ObjectParameter("iDiscountId", iDiscountId) : + new ObjectParameter("iDiscountId", typeof(int)); + + var dPercentageParameter = dPercentage.HasValue ? + new ObjectParameter("dPercentage", dPercentage) : + new ObjectParameter("dPercentage", typeof(decimal)); + + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var iActiveParameter = iActive.HasValue ? + new ObjectParameter("iActive", iActive) : + new ObjectParameter("iActive", typeof(byte)); + + var sDiscountCodeParameter = sDiscountCode != null ? + new ObjectParameter("sDiscountCode", sDiscountCode) : + new ObjectParameter("sDiscountCode", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateDiscount", iDiscountIdParameter, dPercentageParameter, sStartDateParameter, sEndDateParameter, iActiveParameter, sDiscountCodeParameter); + } + + public virtual ObjectResult usp_EC_GetCountryList() + { + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_EC_GetCountryList"); + } + + public virtual ObjectResult usp_EC_GetStateList() + { + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_EC_GetStateList"); + } + + public virtual ObjectResult usp_EC_GetSecurityQuestionList() + { + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_EC_GetSecurityQuestionList"); + } + + public virtual ObjectResult usp_GetCancelledLicenses(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sZip, Nullable iStateId, Nullable iCountryId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var iStartPriceParameter = iStartPrice.HasValue ? + new ObjectParameter("iStartPrice", iStartPrice) : + new ObjectParameter("iStartPrice", typeof(decimal)); + + var iEndPriceParameter = iEndPrice.HasValue ? + new ObjectParameter("iEndPrice", iEndPrice) : + new ObjectParameter("iEndPrice", typeof(decimal)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(byte)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetCancelledLicenses", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetCustomerSummary(string sAccoutNumber, string sLicenseeFullName, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseType, Nullable iAccountType, string sZip, Nullable iState, Nullable iCountry, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var sLicenseeFullNameParameter = sLicenseeFullName != null ? + new ObjectParameter("sLicenseeFullName", sLicenseeFullName) : + new ObjectParameter("sLicenseeFullName", typeof(string)); + + var iStartPriceParameter = iStartPrice.HasValue ? + new ObjectParameter("iStartPrice", iStartPrice) : + new ObjectParameter("iStartPrice", typeof(decimal)); + + var iEndPriceParameter = iEndPrice.HasValue ? + new ObjectParameter("iEndPrice", iEndPrice) : + new ObjectParameter("iEndPrice", typeof(decimal)); + + var iLicenseTypeParameter = iLicenseType.HasValue ? + new ObjectParameter("iLicenseType", iLicenseType) : + new ObjectParameter("iLicenseType", typeof(byte)); + + var iAccountTypeParameter = iAccountType.HasValue ? + new ObjectParameter("iAccountType", iAccountType) : + new ObjectParameter("iAccountType", typeof(byte)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateParameter = iState.HasValue ? + new ObjectParameter("iState", iState) : + new ObjectParameter("iState", typeof(int)); + + var iCountryParameter = iCountry.HasValue ? + new ObjectParameter("iCountry", iCountry) : + new ObjectParameter("iCountry", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetCustomerSummary", sAccoutNumberParameter, sLicenseeFullNameParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeParameter, iAccountTypeParameter, sZipParameter, iStateParameter, iCountryParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetDiscountReport(string sStartDate, string sEndDate, Nullable intDiscountID, string sAccoutNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var intDiscountIDParameter = intDiscountID.HasValue ? + new ObjectParameter("intDiscountID", intDiscountID) : + new ObjectParameter("intDiscountID", typeof(int)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetDiscountReport", sStartDateParameter, sEndDateParameter, intDiscountIDParameter, sAccoutNumberParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetExpiringLicenses(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sZip, Nullable iStateId, Nullable iCountryId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var iStartPriceParameter = iStartPrice.HasValue ? + new ObjectParameter("iStartPrice", iStartPrice) : + new ObjectParameter("iStartPrice", typeof(decimal)); + + var iEndPriceParameter = iEndPrice.HasValue ? + new ObjectParameter("iEndPrice", iEndPrice) : + new ObjectParameter("iEndPrice", typeof(decimal)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(int)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(int)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetExpiringLicenses", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetExportedImageDetails(string sStartDate, string sEndDate, string sAccoutNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sStartDateParameter = sStartDate != null ? + new ObjectParameter("sStartDate", sStartDate) : + new ObjectParameter("sStartDate", typeof(string)); + + var sEndDateParameter = sEndDate != null ? + new ObjectParameter("sEndDate", sEndDate) : + new ObjectParameter("sEndDate", typeof(string)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetExportedImageDetails", sStartDateParameter, sEndDateParameter, sAccoutNumberParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetNetAdSummaryReport(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var iStartPriceParameter = iStartPrice.HasValue ? + new ObjectParameter("iStartPrice", iStartPrice) : + new ObjectParameter("iStartPrice", typeof(decimal)); + + var iEndPriceParameter = iEndPrice.HasValue ? + new ObjectParameter("iEndPrice", iEndPrice) : + new ObjectParameter("iEndPrice", typeof(decimal)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(byte)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetNetAdSummaryReport", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccoutNumber, Nullable iEditionId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var iEditionIdParameter = iEditionId.HasValue ? + new ObjectParameter("iEditionId", iEditionId) : + new ObjectParameter("iEditionId", typeof(byte)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSiteLicenseUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, iEditionIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, Nullable iState, Nullable iCountry, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateParameter = iState.HasValue ? + new ObjectParameter("iState", iState) : + new ObjectParameter("iState", typeof(int)); + + var iCountryParameter = iCountry.HasValue ? + new ObjectParameter("iCountry", iCountry) : + new ObjectParameter("iCountry", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, sZipParameter, iStateParameter, iCountryParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetSearchUsers(string sFirstName, string sLastName, string sEmailId, string sAccoutNumber, Nullable iUserTypeId, Nullable iAccountTypeId, Nullable iLoginUserType, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFirstNameParameter = sFirstName != null ? + new ObjectParameter("sFirstName", sFirstName) : + new ObjectParameter("sFirstName", typeof(string)); + + var sLastNameParameter = sLastName != null ? + new ObjectParameter("sLastName", sLastName) : + new ObjectParameter("sLastName", typeof(string)); + + var sEmailIdParameter = sEmailId != null ? + new ObjectParameter("sEmailId", sEmailId) : + new ObjectParameter("sEmailId", typeof(string)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var iUserTypeIdParameter = iUserTypeId.HasValue ? + new ObjectParameter("iUserTypeId", iUserTypeId) : + new ObjectParameter("iUserTypeId", typeof(int)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(int)); + + var iLoginUserTypeParameter = iLoginUserType.HasValue ? + new ObjectParameter("iLoginUserType", iLoginUserType) : + new ObjectParameter("iLoginUserType", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSearchUsers", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetSiteLicenseUsageReports(string sFromDate, string sToDate, string sAccoutNumber, Nullable iEditionId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var sAccoutNumberParameter = sAccoutNumber != null ? + new ObjectParameter("sAccoutNumber", sAccoutNumber) : + new ObjectParameter("sAccoutNumber", typeof(string)); + + var iEditionIdParameter = iEditionId.HasValue ? + new ObjectParameter("iEditionId", iEditionId) : + new ObjectParameter("iEditionId", typeof(byte)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSiteLicenseUsageReports", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, iEditionIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetUserTyeByAccountNumber(Nullable iUserTypeId, Nullable iLicenseId) + { + var iUserTypeIdParameter = iUserTypeId.HasValue ? + new ObjectParameter("iUserTypeId", iUserTypeId) : + new ObjectParameter("iUserTypeId", typeof(byte)); + + var iLicenseIdParameter = iLicenseId.HasValue ? + new ObjectParameter("iLicenseId", iLicenseId) : + new ObjectParameter("iLicenseId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetUserTyeByAccountNumber", iUserTypeIdParameter, iLicenseIdParameter); + } + + public virtual ObjectResult usp_GetSubscribedLicenses(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sZip, Nullable iStateId, Nullable iCountryId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) + { + var sFromDateParameter = sFromDate != null ? + new ObjectParameter("sFromDate", sFromDate) : + new ObjectParameter("sFromDate", typeof(string)); + + var sToDateParameter = sToDate != null ? + new ObjectParameter("sToDate", sToDate) : + new ObjectParameter("sToDate", typeof(string)); + + var iStartPriceParameter = iStartPrice.HasValue ? + new ObjectParameter("iStartPrice", iStartPrice) : + new ObjectParameter("iStartPrice", typeof(decimal)); + + var iEndPriceParameter = iEndPrice.HasValue ? + new ObjectParameter("iEndPrice", iEndPrice) : + new ObjectParameter("iEndPrice", typeof(decimal)); + + var iLicenseTypeIdParameter = iLicenseTypeId.HasValue ? + new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : + new ObjectParameter("iLicenseTypeId", typeof(byte)); + + var iAccountTypeIdParameter = iAccountTypeId.HasValue ? + new ObjectParameter("iAccountTypeId", iAccountTypeId) : + new ObjectParameter("iAccountTypeId", typeof(byte)); + + var sZipParameter = sZip != null ? + new ObjectParameter("sZip", sZip) : + new ObjectParameter("sZip", typeof(string)); + + var iStateIdParameter = iStateId.HasValue ? + new ObjectParameter("iStateId", iStateId) : + new ObjectParameter("iStateId", typeof(int)); + + var iCountryIdParameter = iCountryId.HasValue ? + new ObjectParameter("iCountryId", iCountryId) : + new ObjectParameter("iCountryId", typeof(int)); + + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetSubscribedLicenses", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, pageNoParameter, pageLengthParameter, recordCount); + } + + public virtual ObjectResult usp_GetBlockedUserByAccNoAndType(Nullable iUserTypeId, Nullable iLicenseId) + { + var iUserTypeIdParameter = iUserTypeId.HasValue ? + new ObjectParameter("iUserTypeId", iUserTypeId) : + new ObjectParameter("iUserTypeId", typeof(byte)); + + var iLicenseIdParameter = iLicenseId.HasValue ? + new ObjectParameter("iLicenseId", iLicenseId) : + new ObjectParameter("iLicenseId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetBlockedUserByAccNoAndType", iUserTypeIdParameter, iLicenseIdParameter); + } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index 2a5831d..dd3e2b5 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -2674,6 +2674,9 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + @@ -2688,13 +2691,88 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2737,22 +2815,109 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2777,6 +2942,38 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2800,6 +2997,33 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2809,6 +3033,26 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + @@ -2852,10 +3096,52 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2902,7 +3188,14 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does - + + + + + + + + @@ -6653,255 +6946,548 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7650,27 +8236,264 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap] - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - + + @@ -10042,144 +10865,451 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap] - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + + + + - + + + + + - + - - - - + + + + + - - + + + - - - - + + + - + - - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + + + + + + + + + + + + + - - - + - - + + + - + + + + + + + - + + - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + - - + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + - + - - + + @@ -10198,33 +11328,60 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap] - - + - - + + + + + + + + + + + + + + + - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetAccountTypeList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetAccountTypeList_Result.cs new file mode 100644 index 0000000..18c7777 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetAccountTypeList_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_EC_GetAccountTypeList_Result + { + public byte Id { get; set; } + public string Title { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetCountryList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetCountryList_Result.cs new file mode 100644 index 0000000..b280f06 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetCountryList_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_EC_GetCountryList_Result + { + public int Id { get; set; } + public string CountryName { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetSecurityQuestionList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetSecurityQuestionList_Result.cs new file mode 100644 index 0000000..c681359 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetSecurityQuestionList_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_EC_GetSecurityQuestionList_Result + { + public byte Id { get; set; } + public string Title { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetStateList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetStateList_Result.cs new file mode 100644 index 0000000..0e5966e --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_EC_GetStateList_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_EC_GetStateList_Result + { + public int Id { get; set; } + public string StateName { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetBlockedUserByAccNoAndType_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetBlockedUserByAccNoAndType_Result.cs new file mode 100644 index 0000000..85c9d8b --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetBlockedUserByAccNoAndType_Result.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetBlockedUserByAccNoAndType_Result + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string LoginId { get; set; } + public string Password { get; set; } + public string EmailId { get; set; } + public string AccountNumber { get; set; } + public Nullable LoginTime { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCancelledLicenses_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCancelledLicenses_Result.cs new file mode 100644 index 0000000..144e9c7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCancelledLicenses_Result.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetCancelledLicenses_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string LicenseeName { get; set; } + public string LicenseType { get; set; } + public string InstitutionName { get; set; } + public string AccountType { get; set; } + public string Edition { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable SubscriptionPrice { get; set; } + public Nullable CardNumber { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCustomerSummary_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCustomerSummary_Result.cs new file mode 100644 index 0000000..ba1a770 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetCustomerSummary_Result.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetCustomerSummary_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string LicenseeName { get; set; } + public string LicenseType { get; set; } + public string AccountType { get; set; } + public string Edition { get; set; } + public string Email { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string LicenseStatus { get; set; } + public Nullable Price { get; set; } + public string LicenseZip { get; set; } + public string LicenseState { get; set; } + public string LicenseCountry { get; set; } + public string InstitutionName { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable CardNumber { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountCodes_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountCodes_Result.cs new file mode 100644 index 0000000..36b4aa7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountCodes_Result.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetDiscountCodes_Result + { + public int Id { get; set; } + public string DiscountCode { get; set; } + public decimal Percentage { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string Status { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountReport_Result.cs new file mode 100644 index 0000000..795e3e7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetDiscountReport_Result.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetDiscountReport_Result + { + public Nullable RowNum { get; set; } + public string DiscountCode { get; set; } + public decimal Percentage { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string DiscountStatus { get; set; } + public Nullable TotalLicenses { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExpiringLicenses_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExpiringLicenses_Result.cs new file mode 100644 index 0000000..7f5d4ef --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExpiringLicenses_Result.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetExpiringLicenses_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string LicenseeName { get; set; } + public string LicenseType { get; set; } + public string InstitutionName { get; set; } + public string Edition { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable SubscriptionPrice { get; set; } + public string AccountType { get; set; } + public Nullable DaysRemaining { get; set; } + public Nullable CardNumber { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExportedImageDetails_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExportedImageDetails_Result.cs new file mode 100644 index 0000000..ba8fa65 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetExportedImageDetails_Result.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetExportedImageDetails_Result + { + public Nullable RowNum { get; set; } + public int LicenseId { get; set; } + public System.DateTime ExportedDate { get; set; } + public string ImageName { get; set; } + public string AccountNumber { get; set; } + public string OriginalFileName { get; set; } + public string Title { get; set; } + public string ModuleName { get; set; } + public Nullable ExportLimit { get; set; } + public string UserName { get; set; } + public Nullable imageCount { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetModuleStatusByLicenseId_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetModuleStatusByLicenseId_Result.cs new file mode 100644 index 0000000..dd24734 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetModuleStatusByLicenseId_Result.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetModuleStatusByLicenseId_Result + { + public int Id { get; set; } + public string Title { get; set; } + public bool Status { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetNetAdSummaryReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetNetAdSummaryReport_Result.cs new file mode 100644 index 0000000..4a5bf58 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetNetAdSummaryReport_Result.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetNetAdSummaryReport_Result + { + public Nullable RowNum { get; set; } + public string LicenseType { get; set; } + public string AccountType { get; set; } + public string InstitutionName { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable ActiveSubscription { get; set; } + public Nullable RenewSubscription { get; set; } + public Nullable InActiveSubscription { get; set; } + public Nullable NetAdSubscription { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSearchUsers_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSearchUsers_Result.cs new file mode 100644 index 0000000..459eb48 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSearchUsers_Result.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSearchUsers_Result + { + public Nullable RowNum { get; set; } + public Nullable Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string LoginId { get; set; } + public string EmailId { get; set; } + public string UserTypeTitle { get; set; } + public string Password { get; set; } + public Nullable CreationDate { get; set; } + public Nullable ModifiedDate { get; set; } + public string AccountNumber { get; set; } + public string AccountTypeTitle { get; set; } + public string EditionType { get; set; } + public string UserStatus { get; set; } + public Nullable UserTypeId { get; set; } + public Nullable EditionTypeId { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountAdmin_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountAdmin_Result.cs new file mode 100644 index 0000000..b0e3b69 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountAdmin_Result.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSiteAccountAdmin_Result + { + public int Id { get; set; } + public string Password { get; set; } + public string LoginId { get; set; } + public string FirstName { get; set; } + public byte UserTypeId { get; set; } + public string LastName { get; set; } + public string EmailId { get; set; } + public Nullable IsActive { get; set; } + public Nullable SecurityQuestionId { get; set; } + public string SecurityAnswer { get; set; } + public Nullable CreatorId { get; set; } + public System.DateTime CreationDate { get; set; } + public Nullable ModifierId { get; set; } + public Nullable ModifiedDate { get; set; } + public Nullable DeactivationDate { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountSites_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountSites_Result.cs new file mode 100644 index 0000000..8510c4b --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccountSites_Result.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSiteAccountSites_Result + { + public int Id { get; set; } + public string SiteIp { get; set; } + public string Title { get; set; } + public string SiteIPTo { get; set; } + public string SiteMasterIPTo { get; set; } + public string CreationDate { get; set; } + public string ModifiedDate { get; set; } + public string InstituteName { get; set; } + public string Department { get; set; } + public int UserId { get; set; } + public string FirstName { get; set; } + public string EmailId { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccoutDetail_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccoutDetail_Result.cs new file mode 100644 index 0000000..449e53a --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteAccoutDetail_Result.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSiteAccoutDetail_Result + { + public int Id { get; set; } + public string SiteIp { get; set; } + public string Title { get; set; } + public string SiteIPTo { get; set; } + public string SiteMasterIPTo { get; set; } + public string CreationDate { get; set; } + public string ModifiedDate { get; set; } + public string InstituteName { get; set; } + public string Department { get; set; } + public int UserId { get; set; } + public string FirstName { get; set; } + public string EmailId { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReport_Result.cs new file mode 100644 index 0000000..6cac4b1 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReport_Result.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSiteLicenseUsageReport_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string EditionTitle { get; set; } + public string ReferalUrl { get; set; } + public string InstitutionName { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable TotalLogins { get; set; } + public string LastLogin { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReports_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReports_Result.cs new file mode 100644 index 0000000..dba6cba --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSiteLicenseUsageReports_Result.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSiteLicenseUsageReports_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string EditionTitle { get; set; } + public string ReferalUrl { get; set; } + public string InstitutionName { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable TotalLogins { get; set; } + public string LastLogin { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSubscribedLicenses_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSubscribedLicenses_Result.cs new file mode 100644 index 0000000..d592155 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetSubscribedLicenses_Result.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetSubscribedLicenses_Result + { + public Nullable RowNum { get; set; } + public string AccountNumber { get; set; } + public string LicenseeName { get; set; } + public string LicenseType { get; set; } + public string InstitutionName { get; set; } + public string AccountType { get; set; } + public string Edition { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } + public string LicenseCreationDate { get; set; } + public Nullable SubscriptionPrice { get; set; } + public Nullable CardNumber { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsageReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsageReport_Result.cs new file mode 100644 index 0000000..a569219 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsageReport_Result.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetUsageReport_Result + { + public Nullable RowNum { get; set; } + public string LoginId { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string AccountNumber { get; set; } + public Nullable CardNumber { get; set; } + public string UserType { get; set; } + public string LicenseCreationDate { get; set; } + public string LicenseZip { get; set; } + public string LicenseState { get; set; } + public string LicenseCountry { get; set; } + public string InstitutionName { get; set; } + public Nullable TotalLogins { get; set; } + public string LastLogin { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUserTyeByAccountNumber_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUserTyeByAccountNumber_Result.cs new file mode 100644 index 0000000..47471ab --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUserTyeByAccountNumber_Result.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class usp_GetUserTyeByAccountNumber_Result + { + public Nullable Id { get; set; } + public string Title { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/AccountModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/AccountModel.cs index c42ee51..2049cd4 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/AccountModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/AccountModel.cs @@ -19,7 +19,7 @@ namespace AIAHTML5.ADMIN.API.Models AccountTypeEntityModel AccountTypeModelObj = new AccountTypeEntityModel(); try { - var result = dbContext.EC_GetAccountTypeList().ToList(); + var result = dbContext.usp_EC_GetAccountTypeList().ToList(); if (result.Count > 0) { foreach (var item in result) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/CommonModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/CommonModel.cs index 184b29e..e3a75ea 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/CommonModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/CommonModel.cs @@ -18,7 +18,7 @@ namespace AIAHTML5.ADMIN.API.Models CountryModel CountryModelObj = new CountryModel(); try { - var result = dbContext.EC_GetCountryList().ToList(); + var result = dbContext.usp_EC_GetCountryList().ToList(); if (result.Count > 0) { foreach (var item in result) @@ -47,7 +47,7 @@ namespace AIAHTML5.ADMIN.API.Models StateModel StateModelObj = new StateModel(); try { - var result = dbContext.EC_GetStateList().ToList(); + var result = dbContext.usp_EC_GetStateList().ToList(); if (result.Count > 0) { foreach (var item in result) @@ -75,7 +75,7 @@ namespace AIAHTML5.ADMIN.API.Models SecurityQuestionModel SecurityQuestionObj = new SecurityQuestionModel(); try { - var result = dbContext.EC_GetSecurityQuestionList().ToList(); + var result = dbContext.usp_EC_GetSecurityQuestionList().ToList(); if (result.Count > 0) { foreach (var item in result) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs index 4ef9852..179be65 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs @@ -23,7 +23,7 @@ namespace AIAHTML5.ADMIN.API.Models recordCount = 0; try { - var result = dbContext.GetDiscountCodes(discountCode, startDate.ToString("MM/dd/yyyy"), endDate.ToString("MM/dd/yyyy"), pageNo, pageLength, spRecordCount).ToList(); + var result = dbContext.usp_GetDiscountCodes(discountCode, startDate.ToString("MM/dd/yyyy"), endDate.ToString("MM/dd/yyyy"), pageNo, pageLength, spRecordCount).ToList(); if (result.Count > 0) { foreach (var item in result) @@ -49,7 +49,7 @@ namespace AIAHTML5.ADMIN.API.Models { try { - var result = dbContext.InsertNewDiscount(discountCodeModel.Percentage, discountCodeModel.StartDate.ToString("MM/dd/yyyy"), + var result = dbContext.usp_InsertNewDiscount(discountCodeModel.Percentage, discountCodeModel.StartDate.ToString("MM/dd/yyyy"), discountCodeModel.EndDate.ToString("MM/dd/yyyy"), discountCodeModel.DiscountCode); if (result.Count() > 0) { @@ -70,7 +70,7 @@ namespace AIAHTML5.ADMIN.API.Models { try { - var result = dbContext.UpdateDiscount(discountCodeModel.Id, discountCodeModel.Percentage, discountCodeModel.StartDate.ToString("MM/dd/yyyy"), + var result = dbContext.usp_UpdateDiscount(discountCodeModel.Id, discountCodeModel.Percentage, discountCodeModel.StartDate.ToString("MM/dd/yyyy"), discountCodeModel.EndDate.ToString("MM/dd/yyyy"), (byte?)(discountCodeModel.IsActive == true ? 1 : 0), discountCodeModel.DiscountCode); if (result.Count() > 0) { diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs index d4f361d..e1630bb 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs @@ -181,7 +181,7 @@ namespace AIAHTML5.ADMIN.API.Models recordCount = 0; try { - var result = dbContext.GetSiteAccoutDetail(AccountNo, pageNo, pageLength, spRecordCount).ToList(); + var result = dbContext.usp_GetSiteAccountSites(AccountNo, pageNo, pageLength, spRecordCount).ToList(); if (result.Count > 0) { foreach (var item in result) @@ -198,7 +198,10 @@ namespace AIAHTML5.ADMIN.API.Models SiteModelObj.SiteUserFirstName = item.FirstName; SiteModelObj.Title = item.Title; SiteModelObj.CreationDate = DateTime.ParseExact(item.CreationDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture); - SiteModelObj.ModifiedDate = DateTime.ParseExact(item.ModifiedDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture); + if (!string.IsNullOrEmpty(item.ModifiedDate)) + { + SiteModelObj.ModifiedDate = DateTime.ParseExact(item.ModifiedDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture); + } LicenseSiteList.Add(SiteModelObj); } } @@ -239,7 +242,7 @@ namespace AIAHTML5.ADMIN.API.Models switch (licenseModel.LicenseTypeId) { case 1: - var result = dbContext.InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, + var result = dbContext.usp_InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"), @@ -251,7 +254,7 @@ namespace AIAHTML5.ADMIN.API.Models } break; case 2: - result = dbContext.InsertSingleLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.AccountTypeId, + result = dbContext.usp_InsertSingleLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"), @@ -263,7 +266,7 @@ namespace AIAHTML5.ADMIN.API.Models } break; case 3: - result = dbContext.InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, + result = dbContext.usp_InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"), @@ -286,7 +289,7 @@ namespace AIAHTML5.ADMIN.API.Models } break; case 5: - result = dbContext.InsertTestLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, + result = dbContext.usp_InsertTestLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.LoginId, licenseModel.Password, licenseModel.EmailId, licenseModel.AccountTypeId, licenseModel.TestLicenseEditionId, licenseModel.Address1, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"), @@ -310,7 +313,7 @@ namespace AIAHTML5.ADMIN.API.Models bool status = false; try { - var result = dbContext.UpdateLicenseAccount(licenseModel.LicenseId, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, + var result = dbContext.usp_UpdateLicenseAccount(licenseModel.LicenseId, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, (byte)(licenseModel.IsActive == false ? 0 : 1), licenseModel.TotalLogins, (byte)(licenseModel.IsRenew == false ? 0 : 1), @@ -333,7 +336,7 @@ namespace AIAHTML5.ADMIN.API.Models { try { - var spStatus = dbContext.DeleteLicense(LicenseId); + var spStatus = dbContext.usp_DeleteLicense(LicenseId); if (spStatus.Count() > 0) { return true; @@ -389,7 +392,7 @@ namespace AIAHTML5.ADMIN.API.Models Tuple LicenseModuleStatusObj; try { - var result = dbContext.GetModuleStatusByLicenseId(LicenseId).ToList(); + var result = dbContext.usp_GetModuleStatusByLicenseId(LicenseId).ToList(); if (result.Count > 0) { foreach (var item in result) @@ -430,6 +433,25 @@ namespace AIAHTML5.ADMIN.API.Models return false; } } + public static List> GetLicenseSiteAdmin(AIADatabaseV5Entities dbContext, string AccountNo) + { + List> LicenseSiteAdminList = new List>(); + Tuple SiteAdmin; + try + { + var result = dbContext.usp_GetSiteAccountAdmin(AccountNo).ToList(); + if (result.Count > 0) + { + foreach (var item in result) + { + SiteAdmin = new Tuple(item.Id, item.FirstName + " " + item.LastName, item.EmailId); + LicenseSiteAdminList.Add(SiteAdmin); + } + } + } + catch (Exception ex) { } + return LicenseSiteAdminList; + } } public class LicenseTypeModel diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SharedModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SharedModel.cs index c4a3292..b2386c9 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SharedModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SharedModel.cs @@ -25,7 +25,7 @@ namespace AIAHTML5.ADMIN.API.Models AccountTypeModel AccountTypeModelObj = new AccountTypeModel(); try { - var result = dbContext.EC_GetAccountTypeList().ToList(); + var result = dbContext.usp_EC_GetAccountTypeList().ToList(); if (result.Count > 0) { foreach (var item in result) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 5b33483..02681c6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -35,7 +35,7 @@ namespace AIAHTML5.ADMIN.API.Models var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); try { - dbContext.UpdateUserProfile(intUserID, strFirstName, strLastName, strEmailID, spStatus); + dbContext.usp_UpdateUserProfile(intUserID, strFirstName, strLastName, strEmailID, spStatus); if (spStatus.Value.ToString() == "1") { return true; @@ -55,7 +55,7 @@ namespace AIAHTML5.ADMIN.API.Models var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); try { - dbContext.UpdateAiaUserPassword(intUserID, newPassword, spStatus); + dbContext.usp_UpdateAiaUserPassword(intUserID, newPassword, spStatus); return (bool)spStatus.Value; } catch (Exception ex) diff --git a/400-SOURCECODE/Admin/src/app/app.component.html b/400-SOURCECODE/Admin/src/app/app.component.html index ce80843..f0c979d 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.html +++ b/400-SOURCECODE/Admin/src/app/app.component.html @@ -29,7 +29,15 @@
@@ -343,7 +349,7 @@
-
-
+ - + +
+ + +
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts index cf9e3f8..513b898 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts @@ -29,8 +29,11 @@ export class AddUser implements OnInit { emailPattern = "^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"; public UserTypeList: any; public AccountNumberList: any; + tempLstAccountNumbers: any; public ProductEditionList: any; modalTitle: string; + accountDropDownText: string; + loopIdx: number; //@ViewChild("profileModal") //profileModal: ModalComponent; //errorMessage: any; @@ -42,6 +45,8 @@ export class AddUser implements OnInit { this.user = new User(); this.alerts = ''; + this.accountDropDownText = 'Select'; + this.loopIdx = 0; //this.userservice.GetUserById(this.UserId); this.adduserFrm = this.fb.group({ id: [''], @@ -74,20 +79,61 @@ export class AddUser implements OnInit { }).subscribe(x => { this.UserTypeList = x; }, error => this.error = error); } GetAccountNumber() { - this.userservice.GetAccountNumber() - .subscribe(x => { console.log(x); this.AccountNumberList=x }, error => this.error = error); + .subscribe(x => { + this.AccountNumberList=x ; + this.tempLstAccountNumbers = []; + this.loopIdx = 0; + for (var i = 0; i < 1000; i++) { + if(this.loopIdx < this.AccountNumberList.length){ + this.tempLstAccountNumbers.push(this.AccountNumberList[this.loopIdx]); + this.loopIdx++; + } + } + }, + error => this.error = error); } + GetProductEdition() { this.userservice.GetProductEdition({ AccountNumberId: this.adduserFrm.controls['AccountNumberId'].value}) .subscribe(x => { console.log(x); this.ProductEditionList=x }, error => this.error = error); } - BindUserTypeAndProductEdition(deviceValue) { - + //BindUserTypeAndProductEdition(deviceValue) { + //this.GetUserTypeByLicenseId(); + //this.GetProductEdition(); + //} + AccountNumberChanged(LicenseId: number, SelectText: string){ + this.accountDropDownText = SelectText; + this.adduserFrm.controls['AccountNumberId'].setValue(LicenseId); this.GetUserTypeByLicenseId(); this.GetProductEdition(); } + + onScroll($event){ + if($event.target.scrollTop >= ($event.target.scrollHeight/2)){ + for (var i = 0; i < 5000; i++) { + if(this.loopIdx < this.AccountNumberList.length){ + this.tempLstAccountNumbers.push(this.AccountNumberList[this.loopIdx]); + this.loopIdx++; + } + } + } +} + +onOpenChange(data: boolean): void { + if(!data){ + this.loopIdx = 0; + this.tempLstAccountNumbers = []; + for (var i = 0; i < 1000; i++) { + if(this.loopIdx < this.AccountNumberList.length){ + this.tempLstAccountNumbers.push(this.AccountNumberList[this.loopIdx]); + this.loopIdx++; + } + } + } +} + public AddUser(this) { this.alerts = ''; if (this.adduserFrm.value.UserName == '') { @@ -108,7 +154,7 @@ export class AddUser implements OnInit { if (this.adduserFrm.value.LastName == '') { this.alerts += '
Last Name is required.'; } - if (this.adduserFrm.value.newPassword != this.adduserFrm.value.confirmPassword) { + if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) { this.alerts += '
Password and confirm password must be same'; } if (this.adduserFrm.value.AccountNumberId == '0') { diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/changeuserpassword.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/changeuserpassword.component.ts index 2f3c962..518a3cf 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/changeuserpassword.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/changeuserpassword.component.ts @@ -24,6 +24,7 @@ user: User; changeUserPasswordFrm: FormGroup; error: any; alerts: string; + oldPassworduser: string=""; constructor(private _loadingService: LoadingService,private changeUserPasswordService: UserService, private router: Router, private fb: FormBuilder, private _confirmService: ConfirmService) { } @@ -52,6 +53,11 @@ alerts: string; } public onFormSubmit() { this.alerts = ''; + if (this.oldPassworduser != '') { + if (this.oldPassworduser == this.changeUserPasswordFrm.value.oldPassword) { + this.alerts += '
Old password is invalid.'; + } + } if ((this.changeUserPasswordFrm.value.oldPassword)=='') { this.alerts = 'Old password is required.'; @@ -89,14 +95,16 @@ alerts: string; } else { this._confirmService.activate("Password changed successfully.", "alertMsg"); //this.alerts = "Password changed successfully"; - } + this.oldPassworduser = this.changeUserPasswordFrm.value.oldPassword; + } + } BindFormFields(data){ this.user = data[0]; this.changeUserPasswordFrm.controls['userId'].setValue(this.user.Id); this.changeUserPasswordFrm.controls['loginId'].setValue(this.user.LoginId); - + } ResetFormFields(){ diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts index 38173ef..dfa698f 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts @@ -5,7 +5,7 @@ import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms' import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { User } from '../UserEntity/datamodel'; import { Http, Response } from '@angular/http'; -//import { Global } from '../../Shared/global'; +import { GlobalService } from '../../Shared/global'; //import { DBOperation } from 'S'; import { Observable } from 'rxjs/Observable'; import { ConfirmService } from '../../Shared/Confirm/confirm.service'; @@ -38,7 +38,7 @@ export class UpdateUserProfile implements OnInit { //profileModal: ModalComponent; //errorMessage: any; constructor(private _loadingService: LoadingService,private userservice: UserService, private router: Router, private fb: FormBuilder, private http: Http, - private _confirmService: ConfirmService + private _confirmService: ConfirmService, private global: GlobalService ) { } ngOnInit(): void { @@ -97,7 +97,7 @@ export class UpdateUserProfile implements OnInit { } } AfterInsertData(data) { - //debugger; + debugger; if (data.Status == "False") { // this._confirmService.activate(data.ResponseMessage, "alertMsg"); //setTimeout(() => this.amCode.nativeElement.focus(), 0); @@ -105,9 +105,16 @@ export class UpdateUserProfile implements OnInit { return false; } else { this.status = true; - + this.user = this.userFrm.value; + var loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); + loggedInUser.FirstName = this.userFrm.value.firstName; + loggedInUser.LastName = this.userFrm.value.lastName; + localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser)); + this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName; + this._confirmService.activate("User Profile Updated Successfully.", "alertMsg"); + // window.location.href = this.global.LiveURL; - this._confirmService.activate("User Profile Updated Successfully.", "alertMsg"); + //this.profileModal.open(); // this.submitted = false; // this.GetAllAcctMgr(); diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts index 148ad81..c991116 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts @@ -14,7 +14,7 @@ export class UserService { constructor(private http: Http, private commonService: GlobalService ) { } //////////Get User Detail/////////////// GetUserById() { - debugger; + return this.http.get(this.commonService.resourceBaseUrl + "User/GetUserProfile/"+this.commonService.UserId) .map(this.extractData) .catch((res: Response) => this.handleError(res));; @@ -119,7 +119,7 @@ export class UserService { /// Add User Entity/// GetUserTypeByLicenseType(obj: any) { - debugger; + return this.http.get(this.commonService.resourceBaseUrl + "User/GetUserTypebyLicenseId?UserTypeId=" + this.commonService.UserType + "&LicenseId=" + obj.AccountNumberId) .map(this.extractData) .catch((res: Response) => this.handleError(res)); @@ -222,16 +222,22 @@ export class UserService { .map(this.extractData) .catch((res: Response) => this.handleError(res)); } + + CheckDuplicateLicenseUserGroup(LicenseId: number, Title: string) { + return this.http.get(this.commonService.resourceBaseUrl + "UserGroup/CheckDuplicateLicenseUserGroup?LicenseId=" + LicenseId + "&Title=" + Title). + map(this.extractData) + .catch((res: Response) => this.handleError(res)); + } ///// End extractData(res: Response) { - debugger; + let body = res.json(); return body; } handleError(error: any) { - debugger; + // In a real world app, we might use a remote logging infrastructure // We'd also dig deeper into the error to get a better message let errMsg = (error.message) ? error.message : diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.html b/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.html index 48e818b..1d09b85 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.html +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.html @@ -51,12 +51,27 @@
-
+ +
+ + +
@@ -68,7 +83,7 @@
- +
@@ -82,7 +97,7 @@
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.ts index 40ecc81..5f75a85 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/usergroup.component.ts @@ -21,6 +21,7 @@ declare var $: any; export class UserGroup implements OnInit, AfterViewChecked { lstAccountNumbers: any; + tempLstAccountNumbers: any; lstLicenseUserGroups: any; licenseUserGroup: any; lstLicenseUserGroupUsers: any; @@ -46,6 +47,10 @@ export class UserGroup implements OnInit, AfterViewChecked { recordCountUser: number; pageNoUser: number; pageLengthUser: number; + accountDropDownText: string; + loopIdx: number; + userGroupName: string; + constructor(private userService: UserService, private router: Router, private activeRoute: ActivatedRoute, private fb: FormBuilder, private modalService: BsModalService, private _confirmService: ConfirmService, private global: GlobalService, private _loadingService: LoadingService) { } @@ -56,6 +61,9 @@ export class UserGroup implements OnInit, AfterViewChecked { this.divClass = 'col-sm-12'; this.license = new License(); this.alerts = ''; + this.accountDropDownText = 'Select'; + this.loopIdx = 0; + this.userGroupName = ''; this.NoRecord = this.global.NoRecords; this._loadingService.ShowLoading("global-loading"); this.recordCount = 0; @@ -130,8 +138,19 @@ export class UserGroup implements OnInit, AfterViewChecked { } GetLicenseAccounts() { - this.userService.GetLicenseAccounts(0) - .subscribe(st => { this.lstAccountNumbers = st; }, error => this.error = error); + this.userService.GetLicenseAccounts(1) + .subscribe(st => { + this.lstAccountNumbers = st; + this.tempLstAccountNumbers = []; + this.loopIdx = 0; + for (var i = 0; i < 1000; i++) { + if(this.loopIdx < this.lstAccountNumbers.length){ + this.tempLstAccountNumbers.push(this.lstAccountNumbers[this.loopIdx]); + this.loopIdx++; + } + } + }, + error => this.error = error); } GetLicenseUserGroups(evt: any) { @@ -143,9 +162,11 @@ export class UserGroup implements OnInit, AfterViewChecked { this.userService.GetLicenseUserGroups(this.license.LicenseId, this.pageNo, this.pageLength) .subscribe(st => { this.BindFormFields(st); }, error => this.error = error); } + SearchRecords() { this.GetLicenseUserGroups('1, ' + this.pageLength); } + GetLicenseUserGroupUsers(evt: any) { this.alerts = ''; this._loadingService.ShowLoading("global-loading"); @@ -159,18 +180,46 @@ export class UserGroup implements OnInit, AfterViewChecked { this.userService.GetLicenseUserGroupUsers(this.license.LicenseId, this.selectedId, AllUsers, this.pageNoUser, this.pageLengthUser) .subscribe(st => { this.BindUserFormFields(st); }, error => this.error = error); } + SearchUserRecords() { this.GetLicenseUserGroupUsers('1, ' + this.pageLengthUser); } - AccountNumberChanged(LicenseId: number, evt: any) { + AccountNumberChanged(LicenseId: number, SelectText: string) { + this.accountDropDownText = SelectText; + this.license.LicenseId = LicenseId; this.selectedRow = -1; this.selectedId = -1; - this.license.LicenseId = LicenseId; this.lstLicenseUserGroups = null; + this.updateUserGroupFrm.controls['userGroupName'].setValue(''); + this.userGroupName = ''; this.SearchRecords(); } + onScroll($event){ + if($event.target.scrollTop >= ($event.target.scrollHeight/2)){ + for (var i = 0; i < 5000; i++) { + if(this.loopIdx < this.lstAccountNumbers.length){ + this.tempLstAccountNumbers.push(this.lstAccountNumbers[this.loopIdx]); + this.loopIdx++; + } + } + } +} + +onOpenChange(data: boolean): void { + if(!data){ + this.loopIdx = 0; + this.tempLstAccountNumbers = []; + for (var i = 0; i < 1000; i++) { + if(this.loopIdx < this.lstAccountNumbers.length){ + this.tempLstAccountNumbers.push(this.lstAccountNumbers[this.loopIdx]); + this.loopIdx++; + } + } + } +} + AfterDeleteData(data, template) { if (data.Status == "false") { this.alerts = "License user group delete unsuccessfull"; @@ -178,6 +227,8 @@ export class UserGroup implements OnInit, AfterViewChecked { this._confirmService.activate("License user group deleted successfully.", "alertMsg"); // this.modalAlerts = "

License user group deleted successfully

"; //this.modalRef = this.modalService.show(template); + this.selectedRow = -1; + this.selectedId = -1; this.SearchRecords(); } } @@ -216,11 +267,21 @@ export class UserGroup implements OnInit, AfterViewChecked { 'modifiedDate': new Date() }; if (this.alerts == '') { - return this.userService.InsertUpdateLicenseUserGroup(obj) + this.userService.CheckDuplicateLicenseUserGroup(this.license.LicenseId, title) .subscribe( - n => (this.AfterInsertData(n, template)), + data => { + if(data == "True"){ + this.alerts = "User group name already exists. Enter a different name."; + } + else{ + this.userService.InsertUpdateLicenseUserGroup(obj) + .subscribe( + n => (this.AfterInsertData(n, template)), + error => this.error = error); + } + }, error => this.error = error); - } + } } UpdateLicenseUserGroup(template: TemplateRef) { @@ -234,12 +295,33 @@ export class UserGroup implements OnInit, AfterViewChecked { 'modifiedDate': this.licenseUserGroup.ModifiedDate }; if (this.alerts == '') { - return this.userService.InsertUpdateLicenseUserGroup(obj) - .subscribe( - n => ( - this.UpdateLicenseUserGroupUsers(template) - ), - error => this.error = error); + if(this.licenseUserGroup.Title.toString().toLowerCase().trim() != obj.title.toString().toLowerCase().trim()) + { + this.userService.CheckDuplicateLicenseUserGroup(this.license.LicenseId, this.updateUserGroupFrm.controls['userGroupName'].value) + .subscribe( + data => { + if(data == "True"){ + this.alerts = "User group name already exists. Enter a different name."; + } + else{ + this.userService.InsertUpdateLicenseUserGroup(obj) + .subscribe( + n => ( + this.UpdateLicenseUserGroupUsers(template) + ), + error => this.error = error); + } + }, + error => this.error = error); + } + else{ + this.userService.InsertUpdateLicenseUserGroup(obj) + .subscribe( + n => ( + this.UpdateLicenseUserGroupUsers(template) + ), + error => this.error = error); + } } } diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts index 0b009b7..e00d1f0 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts @@ -130,7 +130,7 @@ export class UsersList implements OnInit, AfterViewChecked { { width: 350, align: 'Center' }, { width: 200, align: 'Center' }, { width: 130, align: 'Center' }, - { width: 120, align: 'center' }, + { width: 140, align: 'center' }, { width: 280, align: 'Center' }, { width: 180, align: 'center' }, { width: 200, align: 'center' }, @@ -219,6 +219,8 @@ export class UsersList implements OnInit, AfterViewChecked { } SearchUserList(evt: any) { + this.NoRecord = ''; + debugger; this._loadingService.ShowLoading("global-loading"); var tempArr = evt.split(','); this.pageNo = parseInt(tempArr[0]); @@ -254,6 +256,7 @@ export class UsersList implements OnInit, AfterViewChecked { } } CancelEditUser() { + this.SearchUserList('1, ' + this.pageLength); this.Mode = 'Manage'; this.modalTitle = 'LIST USER'; this.topPos = '2000px'; diff --git a/400-SOURCECODE/Admin/src/app/shared/global.ts b/400-SOURCECODE/Admin/src/app/shared/global.ts index 5b81d18..b2e5d7d 100644 --- a/400-SOURCECODE/Admin/src/app/shared/global.ts +++ b/400-SOURCECODE/Admin/src/app/shared/global.ts @@ -1,5 +1,8 @@ import { CsvService } from "angular2-json2csv"; import { Injectable, Inject } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import { Http, Response } from '@angular/http'; + @Injectable() export class GlobalService { userUrl: string = ""; @@ -13,9 +16,11 @@ export class GlobalService { UserType: number =0; AccountType: number = 0; loggedInUser: any; + DisplayName: string = ""; NoRecords: string; ValidationMsg: string; - constructor(private csvService:CsvService) { + error; + constructor(private csvService: CsvService, private http: Http) { this.hostURL = "http://192.168.84.242:97/"; this.LiveAPIURL = "http://beta.interactiveanatomy.com/API/Adminapi/"; this.QAAPIURL = "http://qa.beta.interactiveanatomy.com/API/Adminapi/"; @@ -23,11 +28,14 @@ export class GlobalService { //this.resourceBaseUrl = this.hostURL; //this.resourceBaseUrl = this.LiveAPIURL; this.resourceBaseUrl = this.QAAPIURL; - if (this.resourceBaseUrl == "http://192.168.84.242:97/") { - localStorage.setItem('loggedInUserDetails', JSON.stringify( - { - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016", "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": null, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null - })); + if (this.resourceBaseUrl == "http://192.168.84.242:97/") { + + localStorage.setItem('loggedInUserDetails', JSON.stringify( + { + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016", "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": null, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null + })); + + //this.LiveURL = this.LocalURL+"/Admin"; } else if (this.resourceBaseUrl == "http://beta.interactiveanatomy.com/API/Adminapi/") { this.LiveURL = "http://beta.interactiveanatomy.com"; @@ -38,6 +46,7 @@ export class GlobalService { this.loggedInUser = JSON.parse(localStorage.getItem("loggedInUserDetails")); this.UserId = this.loggedInUser.Id; this.UserType = this.loggedInUser.UserTypeId; + this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; this.NoRecords = 'No records founds.'; } compareTwoDates(todate: string, fromdate: string) { @@ -53,5 +62,19 @@ export class GlobalService { ExportToCSV(data: any, FileName: string) { this.csvService.download(data, FileName); } + // Read Json File for Menu + public getJSON() { + + let apiUrl = './assets/data/Menu.json'; + return this.http.get(apiUrl) + .map((response: Response) => { + const data = response.json(); + return data; + }); + } } + + + + diff --git a/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js new file mode 100644 index 0000000..421ac4c --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DBOperation; +(function (DBOperation) { + DBOperation[DBOperation["create"] = 1] = "create"; + DBOperation[DBOperation["update"] = 2] = "update"; + DBOperation[DBOperation["delete"] = 3] = "delete"; +})(DBOperation = exports.DBOperation || (exports.DBOperation = {})); +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js.map b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js.map new file mode 100644 index 0000000..ffae1a4 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["enum.ts"],"names":[],"mappings":";;AAAA,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,iDAAU,CAAA;IACV,iDAAU,CAAA;IACV,iDAAS,CAAA;AACb,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB"} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.ts b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.ts new file mode 100644 index 0000000..3cb45b4 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/shared/my-filter.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform, Injectable, Inject } from '@angular/core'; +@Pipe({ + name: 'callback', + pure: false +}) +@Injectable() +export class MyFilterPipe implements PipeTransform { + + transform(items: any[], searchText: string): any[] { + + if (!items) return []; + if (!searchText) return items; + searchText = searchText.toLowerCase(); + + return items.filter(it => { + //alert(JSON.stringify(it)); + if (it.HeaderMenuStatus.toLowerCase() == searchText) { + return it; + } + }); + } +} diff --git a/400-SOURCECODE/Admin/src/assets/data/Menu.json b/400-SOURCECODE/Admin/src/assets/data/Menu.json new file mode 100644 index 0000000..20d1e0c --- /dev/null +++ b/400-SOURCECODE/Admin/src/assets/data/Menu.json @@ -0,0 +1,1454 @@ +{ + "AdminSections": [ + { + "Id": "1", + "UserType": "Super Admin", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "True" + } + + ] + } + + + ] + }, + { + "Id": "2", + "UserType": "General Admin", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "True" + } + + ] + } + + + ] + }, + { + "Id": "4", + "UserType": "Client Admin", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "False" + } + + ] + } + + + ] + }, + + { + "Id": "3", + "UserType": "District Admin", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "False" + } + + ] + } + + + ] + }, + { + "Id": "5", + "UserType": "Single User", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "False" + } + + ] + } + + + ] + }, + { + "Id": "6", + "UserType": "Concurrent User", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "False", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "False" + } + + ] + } + + + ] + }, + { + "Id": "7", + "UserType": "Reseller- General Admin", + "HeaderMenu": [ + { + "HeaderMenuId": "100", + "HeaderMenuName": "Profile", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "200", + "SubMenuName": "Update Profile", + "SubMenuUrl": "updateuserprofile", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "201", + "SubMenuName": "Change Password", + "SubMenuUrl": "changeuserpassword", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "202", + "SubMenuName": "Change User ID", + "SubMenuUrl": "changeuserid", + "SubMenuStatus": "True" + } + ] + }, + { + "HeaderMenuId": "101", + "HeaderMenuName": "Licenses", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "203", + "SubMenuName": "Search License", + "SubMenuUrl": "searchlicense", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "204", + "SubMenuName": "Add New License", + "SubMenuUrl": "addlicense", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "102", + "HeaderMenuName": "Product Features", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "205", + "SubMenuName": "Manage Discount Code", + "SubMenuUrl": "managediscountcode", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "206", + "SubMenuName": "Subscription Price", + "SubMenuUrl": "subscriptionprice", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "103", + "HeaderMenuName": "Users", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "207", + "SubMenuName": "List User", + "SubMenuUrl": "users", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "208", + "SubMenuName": "Add User", + "SubMenuUrl": "adduser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "209", + "SubMenuName": "Unblock User", + "SubMenuUrl": "unblockuser", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "210", + "SubMenuName": "User Group", + "SubMenuUrl": "usergroup", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "104", + "HeaderMenuName": "Reports", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "211", + "SubMenuName": "Usage Report", + "SubMenuUrl": "usagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "212", + "SubMenuName": "Customer Summary Report", + "SubMenuUrl": "customersummaryreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "213", + "SubMenuName": "Expiring Subscription Report", + "SubMenuUrl": "expiringsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "214", + "SubMenuName": "New Subscription Report", + "SubMenuUrl": "subscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "215", + "SubMenuName": "Subscription Cancellation Report", + "SubMenuUrl": "subscriptioncancellationreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "216", + "SubMenuName": "Net AD Subscription Report", + "SubMenuUrl": "netadsubscriptionreport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "217", + "SubMenuName": "Site License Usage Report", + "SubMenuUrl": "sitelicenseusagereport", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "218", + "SubMenuName": "Discount Code Report", + "SubMenuUrl": "discountcodereport", + "SubMenuStatus": "False" + }, + { + "SubMenuId": "219", + "SubMenuName": "Image Export Report", + "SubMenuUrl": "imageexportreport", + "SubMenuStatus": "False" + } + + ] + }, + { + "HeaderMenuId": "105", + "HeaderMenuName": "Site Account", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "220", + "SubMenuName": "Add Building Level Account", + "SubMenuUrl": "sitelicenseaccount", + "SubMenuStatus": "True" + } + + ] + }, + { + "HeaderMenuId": "106", + "HeaderMenuName": "Settings", + "HeaderMenuStatus": "True", + "SubMenu": [ + { + "SubMenuId": "221", + "SubMenuName": "View-Update Profile", + "SubMenuUrl": "editlicensebasicsettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "222", + "SubMenuName": "Manage Modesty Settings", + "SubMenuUrl": "licensemodestysettings", + "SubMenuStatus": "True" + }, + { + "SubMenuId": "223", + "SubMenuName": "Manage Module", + "SubMenuUrl": "licensemodulesettings", + "SubMenuStatus": "False" + } + + ] + } + + + ] + } + ] +} diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_DeleteLicense.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_DeleteLicense.sql new file mode 100644 index 0000000..8f83c7e --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_DeleteLicense.sql @@ -0,0 +1,74 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_DeleteLicense]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_DeleteLicense] +GO + +CREATE PROCEDURE [dbo].[usp_DeleteLicense] + @iLicenseId int +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + BEGIN TRY + BEGIN TRANSACTION + DECLARE @iLicenseTypeId TINYINT + DECLARE @cGetDetail CURSOR + DECLARE @iSiteId INT + DECLARE @iUserId INT + DECLARE @sErrorStatus CHAR(2) + + SET @sErrorStatus = 'ok' + SET @iLicenseTypeId = (SELECT LicenseTypeId FROM License WHERE Id = @iLicenseId) + + -- check if license is site license + IF @iLicenseTypeId = 3 + BEGIN + -- delete records from tables which store information about building level account + SET @cGetDetail = CURSOR FAST_FORWARD FOR SELECT SiteId FROM SiteToLicenseEdition WHERE LicenseEditionId IN (SELECT Id FROM LicenseToEdition WHERE LicenseId = @iLicenseId) + OPEN @cGetDetail + FETCH NEXT FROM @cGetDetail INTO @iSiteId + WHILE @@FETCH_STATUS = 0 + BEGIN + DELETE FROM AIAUserToSite WHERE SiteId = @iSiteId + DELETE FROM SiteToLicenseEdition WHERE SiteId = @iSiteId + DELETE FROM Site WHERE Id = @iSiteId + + FETCH NEXT FROM @cGetDetail INTO @iSiteId + END + CLOSE @cGetDetail + END + -- delete records from tables which store information about user + SET @cGetDetail = CURSOR FAST_FORWARD FOR SELECT Userid FROM AIAUserToLicenseEdition WHERE LicenseEditionId IN (SELECT Id FROM LicenseToEdition WHERE LicenseId = @iLicenseId) + OPEN @cGetDetail + FETCH NEXT FROM @cGetDetail INTO @iUserId + WHILE @@FETCH_STATUS = 0 + BEGIN + DELETE FROM AIAUserToLicenseEdition WHERE Userid = @iUserId + DELETE FROM LoginDetail WHERE UserId = @iUserId + DELETE FROM SessionManager WHERE UserId = @iUserId + DELETE FROM IncorrectLoginAttempts WHERE UserId = @iUserId + DELETE FROM UserGroupToAIAUser WHERE UserId = @iUserId + DELETE FROM AIAUser WHERE Id = @iUserId + + FETCH NEXT FROM @cGetDetail INTO @iUserId + END + CLOSE @cGetDetail + -- delete records from tables which store information about the license + DELETE FROM UserGroup WHERE LicenseId = @iLicenseId + DELETE FROM LicenseToEdition WHERE LicenseId = @iLicenseId + DELETE FROM SingleUserDetail WHERE LicenseId = @iLicenseId + DELETE FROM LicenseSubscriptionDetail WHERE LicenseId = @iLicenseId + DELETE FROM License WHERE Id = @iLicenseId + + COMMIT TRANSACTION + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetAccountTypeList.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetAccountTypeList.sql new file mode 100644 index 0000000..8624f3c --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetAccountTypeList.sql @@ -0,0 +1,25 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_EC_GetAccountTypeList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_EC_GetAccountTypeList] +GO + +CREATE PROCEDURE [dbo].[usp_EC_GetAccountTypeList] + -- Add the parameters for the stored procedure here +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + -- Insert statements for procedure here +select Id,Title +from AccountType where IsActive=1 + +END + + + + + + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetCountryList.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetCountryList.sql new file mode 100644 index 0000000..ce24028 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetCountryList.sql @@ -0,0 +1,23 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_EC_GetCountryList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_EC_GetCountryList] +GO + +CREATE PROCEDURE [dbo].[usp_EC_GetCountryList] + -- Add the parameters for the stored procedure here +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + +SELECT Id, CountryName +FROM Country +ORDER BY (case CountryCode when 'US' THEN 0 ELSE Id END) + +END + + + + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetSecurityQuestionList.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetSecurityQuestionList.sql new file mode 100644 index 0000000..2c1583c --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetSecurityQuestionList.sql @@ -0,0 +1,24 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_EC_GetSecurityQuestionList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_EC_GetSecurityQuestionList] +GO + +CREATE PROCEDURE [dbo].[usp_EC_GetSecurityQuestionList] + -- Add the parameters for the stored procedure here +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + -- Insert statements for procedure here +select Id,Title +from SecurityQuestion + +END + + + + + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetStateList.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetStateList.sql new file mode 100644 index 0000000..25697b7 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_EC_GetStateList.sql @@ -0,0 +1,23 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_EC_GetStateList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_EC_GetStateList] +GO + +CREATE PROCEDURE [dbo].[usp_EC_GetStateList] + -- Add the parameters for the stored procedure here +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + -- Insert statements for procedure here +select Id,StateName +from State + +END + + + + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetBlockedUserByAccNoAndType.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetBlockedUserByAccNoAndType.sql new file mode 100644 index 0000000..8a292ef --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetBlockedUserByAccNoAndType.sql @@ -0,0 +1,37 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetBlockedUserByAccNoAndType]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetBlockedUserByAccNoAndType] +GO + +CREATE PROCEDURE [dbo].[usp_GetBlockedUserByAccNoAndType] + -- Add the parameters for the stored procedure here + @iUserTypeId tinyint, @iLicenseId int +AS +BEGIN + -- returns the metadata + IF 1=0 BEGIN + SET FMTONLY OFF + END + SELECT DISTINCT + AIAUser.Id, + AIAUser.FirstName, + AIAUser.LastName, + AIAUser.LoginId, + AIAUser.Password, + AIAUser.EmailId, + ISNULL(License.AccountNumber,'') AccountNumber, + IncorrectLoginAttempts.LoginTime + FROM + IncorrectLoginAttempts + INNER JOIN AIAUser ON IncorrectLoginAttempts.UserId = AIAUser.Id + INNER JOIN UserType ON AIAUser.UserTypeId = UserType.Id + LEFT JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId + LEFT JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id + LEFT JOIN License ON LicenseToEdition.LicenseId = License.Id + WHERE + IncorrectLoginAttempts.CntIncorrectLogins >= 5 + AND UserType.Priority >= (SELECT UserType.Priority FROM UserType WHERE UserType.Id=@iUserTypeId) + AND ((@iLicenseId =0) OR (License.Id = @iLicenseId)) + AND License.IsActive = 1 +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCancelledLicenses.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCancelledLicenses.sql new file mode 100644 index 0000000..5bacdcc --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCancelledLicenses.sql @@ -0,0 +1,163 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetCancelledLicenses]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetCancelledLicenses] +GO + +CREATE PROCEDURE [dbo].[usp_GetCancelledLicenses] + -- Add the parameters for the stored procedure here + @sFromDate varchar(20), @sToDate varchar(20), @iStartPrice numeric(14,2), @iEndPrice numeric(14,2), @iLicenseTypeId tinyint, + @iAccountTypeId tinyint , @sZip varchar(20) = '', @iStateId int, @iCountryId int,@pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON; + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + DECLARE @cGetLicenseID CURSOR + DECLARE @iLicenseId INT + DECLARE @iLicenseSubscriptionDetail INT + DECLARE @sAccountNumber VARCHAR(50) + DECLARE @sLicenseeName VARCHAR(100) + DECLARE @sLicenseType VARCHAR(50) + DECLARE @sInstitutionName VARCHAR(100) + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @mSubscriptionPrice MONEY + DECLARE @sAccountType VARCHAR(50) + DECLARE @sEdition VARCHAR(200) + DECLARE @iCardNumber INT + + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + -- create a temporary table to store the desired results of cancelled licenses on the basis of parameter + CREATE TABLE #CancelledLicenseReport + ( + AccountNumber VARCHAR(50), + LicenseeName VARCHAR(100), + LicenseType VARCHAR(50), + InstitutionName VARCHAR(100), + Edition VARCHAR(200), + ValidFrom DATETIME, + ValidThrough DATETIME, + LicenseCreationDate DATETIME, + Price MONEY, + AccountType VARCHAR(50), + CardNumber INT + ) + + -- define the forward only, read-only cursor + SET @cGetLicenseID = CURSOR FAST_FORWARD + FOR + SELECT LicenseSubscriptionDetail.LicenseId, MAX(LicenseSubscriptionDetail.Id) + FROM LicenseSubscriptionDetail + INNER JOIN License ON License.Id = LicenseSubscriptionDetail.LicenseId + WHERE (License.CancellationDate BETWEEN @dtFromDate AND @dtToDate) AND + (TotalAmount >= (CASE WHEN @iStartPrice > 0 THEN @iStartPrice ELSE 0 END)) + AND (TotalAmount <= (CASE WHEN @iEndPrice = 0 THEN 0 WHEN @iEndPrice > 0 THEN @iEndPrice ELSE 9999999999 END)) + GROUP BY LicenseSubscriptionDetail.LicenseId + --HAVING (MAX(SubscriptionValidThrough) BETWEEN @dtFromDate AND @dtToDate) + + -- open & fetch the cursor variables into the local variables + OPEN @cGetLicenseID + FETCH NEXT FROM @cGetLicenseID INTO @iLicenseId, @iLicenseSubscriptionDetail + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + + SET @sEdition = '' + -- fetch the accountnumber, licenseename, licensetype, startdate, enddate, subscriptionprice, accountype of a license + SELECT @sAccountNumber = AccountNumber, @sLicenseeName = LicenseeName, @sLicenseType = LicenseType, + @sInstitutionName = InstitutionName, + @dtStartDate = SubscriptionValidFrom, @dtEndDate = SubscriptionValidThrough, + @dtLicenseCreationDate = CreationDate, + @mSubscriptionPrice = TotalAmount, @sAccountType = AccountType, @iCardNumber = CardNumber + FROM + ( + SELECT AccountNumber, (LicenseeFirstName+' '+LicenseeLastName) as LicenseeName, + LicenseType.Title as LicenseType, License.InstitutionName, + AccountType.Title as AccountType, LicenseSubscriptionDetail.TotalAmount, + LicenseSubscriptionDetail.SubscriptionValidFrom, LicenseSubscriptionDetail.SubscriptionValidThrough, + License.CreationDate, + DATEDIFF(dd,GETDATE(),License.CancellationDate) as DaysRemaining, (CASE WHEN License.CardNumber > 0 THEN License.CardNumber END) as CardNumber + FROM License + INNER JOIN LicenseType ON License.LicenseTypeId = LicenseType.Id + INNER JOIN AccountType ON License.AccountTypeId = AccountType.Id + INNER JOIN State ON License.StateId = State.Id + INNER JOIN Country ON License.CountryId = Country.Id + INNER JOIN LicenseSubscriptionDetail ON License.Id = LicenseSubscriptionDetail.LicenseId + WHERE License.IsActive = 0 + AND License.LicenseTypeId = (CASE WHEN @iLicenseTypeId > 0 THEN @iLicenseTypeId ELSE License.LicenseTypeId END) + AND License.AccountTypeId = (CASE WHEN @iAccountTypeId > 0 THEN @iAccountTypeId ELSE License.AccountTypeId END) + AND State.Id = (CASE WHEN @iStateId > 0 THEN @iStateId ELSE State.Id END) + AND Country.Id = (CASE WHEN @iCountryId > 0 THEN @iCountryId ELSE Country.Id END) + AND License.Zip = (CASE WHEN LEN(@sZip)>0 THEN @sZip ELSE License.Zip END) + AND LicenseSubscriptionDetail.Id = @iLicenseSubscriptionDetail + AND License.LicenseTypeId <> 5 + ) t1 + + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + -- fetch all the editions mapped as a string with a license + SELECT @sEdition = Edition.Title + '; ' + @sEdition + FROM LicenseToEdition INNER JOIN Edition + ON LicenseToEdition.EditionId = Edition.Id + WHERE LicenseToEdition.LicenseId = @iLicenseId + -- remove the trailing comma-separator from the edition-string + --AMI SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1); + IF LEN(@sEdition)> 1 + -- remove the trailing comma-separator from the edition-string + SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1) + ELSE + SET @sEdition = @sEdition + + -- insert into the temporary table + INSERT INTO #CancelledLicenseReport + (AccountNumber,LicenseeName,LicenseType,InstitutionName,Edition,ValidFrom,ValidThrough,LicenseCreationDate,Price,AccountType,CardNumber) + VALUES(@sAccountNumber,@sLicenseeName,@sLicenseType,@sInstitutionName,@sEdition,@dtStartDate,@dtEndDate,@dtLicenseCreationDate,@mSubscriptionPrice,@sAccountType,@iCardNumber) + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetLicenseID INTO @iLicenseId,@iLicenseSubscriptionDetail + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetLicenseID + DEALLOCATE @cGetLicenseID + + -- Selecting the desired result from temporary table + --SELECT AccountNumber, LicenseeName, LicenseType,InstitutionName,AccountType, Edition, CONVERT(VARCHAR,ValidFrom,101) as StartDate, + -- CONVERT(VARCHAR,ValidThrough,101) as EndDate,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice, CardNumber + --FROM #CancelledLicenseReport ORDER BY AccountNumber + + + SELECT RowNum, AccountNumber, LicenseeName, LicenseType,InstitutionName,AccountType, Edition, StartDate, + EndDate,LicenseCreationDate,SubscriptionPrice, CardNumber + from ( + SELECT ROW_NUMBER() OVER (ORDER BY AccountNumber) AS RowNum, AccountNumber, LicenseeName, LicenseType,InstitutionName,AccountType, Edition, CONVERT(VARCHAR,ValidFrom,101) as StartDate, + CONVERT(VARCHAR,ValidThrough,101) as EndDate,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice, CardNumber + FROM #CancelledLicenseReport) as Tempt + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo + ORDER BY AccountNumber + + --Calculate total number of records + select @recordCount = count(ResultTable.AccountNumber) + from ( + SELECT AccountNumber, LicenseeName, LicenseType,InstitutionName,AccountType, Edition, CONVERT(VARCHAR,ValidFrom,101) as StartDate, + CONVERT(VARCHAR,ValidThrough,101) as EndDate,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice, CardNumber + FROM #CancelledLicenseReport) as ResultTable + + + -- Dropping the temporary table + DROP TABLE #CancelledLicenseReport +END + + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCustomerSummary.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCustomerSummary.sql new file mode 100644 index 0000000..845816c --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetCustomerSummary.sql @@ -0,0 +1,188 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetCustomerSummary]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetCustomerSummary] +GO + +CREATE PROCEDURE [dbo].[usp_GetCustomerSummary] + -- Add the parameters for the stored procedure here + @sAccoutNumber varchar(50)='', @sLicenseeFullName varchar(100)='', @iStartPrice numeric(14,2), @iEndPrice numeric(14,2), + @iLicenseType tinyint, @iAccountType tinyint, @sZip varchar(20) = '', @iState int, + @iCountry int,@pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON + DECLARE @cGetLicenseDetails CURSOR + DECLARE @iLicenseId INT + DECLARE @sAccountNumber VARCHAR(50) + DECLARE @sLicenseeName VARCHAR(100) + DECLARE @iLicenseTypeId TINYINT + DECLARE @sLicenseType VARCHAR(50) + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @sAccountType VARCHAR(50) + DECLARE @iAccountTypeId TINYINT + DECLARE @sLicenseStatus VARCHAR(8) + DECLARE @sEdition VARCHAR(200) + DECLARE @bExists bit + DECLARE @sLicenseState VARCHAR(50) + DECLARE @sLicenseZip VARCHAR(20) + DECLARE @sLicenseCountry VARCHAR(50) + DECLARE @sInstitutionName VARCHAR(100) + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @mSubscriptionPrice MONEY + DECLARE @iLicenseSubscriptionId INT + DECLARE @sEmailId VARCHAR(100) + DECLARE @iCardNumber INT + + -- create a temporary table to store the desired results of licenses on the basis of parameter + CREATE TABLE #CustomerReport + ( + AccountNumber VARCHAR(50), + LicenseeName VARCHAR(100), + LicenseType VARCHAR(50), + Edition VARCHAR(200), + Email VARCHAR(100), + ValidFrom DATETIME, + ValidThrough DATETIME, + AccountType VARCHAR(50), + LicenseStatus VARCHAR(8), + Price MONEY, + LicenseState VARCHAR(50), + LicenseZip VARCHAR(20), + LicenseCountry VARCHAR(50), + InstitutionName VARCHAR(100), + LicenseCreationDate DATETIME, + CardNumber INT + ) + + SET @sLicenseeFullName = REPLACE(@sLicenseeFullName,' ',' OR ') + + -- define the forward only, read-only cursor + SET @cGetLicenseDetails = CURSOR FAST_FORWARD + FOR + SELECT License.Id, License.AccountNumber, (License.LicenseeFirstName+' '+License.LicenseeLastName), + License.LicenseTypeId, License.AccountTypeId, License.EmailId, + (CASE License.IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) as LicenseStatus, + State.StateName, License.Zip, Country.CountryName, + License.InstitutionName,License.CreationDate, + (CASE WHEN License.CardNumber > 0 THEN License.CardNumber END) as CardNumber + FROM License WITH (NOLOCK) + INNER JOIN State WITH (NOLOCK) ON License.StateId = State.Id + INNER JOIN Country WITH (NOLOCK) ON License.CountryId = Country.Id + WHERE + License.AccountNumber = (CASE WHEN LEN(@sAccoutNumber)>0 THEN @sAccoutNumber ELSE License.AccountNumber END) + AND License.LicenseTypeId = (CASE WHEN @iLicenseType > 0 THEN @iLicenseType ELSE License.LicenseTypeId END) + AND License.AccountTypeId = (CASE WHEN @iAccountType > 0 THEN @iAccountType ELSE License.AccountTypeId END) + AND State.Id = (CASE WHEN @iState > 0 THEN @iState ELSE State.Id END) + AND Country.Id = (CASE WHEN @iCountry > 0 THEN @iCountry ELSE Country.Id END) + AND License.Zip = (CASE WHEN LEN(@sZip)>0 THEN @sZip ELSE License.Zip END) + + -- open & fetch the cursor variables into the local variables + OPEN @cGetLicenseDetails + FETCH NEXT FROM @cGetLicenseDetails INTO @iLicenseId, @sAccountNumber, @sLicenseeName, + @iLicenseTypeId, @iAccountTypeId, @sEmailId, @sLicenseStatus, @sLicenseState, @sLicenseZip, @sLicenseCountry,@sInstitutionName,@dtLicenseCreationDate, @iCardNumber + + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + + SET @sEdition = '' + SET @bExists = 1 + -- fetch the latest license start/end date of a license on the basis of Subscription Start & End price if any + SELECT @dtStartDate = MAX(LicenseSubscriptionDetail.SubscriptionValidFrom), + @dtEndDate = MAX(LicenseSubscriptionDetail.SubscriptionValidThrough), + @iLicenseSubscriptionId = MAX(LicenseSubscriptionDetail.Id) + FROM LicenseSubscriptionDetail WITH (NOLOCK) + WHERE LicenseSubscriptionDetail.LicenseId = @iLicenseId + AND (TotalAmount >= (CASE WHEN @iStartPrice > 0 THEN @iStartPrice ELSE 0 END)) + AND (TotalAmount <= (CASE WHEN @iEndPrice = 0 THEN 0 WHEN @iEndPrice > 0 THEN @iEndPrice ELSE 9999999999 END)) + GROUP BY LicenseSubscriptionDetail.LicenseId + + + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + + -- check whether the name of licensse matches the name entered by user + + IF LEN(@sLicenseeFullName) > 0 + BEGIN + SELECT @bExists = 1 + FROM License WITH (NOLOCK) + WHERE Id = @iLicenseId AND (LicenseeFirstName LIKE '%'+@sLicenseeFullName+'%' OR LicenseeLastName LIKE '%'+@sLicenseeFullName+'%') --CONTAINS((LicenseeFirstName,LicenseeLastName) + IF @@Rowcount = 0 + BEGIN + SET @bExists = 0 + END + END + + -- check whether the above query returns any row + IF @bExists = 1 + BEGIN + -- fetch the licensetype of the license + SELECT @sLicenseType = LicenseType.Title FROM LicenseType WITH (NOLOCK) + WHERE LicenseType.Id = @iLicenseTypeId + -- fetch the accounttype of the license + SELECT @sAccountType = AccountType.Title FROM AccountType WITH (NOLOCK) + WHERE AccountType.Id = @iAccountTypeId + + -- fetch all the editions mapped as a string with a license + SELECT @sEdition = Edition.Title + '; ' + @sEdition + FROM LicenseToEdition WITH (NOLOCK) INNER JOIN Edition WITH (NOLOCK) + ON LicenseToEdition.EditionId = Edition.Id + WHERE LicenseToEdition.LicenseId = @iLicenseId + + IF LEN(@sEdition)> 1 + -- remove the trailing comma-separator from the edition-string + SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1) + ELSE + SET @sEdition = @sEdition + + -- fetch the price of the license + SELECT @mSubscriptionPrice = TotalAmount FROM LicenseSubscriptionDetail WITH (NOLOCK) + WHERE Id = @iLicenseSubscriptionId + + -- insert into the temporary table + INSERT INTO #CustomerReport + (AccountNumber, LicenseeName, LicenseType, Edition, Email, ValidFrom, ValidThrough, AccountType, LicenseStatus, Price, LicenseState, LicenseZip, LicenseCountry, InstitutionName, LicenseCreationDate, CardNumber) + VALUES(@sAccountNumber, @sLicenseeName, @sLicenseType, @sEdition, @sEmailId, @dtStartDate, @dtEndDate, @sAccountType, @sLicenseStatus, @mSubscriptionPrice, @sLicenseState, @sLicenseZip, @sLicenseCountry,@sInstitutionName,@dtLicenseCreationDate, @iCardNumber) + END + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetLicenseDetails INTO @iLicenseId, @sAccountNumber, @sLicenseeName, + @iLicenseTypeId, @iAccountTypeId, @sEmailId, @sLicenseStatus, @sLicenseState, @sLicenseZip, @sLicenseCountry, @sInstitutionName, @dtLicenseCreationDate, @iCardNumber + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetLicenseDetails + DEALLOCATE @cGetLicenseDetails + + -- Selecting the desired result from temporary table + SELECT RowNum, AccountNumber, LicenseeName, LicenseType, AccountType, Edition, Email, StartDate, + EndDate, LicenseStatus, Price, + LicenseZip, LicenseState, LicenseCountry,InstitutionName,LicenseCreationDate , CardNumber + from ( + SELECT ROW_NUMBER() OVER (ORDER BY AccountNumber) AS RowNum, AccountNumber, LicenseeName, LicenseType, AccountType, Edition, Email, CONVERT(VARCHAR,ValidFrom,101) as StartDate, + CONVERT(VARCHAR,ValidThrough,101) as EndDate, LicenseStatus, CONVERT(NUMERIC(14,2),Price) as Price, + LicenseZip, LicenseState, LicenseCountry,InstitutionName, CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate , CardNumber + FROM #CustomerReport WITH (NOLOCK) ) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo + ORDER BY AccountNumber + + --Calculate total number of records + select @recordCount = count(ResultTable.AccountNumber) + from ( + SELECT AccountNumber, LicenseeName, LicenseType, AccountType, Edition, Email, CONVERT(VARCHAR,ValidFrom,101) as StartDate, + CONVERT(VARCHAR,ValidThrough,101) as EndDate, LicenseStatus, CONVERT(NUMERIC(14,2),Price) as Price, + LicenseZip, LicenseState, LicenseCountry,InstitutionName, CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate , CardNumber + FROM #CustomerReport WITH (NOLOCK) ) as ResultTable + + -- Dropping the temporary table + DROP TABLE #CustomerReport +END + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountCodes.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountCodes.sql new file mode 100644 index 0000000..e67ecb3 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountCodes.sql @@ -0,0 +1,41 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetDiscountCodes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetDiscountCodes] +GO +CREATE PROCEDURE [dbo].[usp_GetDiscountCodes] + -- Add the parameters for the stored procedure here + @sDiscountCode VARCHAR(255) = '', @sStartDate VARCHAR(20) = '', @sEndDate VARCHAR(20) = '', @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + DECLARE @dtStartDate DATETIME, @dtEndDate DATETIME + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = CONVERT(DATETIME,@sEndDate) + + --Get the records on the basis of parameters page length and page number rows + select LD.Id, LD.DiscountCode, LD.Percentage, LD.StartDate, LD.EndDate, LD.Status + from + (Select ROW_NUMBER() OVER (ORDER BY Id) AS RowNo, Id, DiscountCode, Percentage, CONVERT(VARCHAR(10),StartDate,101) as StartDate, + CONVERT(VARCHAR(10),EndDate,101) as EndDate, (CASE IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS Status + FROM Discount WHERE StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE StartDate END) + AND EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE EndDate END) + AND DiscountCode like (CASE WHEN LEN(@sDiscountCode) > 0 THEN '%' + @sDiscountCode + '%' ELSE DiscountCode END)) + as LD + where + RowNo > @pageLength * (@pageNo - 1) AND + RowNo <= @pageLength * @pageNo + +--Calculate total number of records +select @recordCount = count(ResultTable.Id) from +(Select Id, DiscountCode, Percentage, CONVERT(VARCHAR(10),StartDate,101) as StartDate, +CONVERT(VARCHAR(10),EndDate,101) as EndDate, (CASE IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS Status +FROM Discount WHERE StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE StartDate END) +AND EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE EndDate END) +AND DiscountCode like (CASE WHEN LEN(@sDiscountCode) > 0 THEN '%' + @sDiscountCode + '%' ELSE DiscountCode END)) as ResultTable; + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountReport.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountReport.sql new file mode 100644 index 0000000..4f73992 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetDiscountReport.sql @@ -0,0 +1,88 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetDiscountReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetDiscountReport] +GO + +CREATE PROCEDURE [dbo].[usp_GetDiscountReport] + -- Add the parameters for the stored procedure here + @sStartDate VARCHAR(20) = '', @sEndDate VARCHAR(20) = '', @intDiscountID INT, + @sAccoutNumber VARCHAR(16)='', @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + + IF 1=0 BEGIN + SET FMTONLY OFF + END + + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + DECLARE @dtStartDate DATETIME, @dtEndDate DATETIME + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + IF LEN(@sAccoutNumber) > 0 + BEGIN + + Select RowNum, DiscountCode, Percentage, StartDate, EndDate, DiscountStatus, TotalLicenses + from ( + SELECT ROW_NUMBER() OVER (ORDER BY Discount.StartDate) AS RowNum , Discount.DiscountCode, Discount.Percentage, CONVERT(VARCHAR(10),Discount.StartDate,101) as StartDate, + CONVERT(VARCHAR(10),Discount.EndDate,101) as EndDate, + (CASE Discount.IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS DiscountStatus, + COUNT(DiscountToLicense.LicenseId) AS TotalLicenses + FROM Discount INNER JOIN DiscountToLicense ON Discount.Id = DiscountToLicense.DiscountId + INNER JOIN License ON License.Id = DiscountToLicense.LicenseId + WHERE Discount.StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE Discount.StartDate END) + AND Discount.EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE Discount.EndDate END) + AND Discount.Id = (CASE WHEN @intDiscountID > 0 THEN @intDiscountID ELSE Discount.Id END) + AND License.AccountNumber = @sAccoutNumber + GROUP BY Discount.DiscountCode, Discount.Percentage, Discount.StartDate, Discount.EndDate, Discount.IsActive) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by StartDate + + --Calculate total number of records + select @recordCount = count(ResultTable.DiscountCode) from ( + SELECT Discount.DiscountCode, Discount.Percentage, CONVERT(VARCHAR(10),Discount.StartDate,101) as StartDate, + CONVERT(VARCHAR(10),Discount.EndDate,101) as EndDate, + (CASE Discount.IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS DiscountStatus, + COUNT(DiscountToLicense.LicenseId) AS TotalLicenses + FROM Discount INNER JOIN DiscountToLicense ON Discount.Id = DiscountToLicense.DiscountId + INNER JOIN License ON License.Id = DiscountToLicense.LicenseId + WHERE Discount.StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE Discount.StartDate END) + AND Discount.EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE Discount.EndDate END) + AND Discount.Id = (CASE WHEN @intDiscountID > 0 THEN @intDiscountID ELSE Discount.Id END) + AND License.AccountNumber = @sAccoutNumber + GROUP BY Discount.DiscountCode, Discount.Percentage, Discount.StartDate, Discount.EndDate, Discount.IsActive) as ResultTable; + + END + ELSE + BEGIN + + Select RowNum, DiscountCode, Percentage, StartDate, EndDate, DiscountStatus, TotalLicenses + from ( + SELECT ROW_NUMBER() OVER (ORDER BY Discount.StartDate) AS RowNum , Discount.DiscountCode, Discount.Percentage, CONVERT(VARCHAR(10),Discount.StartDate,101) as StartDate, + CONVERT(VARCHAR(10),Discount.EndDate,101) as EndDate, + (CASE Discount.IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS DiscountStatus, + COUNT(DiscountToLicense.LicenseId) AS TotalLicenses + FROM Discount LEFT JOIN DiscountToLicense ON Discount.Id = DiscountToLicense.DiscountId + WHERE Discount.StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE Discount.StartDate END) + AND Discount.EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE Discount.EndDate END) + AND Discount.Id = (CASE WHEN @intDiscountID > 0 THEN @intDiscountID ELSE Discount.Id END) + GROUP BY Discount.DiscountCode, Discount.Percentage, Discount.StartDate, Discount.EndDate, Discount.IsActive) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by StartDate + + --Calculate total number of records + select @recordCount = count(ResultTable.DiscountCode) from ( + SELECT Discount.DiscountCode, Discount.Percentage, CONVERT(VARCHAR(10),Discount.StartDate,101) as StartDate, + CONVERT(VARCHAR(10),Discount.EndDate,101) as EndDate, + (CASE Discount.IsActive WHEN 1 THEN 'Active' ELSE 'Inactive' END) AS DiscountStatus, + COUNT(DiscountToLicense.LicenseId) AS TotalLicenses + FROM Discount LEFT JOIN DiscountToLicense ON Discount.Id = DiscountToLicense.DiscountId + WHERE Discount.StartDate >= (CASE WHEN LEN(@sStartDate) > 0 THEN @dtStartDate ELSE Discount.StartDate END) + AND Discount.EndDate <= (CASE WHEN LEN(@sEndDate) > 0 THEN @dtEndDate ELSE Discount.EndDate END) + AND Discount.Id = (CASE WHEN @intDiscountID > 0 THEN @intDiscountID ELSE Discount.Id END) + GROUP BY Discount.DiscountCode, Discount.Percentage, Discount.StartDate, Discount.EndDate, Discount.IsActive) as ResultTable; + + END + +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExpiringLicenses.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExpiringLicenses.sql new file mode 100644 index 0000000..d4329ba --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExpiringLicenses.sql @@ -0,0 +1,161 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetExpiringLicenses]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetExpiringLicenses] +GO + +CREATE PROCEDURE [dbo].[usp_GetExpiringLicenses] --'2010-01-01','2020-01-01',0,1,0,0,'',0,0,1,10,0 + -- Add the parameters for the stored procedure here + @sFromDate varchar(20), @sToDate varchar(20), @iStartPrice numeric(14,2), @iEndPrice numeric(14,2), + @iLicenseTypeId int, @iAccountTypeId int, @sZip varchar(20)=null, @iStateId int, @iCountryId int + ,@pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + + IF 1=0 BEGIN + SET FMTONLY OFF + END + + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON; + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + DECLARE @cGetLicenseId CURSOR + DECLARE @iLicenseId INT + DECLARE @iLicenseSubscriptionDetail INT + DECLARE @sAccountNumber VARCHAR(50) + DECLARE @sLicenseeName VARCHAR(100) + DECLARE @sLicenseType VARCHAR(50) + DECLARE @sInstitutionName VARCHAR(100) + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @mSubscriptionPrice MONEY + DECLARE @sAccountType VARCHAR(50) + DECLARE @sEdition VARCHAR(200) + DECLARE @iDaysRemaining INT + DECLARE @iCardNumber INT + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + -- create a temporary table to store the desired results of license which are going to be expire on the basis of parameter + CREATE TABLE #ExpiringLicenseReport + ( + AccountNumber VARCHAR(50), + LicenseeName VARCHAR(100), + LicenseType VARCHAR(50), + InstitutionName VARCHAR(100), + Edition VARCHAR(200), + ValidFrom DATETIME, + ValidThrough DATETIME, + LicenseCreationDate DATETIME, + Price MONEY, + AccountType VARCHAR(50), + DaysRemaining INT, + CardNumber INT + ) + + -- define the forward only, read-only cursor + SET @cGetLicenseId = CURSOR FAST_FORWARD + FOR + SELECT LicenseSubscriptionDetail.LicenseId, MAX(LicenseSubscriptionDetail.Id) + FROM LicenseSubscriptionDetail WHERE + (TotalAmount >= (CASE WHEN @iStartPrice > 0 THEN @iStartPrice ELSE 0 END)) + AND (TotalAmount <= (CASE WHEN @iEndPrice = 0 THEN 0 WHEN @iEndPrice > 0 THEN @iEndPrice ELSE 9999999999 END)) + GROUP BY LicenseSubscriptionDetail.LicenseId + HAVING (MAX(SubscriptionValidThrough) BETWEEN @dtFromDate AND @dtToDate) + + -- open & fetch the cursor variables into the local variables + OPEN @cGetLicenseId + FETCH NEXT FROM @cGetLicenseId INTO @iLicenseId, @iLicenseSubscriptionDetail + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + + SET @sEdition = '' + -- fetch the accountnumber, licenseename, licensetype, startdate, enddate, subscriptionprice, accountype & days remaining to expire for a license + SELECT @sAccountNumber = AccountNumber, @sLicenseeName = LicenseeName, @sLicenseType = LicenseType, + @sInstitutionName = InstitutionName, @dtLicenseCreationDate = CreationDate, + @dtStartDate = SubscriptionValidFrom, @dtEndDate = SubscriptionValidThrough, + @mSubscriptionPrice = TotalAmount, @sAccountType = AccountType, @iDaysRemaining = DaysRemaining, @iCardNumber = CardNumber + FROM + ( + SELECT AccountNumber, (LicenseeFirstName+' '+LicenseeLastName) as LicenseeName, + LicenseType.Title as LicenseType, AccountType.Title as AccountType, + License.InstitutionName,License.CreationDate, + LicenseSubscriptionDetail.TotalAmount, + LicenseSubscriptionDetail.SubscriptionValidFrom, LicenseSubscriptionDetail.SubscriptionValidThrough, + DATEDIFF(dd,GETDATE(),LicenseSubscriptionDetail.SubscriptionValidThrough) as DaysRemaining, (CASE WHEN License.CardNumber > 0 THEN License.CardNumber END) as CardNumber + FROM License + INNER JOIN LicenseType ON License.LicenseTypeId = LicenseType.Id + INNER JOIN AccountType ON License.AccountTypeId = AccountType.Id + INNER JOIN LicenseSubscriptionDetail ON License.Id = LicenseSubscriptionDetail.LicenseId + INNER JOIN State ON License.StateId = State.Id + INNER JOIN Country ON License.CountryId = Country.Id + WHERE License.IsActive = 1 + AND License.LicenseTypeId = (CASE WHEN @iLicenseTypeId > 0 THEN @iLicenseTypeId ELSE License.LicenseTypeId END) + AND License.AccountTypeId = (CASE WHEN @iAccountTypeId > 0 THEN @iAccountTypeId ELSE License.AccountTypeId END) + AND State.Id = (CASE WHEN @iStateId > 0 THEN @iStateId ELSE State.Id END) + AND Country.Id = (CASE WHEN @iCountryId > 0 THEN @iCountryId ELSE Country.Id END) + AND (@sZip is NULL or License.Zip = (CASE WHEN LEN(@sZip)>0 THEN @sZip ELSE License.Zip END)) + AND LicenseSubscriptionDetail.Id = @iLicenseSubscriptionDetail + AND License.LicenseTypeId <> 5 + ) t1 + WHERE DaysRemaining>=0 + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + -- fetch all the editions mapped as a string with a license + SELECT @sEdition = Edition.Title + '; ' + @sEdition + FROM LicenseToEdition INNER JOIN Edition + ON LicenseToEdition.EditionId = Edition.Id + WHERE LicenseToEdition.LicenseId = @iLicenseId + -- remove the trailing comma-separator from the edition-string + SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1); + + -- insert into the temporary table + INSERT INTO #ExpiringLicenseReport + (AccountNumber, LicenseeName, LicenseType,InstitutionName, Edition, ValidFrom, ValidThrough,LicenseCreationDate, Price, AccountType, DaysRemaining,CardNumber) + VALUES(@sAccountNumber,@sLicenseeName,@sLicenseType,@sInstitutionName,@sEdition,@dtStartDate,@dtEndDate,@dtLicenseCreationDate, @mSubscriptionPrice,@sAccountType,@iDaysRemaining,@iCardNumber) + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetLicenseId INTO @iLicenseId,@iLicenseSubscriptionDetail + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetLicenseId + DEALLOCATE @cGetLicenseId + + -- Selecting the desired result from temporary table + --SELECT AccountNumber,LicenseeName,LicenseType,InstitutionName,Edition, + --CONVERT(VARCHAR,ValidFrom,101) as StartDate,CONVERT(VARCHAR,ValidThrough,101) as EndDate, + --CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + --CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,AccountType,DaysRemaining, CardNumber + --FROM #ExpiringLicenseReport ORDER BY AccountNumber + + + SELECT RowNum, AccountNumber,LicenseeName,LicenseType,InstitutionName,Edition, + StartDate,EndDate,LicenseCreationDate,SubscriptionPrice,AccountType,DaysRemaining, CardNumber + from ( + SELECT ROW_NUMBER() OVER (ORDER BY AccountNumber) AS RowNum, AccountNumber,LicenseeName,LicenseType,InstitutionName,Edition, + CONVERT(VARCHAR,ValidFrom,101) as StartDate,CONVERT(VARCHAR,ValidThrough,101) as EndDate, + CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,AccountType,DaysRemaining, CardNumber + FROM #ExpiringLicenseReport) as Tempt + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo + ORDER BY AccountNumber + + --Calculate total number of records + select @recordCount = count(ResultTable.AccountNumber) + from ( + SELECT AccountNumber,LicenseeName,LicenseType,InstitutionName,Edition, + CONVERT(VARCHAR,ValidFrom,101) as StartDate,CONVERT(VARCHAR,ValidThrough,101) as EndDate, + CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,AccountType,DaysRemaining, CardNumber + FROM #ExpiringLicenseReport ) as ResultTable + + -- Dropping the temporary table + DROP TABLE #ExpiringLicenseReport +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExportedImageDetails.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExportedImageDetails.sql new file mode 100644 index 0000000..2f0badb --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetExportedImageDetails.sql @@ -0,0 +1,58 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetExportedImageDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetExportedImageDetails] +GO + +CREATE PROCEDURE [dbo].[usp_GetExportedImageDetails] + @sStartDate varchar(20) = '', @sEndDate varchar(20) = '', @sAccoutNumber varchar(50)='', @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + Select RowNum, LicenseId, ExportedDate, ImageName, AccountNumber, OriginalFileName, Title, ModuleName, ExportLimit, UserName, imageCount + from ( + SELECT ROW_NUMBER() OVER (ORDER BY LID.LicenseId) AS RowNum , LID.LicenseId, + LID.ExportedDate, + LID.ImageName, + L.AccountNumber, + LID.OriginalFileName, + LID.Title, + LID.ModuleName, + (SELECT TOP(1) LSD.NoofImages FROM LicenseSubscriptionDetail LSD WHERE LSD.LicenseId = LID.LicenseId order by LSD.SubscriptionValidFrom desc) as ExportLimit, + USR.FirstName + ' '+ USR.LastName as UserName, + (SELECT COUNT(LID1.Id) FROM LicenseImageExportDetail LID1 WHERE LID1.LicenseId = LID.LicenseId group by LID1.LicenseId) as imageCount + FROM + LicenseImageExportDetail LID + LEFT JOIN License L ON LID.LicenseId =L.Id + INNER JOIN AIAUser USR ON LID.UserId = USR.Id + WHERE + ((LEN(@sStartDate)=0) OR (LID.ExportedDate >= (CONVERT(DATETIME,@sStartDate)))) AND + ((LEN(@sEndDate)=0) OR (LID.ExportedDate <= (DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate)))))) AND + ((LEN(@sAccoutNumber)=0) OR (AccountNumber LIKE '%'+@sAccoutNumber+'%'))) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by LicenseId + + --Calculate total number of records + select @recordCount = count(ResultTable.LicenseId) from ( + SELECT LID.LicenseId, + LID.ExportedDate, + LID.ImageName, + L.AccountNumber, + LID.OriginalFileName, + LID.Title, + LID.ModuleName, + (SELECT TOP(1) LSD.NoofImages FROM LicenseSubscriptionDetail LSD WHERE LSD.LicenseId = LID.LicenseId order by LSD.SubscriptionValidFrom desc) as ExportLimit, + USR.FirstName + ' '+ USR.LastName as UserName, + (SELECT COUNT(LID1.Id) FROM LicenseImageExportDetail LID1 WHERE LID1.LicenseId = LID.LicenseId group by LID1.LicenseId) as imageCount + FROM + LicenseImageExportDetail LID + LEFT JOIN License L ON LID.LicenseId =L.Id + INNER JOIN AIAUser USR ON LID.UserId = USR.Id + WHERE + ((LEN(@sStartDate)=0) OR (LID.ExportedDate >= (CONVERT(DATETIME,@sStartDate)))) AND + ((LEN(@sEndDate)=0) OR (LID.ExportedDate <= (DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate)))))) AND + ((LEN(@sAccoutNumber)=0) OR (AccountNumber LIKE '%'+@sAccoutNumber+'%'))) as ResultTable; + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetModuleStatusByLicenseId.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetModuleStatusByLicenseId.sql new file mode 100644 index 0000000..435ae9e --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetModuleStatusByLicenseId.sql @@ -0,0 +1,23 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetModuleStatusByLicenseId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetModuleStatusByLicenseId] +GO + +CREATE PROCEDURE [dbo].[usp_GetModuleStatusByLicenseId] + -- Add the parameters for the stored procedure here + @iLicenseId int +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + -- Insert statements for procedure here + SELECT ResourceModule.Id,ResourceModule.Title,ModuleToLicense.Status + FROM ResourceModule + INNER JOIN ModuleToLicense ON ResourceModule.Id = ModuleToLicense.ModuleId + WHERE ModuleToLicense.LicenseId = @iLicenseId +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetNetAdSummaryReport.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetNetAdSummaryReport.sql new file mode 100644 index 0000000..77d5463 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetNetAdSummaryReport.sql @@ -0,0 +1,183 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetNetAdSummaryReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetNetAdSummaryReport] +GO + +CREATE PROCEDURE [dbo].[usp_GetNetAdSummaryReport] --'2015-05-01','2018-05-01',0,0,0,1,100,1000 + -- Add the parameters for the stored procedure here + -- FromDate & ToDate are mandatory + @sFromDate varchar(20), @sToDate varchar(20), @iStartPrice numeric(14,2), @iEndPrice numeric(14,2), @iLicenseTypeId tinyint, + @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + + IF 1=0 BEGIN + SET FMTONLY OFF + END + + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON; + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + DECLARE @cGetSummary CURSOR + DECLARE @iLicenseId INT + DECLARE @iLicenseSubscriptioId INT + DECLARE @iActiveSubscription INT + DECLARE @iRenewSubscription INT + DECLARE @iCancelSubscription INT + DECLARE @iNetAdSubscription INT + DECLARE @sLicenseType VARCHAR(50) + DECLARE @sInstitutionname VARCHAR(100) + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @sAccountType VARCHAR(50) + DECLARE @IsActive BIT + DECLARE @sRenew BIT + + -- set the default parameters to 0 + SET @iActiveSubscription = 0 + SET @iRenewSubscription = 0 + SET @iCancelSubscription = 0 + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + -- create a temporary table to store the first-level of result shown in the netad subscription report on the basis of parameter + CREATE TABLE #NetAdSummaryReport + ( + LicenseType VARCHAR(50), + AccountType VARCHAR(50), + InstitutionName VARCHAR(100), + LicenseCreationDate DATETIME, + IsActive BIT, + IsRenew BIT + ) + CREATE CLUSTERED INDEX IK_NetAdSummaryReport_1 ON #NetAdSummaryReport (LicenseType, AccountType) + CREATE NONCLUSTERED INDEX IK_NetAdSummaryReport_2 ON #NetAdSummaryReport (IsActive) + + -- create a temporary table + CREATE TABLE #NetAdResult + ( + LicenseType VARCHAR(50), + AccountType VARCHAR(50), + InstitutionName VARCHAR(100), + LicenseCreationDate DATETIME, + ActiveSubscription INT, + RenewSubscription INT, + InActiveSubscription INT, + NetAdSubscription INT + ) + + -- define the forward only, read-only cursor + SET @cGetSummary = CURSOR FAST_FORWARD + FOR + SELECT License.Id, LicenseSubscriptionDetail.Id + FROM LicenseSubscriptionDetail + INNER JOIN License ON LicenseSubscriptionDetail.LicenseId = License.Id WHERE + ((License.CancellationDate BETWEEN @dtFromDate AND @dtToDate AND License.IsActive = 0 ) + OR (License.CreationDate BETWEEN @dtFromDate AND @dtToDate ) + OR (RenewalDate BETWEEN @dtFromDate AND @dtToDate)) + AND License.LicenseTypeId = (CASE WHEN @iLicenseTypeId > 0 THEN @iLicenseTypeId ELSE License.LicenseTypeId END) + AND (TotalAmount >= (CASE WHEN @iStartPrice > 0 THEN @iStartPrice ELSE 0 END)) + AND (TotalAmount <= (CASE WHEN @iEndPrice = 0 THEN 0 WHEN @iEndPrice > 0 THEN @iEndPrice ELSE 9999999999 END)) + AND License.LicenseTypeId <> 5 + GROUP BY License.Id, LicenseSubscriptionDetail.Id + + + -- open & fetch the cursor variables into the local variables + OPEN @cGetSummary + FETCH NEXT FROM @cGetSummary INTO @iLicenseId, @iLicenseSubscriptioId + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + + -- fetch the licensetype, accountype & the status of a license + SELECT @sLicenseType = LicenseType.Title, @sAccountType = AccountType.Title, + @sInstitutionname = License.InstitutionName, @dtLicenseCreationDate = License.CreationDate, + @IsActive = License.IsActive, + @sRenew = (CASE WHEN LicenseSubscriptionDetail.RenewalDate IS NULL THEN 0 ELSE 1 END) + FROM License + INNER JOIN LicenseType ON License.LicenseTypeId = LicenseType.Id + INNER JOIN AccountType ON License.AccountTypeId = AccountType.Id + INNER JOIN LicenseSubscriptionDetail ON LicenseSubscriptionDetail.LicenseId = License.Id + WHERE License.Id = @iLicenseId + AND LicenseSubscriptionDetail.Id = @iLicenseSubscriptioId + + + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + + IF @IsActive = 1 + BEGIN + IF @sRenew = 1 + BEGIN + SET @iRenewSubscription = @iRenewSubscription + 1 + END + ELSE + BEGIN + SET @iActiveSubscription = @iActiveSubscription + 1 + END + END + ELSE + BEGIN + IF @sRenew = 1 + BEGIN + SET @iRenewSubscription = @iRenewSubscription + 1 + END + ELSE + BEGIN + SET @iCancelSubscription = @iCancelSubscription + 1 + END + END + + -- insert into the temporary table + INSERT INTO #NetAdSummaryReport + (LicenseType,AccountType,InstitutionName,LicenseCreationDate,IsActive,IsRenew) + VALUES(@sLicenseType,@sAccountType,@sInstitutionname,@dtLicenseCreationDate,@IsActive,@sRenew) + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetSummary INTO @iLicenseId, @iLicenseSubscriptioId + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetSummary + DEALLOCATE @cGetSummary + + -- Selecting the desired result from temporary table + INSERT INTO #NetAdResult (LicenseType, AccountType,InstitutionName,LicenseCreationDate,ActiveSubscription, RenewSubscription, InActiveSubscription, + NetAdSubscription) + SELECT LicenseType,AccountType,MAX(InstitutionName) as InstitutionName, MAX(LicenseCreationDate) as LicenseCreationDate,(SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsActive = 1 AND IsRenew = 0) as ActiveSubscription, + (SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsRenew = 1) as RenewSubscription, + (SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsActive = 0 AND IsRenew = 0) as InActiveSubscription, + ((SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsActive = 1 AND IsRenew = 0) + (SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsRenew = 1) - (SELECT COUNT(1) FROM #NetAdSummaryReport + WHERE LicenseType = N1.LicenseType AND AccountType = N1.AccountType AND IsActive = 0)) as NetAdSubscription + FROM #NetAdSummaryReport N1 GROUP BY LicenseType,AccountType + + -- to show the sum of active, renew, cancel & netad subscriptions + if((Select COUNT(*) from #NetAdResult)>0) + begin + INSERT INTO #NetAdResult (LicenseType,LicenseCreationDate, ActiveSubscription, RenewSubscription, InActiveSubscription, + NetAdSubscription) SELECT 'Total','9999-01-01', @iActiveSubscription, @iRenewSubscription, @iCancelSubscription, + (@iActiveSubscription+@iRenewSubscription-@iCancelSubscription) + End + + Select RowNum, LicenseType, AccountType,InstitutionName,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, ActiveSubscription, RenewSubscription, InActiveSubscription, + NetAdSubscription + from ( + SELECT ROW_NUMBER() OVER (ORDER BY LicenseCreationDate Asc) AS RowNum ,LicenseType, AccountType,InstitutionName,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, ActiveSubscription, RenewSubscription, InActiveSubscription, + NetAdSubscription FROM #NetAdResult) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by LicenseCreationDate desc + + --Calculate total number of records + select @recordCount = count(ResultTable.NetAdSubscription) from (SELECT LicenseType, AccountType,InstitutionName,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, ActiveSubscription, RenewSubscription, InActiveSubscription, + NetAdSubscription FROM #NetAdResult) as ResultTable; + + -- Dropping the temporary tables + DROP TABLE #NetAdSummaryReport + DROP TABLE #NetAdResult +END diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSearchUsers.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSearchUsers.sql new file mode 100644 index 0000000..cd08938 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSearchUsers.sql @@ -0,0 +1,191 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSearchUsers]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSearchUsers] +GO + +Create PROCEDURE [dbo].[usp_GetSearchUsers]--'','','','',0,0,0,1,10,0 + -- Add the parameters for the stored procedure here + @sFirstName varchar(100) = '', @sLastName varchar(100) = '', @sEmailId varchar(100) = '', + @sAccoutNumber varchar(100) ='', @iUserTypeId int, @iAccountTypeId int, @iLoginUserType int, + @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + + DECLARE @SQL NVARCHAR(MAX) + -- create a temporary table to store the desired results of user on the basis of parameter + CREATE TABLE #UserResult + ( + RowNums int IDENTITY PRIMARY KEY, + Id INT, + FirstName VARCHAR(100), + LastName VARCHAR(100), + LoginId VARCHAR(50), + EmailId VARCHAR(50), + UserTypeTitle VARCHAR(50), + Password VARCHAR(50), + CreationDate DATETIME, + ModifiedDate DATETIME, + AccountNumber VARCHAR(50) DEFAULT '', + AccountTypeTitle VARCHAR(50) DEFAULT '', + EditionType VARCHAR(50) DEFAULT '', + UserStatus VARCHAR(8), + UserTypeId INT, + EditionTypeId INT DEFAULT '' + ) + /*SET @sFirstName = REPLACE(@sFirstName,' ',' OR ') + SET @sLastName = REPLACE(@sLastName,' ',' OR ')*/ + SET @SQL = '' + IF LEN(@sAccoutNumber) > 0 OR @iAccountTypeId > 0 + BEGIN + -- fetch account number, state, zip, country of the license to which the user is belonged + + SET @SQL = 'INSERT INTO #UserResult (Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, + ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId, EditionTypeId) + SELECT AIAUser.Id, ISNULL(AIAUser.FirstName,''''), ISNULL(AIAUser.LastName,''''), AIAUser.LoginId, ISNULL(AIAUser.EmailId,'''') as EmailId, + UserType.Title as UserTypeTitle, AIAUser.Password, AIAUser.CreationDate, ISNULL(AIAUser.ModifiedDate,'''') as ModifiedDate, + ISNULL(License.AccountNumber,'''') as AccountNumber, ISNULL(AccountType.Title,'''') as AccountTypeTitle, + ISNULL(Edition.Title,'''') as EditionType, + (CASE AIAUser.IsActive WHEN 1 THEN ''Active'' ELSE ''Inactive'' END) as UserStatus, + UserType.Id as UserTypeId, ISNULL(Edition.Id,'''') as EditionTypeId + FROM AIAUser + INNER JOIN UserType ON UserType.Id = AIAUser.UserTypeId + INNER JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId + INNER JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id + INNER JOIN License ON LicenseToEdition.LicenseId = License.Id + INNER JOIN AccountType ON AccountType.Id = License.AccountTypeId + INNER JOIN Edition ON Edition.Id = LicenseToEdition.EditionId + WHERE + License.IsActive = 1 + AND UserType.Priority >' +CONVERT(VARCHAR(20),@iLoginUserType) + + IF LEN(@sAccoutNumber)>0 + BEGIN + SET @SQL = @SQL + ' AND License.AccountNumber = '''+@sAccoutNumber+'''' + END + IF @iAccountTypeId > 0 + BEGIN + SET @SQL = @SQL + ' AND License.AccountTypeId = '''+CONVERT(VARCHAR(20),@iAccountTypeId)+'''' + END + IF LEN(@sFirstName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.FirstName LIKE ''%'+@sFirstName+'%'')' --CONTAINS(AIAUser.FirstName, '''+@sFirstName+''')' + END + IF LEN(@sLastName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.LastName LIKE ''%'+@sLastName+'%'')'--CONTAINS(AIAUser.LastName, '''+@sLastName+''')' + END + IF LEN(@sEmailId)>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.EmailId = '''+@sEmailId+'''' + END + IF @iUserTypeId>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.UserTypeId = '''+CONVERT(VARCHAR(20),@iUserTypeId)+'''' + END + -- select @SQL + EXEC SP_EXECUTESQL @SQL + + END + ELSE + BEGIN + + SET @SQL = 'INSERT INTO #UserResult (Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, + ModifiedDate, UserStatus, UserTypeId) + SELECT AIAUser.Id, ISNULL(AIAUser.FirstName,''''), ISNULL(AIAUser.LastName,''''), + AIAUser.LoginId, ISNULL(AIAUser.EmailId,''''), UserType.Title, AIAUser.Password, AIAUser.CreationDate, + ISNULL(AIAUser.ModifiedDate,''''), (CASE AIAUser.IsActive WHEN 1 THEN ''Active'' ELSE ''Inactive'' END), + UserType.Id + FROM AIAUser + INNER JOIN UserType ON UserType.Id = AIAUser.UserTypeId + WHERE UserType.Title in (''General Admin'')' + + IF LEN(@sFirstName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.FirstName LIKE ''%'+@sFirstName+'%'')'--CONTAINS(AIAUser.FirstName, '''+@sFirstName+''')' + END + IF LEN(@sLastName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.LastName LIKE ''%'+@sLastName+'%'')'--CONTAINS(AIAUser.LastName, '''+@sLastName+''')' + END + IF LEN(@sEmailId)>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.EmailId = '''+@sEmailId+'''' + END + IF @iUserTypeId>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.UserTypeId = '''+CONVERT(VARCHAR(20),@iUserTypeId)+'''' + END + -- select @SQL + EXEC SP_EXECUTESQL @SQL + + -- fetch account number, state, zip, country of the license to which the user is belonged + SET @SQL = 'INSERT INTO #UserResult (Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, + ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId, EditionTypeId) + SELECT AIAUser.Id, ISNULL(AIAUser.FirstName,''''), ISNULL(AIAUser.LastName,''''), AIAUser.LoginId, ISNULL(AIAUser.EmailId,''''), + UserType.Title, AIAUser.Password, AIAUser.CreationDate, ISNULL(AIAUser.ModifiedDate,''''), + License.AccountNumber, AccountType.Title, Edition.Title, + (CASE AIAUser.IsActive WHEN 1 THEN ''Active'' ELSE ''Inactive'' END), UserType.Id, Edition.Id + FROM AIAUser + INNER JOIN UserType ON UserType.Id = AIAUser.UserTypeId + INNER JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId + INNER JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id + INNER JOIN License ON LicenseToEdition.LicenseId = License.Id + INNER JOIN AccountType ON AccountType.Id = License.AccountTypeId + INNER JOIN Edition ON Edition.Id = LicenseToEdition.EditionId + WHERE + UserType.Title NOT IN (''Super Admin'',''General Admin'') + AND License.IsActive = 1' + + IF LEN(@sAccoutNumber)>0 + BEGIN + SET @SQL = @SQL + ' AND License.AccountNumber = '''+@sAccoutNumber+'''' + END + IF @iAccountTypeId > 0 + BEGIN + SET @SQL = @SQL + ' AND License.AccountTypeId = '''+CONVERT(VARCHAR(20),@iAccountTypeId)+'''' + END + IF LEN(@sFirstName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.FirstName LIKE ''%'+@sFirstName+'%'')'--CONTAINS(AIAUser.FirstName, '''+@sFirstName+''')' + END + IF LEN(@sLastName)>0 + BEGIN + SET @SQL = @SQL + ' AND (AIAUser.LastName LIKE ''%'+@sLastName+'%'')'--CONTAINS(AIAUser.LastName, '''+@sLastName+''')' + END + IF LEN(@sEmailId)>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.EmailId = '''+@sEmailId+'''' + END + IF @iUserTypeId>0 + BEGIN + SET @SQL = @SQL + ' AND AIAUser.UserTypeId = '''+CONVERT(VARCHAR(20),@iUserTypeId)+'''' + END + --select @SQL + EXEC SP_EXECUTESQL @SQL + + END + -- Selecting the desired result from temporary table + Select RowNum,Id, FirstName, LastName,LoginId, EmailId,UserTypeTitle, Password, CreationDate, + ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId,EditionTypeId + from ( + SELECT ROW_NUMBER() OVER (ORDER BY Id) AS RowNum ,Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, + ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId, EditionTypeId FROM #UserResult) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by Id --RowNum BETWEEN @pageNo AND (@pageNo - 1) * @pageLength +--SELECT RowNum, Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, +-- ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId, EditionTypeId FROM #UserResult +-- where RowNum > (@pageLength * (@pageNo - 1)) AND (RowNo <= (@pageLength * @pageNo)) order by RowNum + -- order by Id + -- order by Id OFFSET ((@pageNo - 1) * @pageLength) ROWS FETCH NEXT @pageLength ROWS ONLY; + + + + --Calculate total number of records + select @recordCount = count(ResultTable.Id) from (SELECT Id, FirstName, LastName, LoginId, EmailId, UserTypeTitle, Password, CreationDate, + ModifiedDate, AccountNumber, AccountTypeTitle, EditionType, UserStatus, UserTypeId, EditionTypeId FROM #UserResult) as ResultTable; + + -- Dropping the temporary table + DROP TABLE #UserResult +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteAccoutDetail.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteAccoutDetail.sql new file mode 100644 index 0000000..24bb37e --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteAccoutDetail.sql @@ -0,0 +1,51 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSiteAccoutDetail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSiteAccoutDetail] +GO + +CREATE PROCEDURE [dbo].[usp_GetSiteAccoutDetail] + -- Add the parameters for the stored procedure here + @strAccountNumber varchar(50)='', @pageNo int, @pageLength int, @recordCount int out + +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + --Get the records on the basis of parameters page length and page number rows + select LD.Id, LD.SiteIp, LD.Title, LD.SiteIPTo, LD.SiteMasterIPTo, LD.CreationDate, LD.ModifiedDate, LD.InstituteName, + LD.Department, LD.UserId, LD.FirstName, LD.EmailId + from + (Select ROW_NUMBER() OVER (ORDER BY Site.Id) AS RowNo, + Site.Id,Site.SiteIp,Site.Title,ISNULL(Site.SiteIPTo,'') as SiteIPTo,ISNULL(Site.SiteMasterIPTo,'') as SiteMasterIPTo, + CONVERT(VARCHAR,Site.CreationDate,101) as CreationDate, + CONVERT(VARCHAR,Site.ModifiedDate,101) as ModifiedDate, + Site.InstituteName,Site.Department, AIAUser.Id as UserId,AIAUser.FirstName,AIAUser.EmailId + From ((Site INNER JOIN AIAUserToSite on Site.Id=AIAUserToSite.SiteId) + INNER JOIN AIAUser on AIAUserToSite.UserId = AIAUser.Id) + Where Site.IsActive=1 and Site.id in + (Select SiteID From SiteToLicenseEdition Where LicenseEditionId in + (Select Id From LicenseToEdition Where LicenseId in + (Select Id From License Where LicenseTypeId=3 and AccountNumber=@strAccountNumber)))) + as LD + where + RowNo > @pageLength * (@pageNo - 1) AND + RowNo <= @pageLength * @pageNo + + --Calculate total number of records + select @recordCount = count(ResultTable.Id) from + (Select Site.Id,Site.SiteIp,Site.Title,ISNULL(Site.SiteIPTo,'') as SiteIPTo,ISNULL(Site.SiteMasterIPTo,'') as SiteMasterIPTo, + CONVERT(VARCHAR,Site.CreationDate,101) as CreationDate, + CONVERT(VARCHAR,Site.ModifiedDate,101) as ModifiedDate, + Site.InstituteName,Site.Department, AIAUser.Id as UserId,AIAUser.FirstName,AIAUser.EmailId + From ((Site INNER JOIN AIAUserToSite on Site.Id=AIAUserToSite.SiteId) + INNER JOIN AIAUser on AIAUserToSite.UserId = AIAUser.Id) + Where Site.IsActive=1 and Site.id in + (Select SiteID From SiteToLicenseEdition Where LicenseEditionId in + (Select Id From LicenseToEdition Where LicenseId in + (Select Id From License Where LicenseTypeId=3 and AccountNumber=@strAccountNumber)))) as ResultTable; + +END + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteLicenseUsageReport.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteLicenseUsageReport.sql new file mode 100644 index 0000000..2936271 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSiteLicenseUsageReport.sql @@ -0,0 +1,56 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSiteLicenseUsageReports]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSiteLicenseUsageReports] +GO + +CREATE PROCEDURE [dbo].[usp_GetSiteLicenseUsageReports] + -- Add the parameters for the stored procedure here + @sFromDate varchar(20), @sToDate varchar(20), @sAccoutNumber varchar(50)='', @iEditionId tinyint = 0, + @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + Select RowNum,AccountNumber, EditionTitle, ReferalUrl, InstitutionName, LicenseCreationDate,TotalLogins,LastLogin + from ( + SELECT ROW_NUMBER() OVER (ORDER BY UserLoginLog.AccountNumber) AS RowNum , UserLoginLog.AccountNumber, Edition.Title AS EditionTitle, UserLoginLog.ReferalUrl, + (SELECT License.InstitutionName FROM License WHERE License.AccountNumber = UserLoginLog.AccountNumber) as InstitutionName, + (SELECT CONVERT(VARCHAR,License.CreationDate,101) FROM License WHERE License.AccountNumber = UserLoginLog.AccountNumber) as LicenseCreationDate, + COUNT(DISTINCT UserLoginLog.LogDate) AS TotalLogins, + CONVERT(VARCHAR,MAX(UserLoginLog.LogDate),101) AS LastLogin FROM + UserLoginLog INNER JOIN Edition ON UserLoginLog.Edition = CAST(Edition.Id AS NVARCHAR) + WHERE UserLoginLog.FailureId IS NULL + AND UserLoginLog.LogDate BETWEEN @dtFromDate AND @dtToDate + AND UserLoginLog.AccountNumber = (CASE WHEN LEN(@sAccoutNumber) > 0 THEN @sAccoutNumber ELSE UserLoginLog.AccountNumber END) + AND Edition.IsActive = 1 + AND Edition.Id = (CASE WHEN @iEditionId > 0 THEN @iEditionId ELSE Edition.Id END) + GROUP BY UserLoginLog.AccountNumber, Edition.Title, UserLoginLog.ReferalUrl) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by AccountNumber + + + --Calculate total number of records + select @recordCount = count(ResultTable.AccountNumber) from ( + SELECT UserLoginLog.AccountNumber, Edition.Title AS EditionTitle, UserLoginLog.ReferalUrl, + (SELECT License.InstitutionName FROM License WHERE License.AccountNumber = UserLoginLog.AccountNumber) as InstitutionName, + (SELECT CONVERT(VARCHAR,License.CreationDate,101) FROM License WHERE License.AccountNumber = UserLoginLog.AccountNumber) as LicenseCreationDate, + COUNT(DISTINCT UserLoginLog.LogDate) AS TotalLogins, + CONVERT(VARCHAR,MAX(UserLoginLog.LogDate),101) AS LastLogin FROM + UserLoginLog INNER JOIN Edition ON UserLoginLog.Edition = CAST(Edition.Id AS NVARCHAR) + WHERE UserLoginLog.FailureId IS NULL + AND UserLoginLog.LogDate BETWEEN @dtFromDate AND @dtToDate + AND UserLoginLog.AccountNumber = (CASE WHEN LEN(@sAccoutNumber) > 0 THEN @sAccoutNumber ELSE UserLoginLog.AccountNumber END) + AND Edition.IsActive = 1 + AND Edition.Id = (CASE WHEN @iEditionId > 0 THEN @iEditionId ELSE Edition.Id END) + GROUP BY UserLoginLog.AccountNumber, Edition.Title, UserLoginLog.ReferalUrl) as ResultTable; + +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSubscribedLicenses.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSubscribedLicenses.sql new file mode 100644 index 0000000..d4108bd --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetSubscribedLicenses.sql @@ -0,0 +1,160 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSubscribedLicenses]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSubscribedLicenses] +GO + +CREATE PROCEDURE [dbo].[usp_GetSubscribedLicenses] + -- Add the parameters for the stored procedure here + @sFromDate varchar(20), @sToDate varchar(20), @iStartPrice numeric(14,2), @iEndPrice numeric(14,2), @iLicenseTypeId tinyint, + @iAccountTypeId tinyint, @sZip varchar(20) = '', @iStateId int, @iCountryId int,@pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON; + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + DECLARE @cGetLicenseID CURSOR + DECLARE @iLicenseId INT + DECLARE @iLicenseSubscriptionDetail INT + DECLARE @sAccountNumber VARCHAR(50) + DECLARE @sLicenseeName VARCHAR(100) + DECLARE @sLicenseType VARCHAR(50) + DECLARE @sInstitutionName VARCHAR(100) + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @mSubscriptionPrice MONEY + DECLARE @sAccountType VARCHAR(50) + DECLARE @sEdition VARCHAR(200) + DECLARE @iCardNumber INT + + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + -- create a temporary table to store the desired results of subscribed licenses on the basis of parameter + CREATE TABLE #SubscribedLicenseReport + ( + AccountNumber VARCHAR(50), + LicenseeName VARCHAR(100), + LicenseType VARCHAR(50), + InstitutionName VARCHAR(100), + Edition VARCHAR(200), + ValidFrom DATETIME, + ValidThrough DATETIME, + LicenseCreationDate DATETIME, + Price MONEY, + AccountType varchar(50), + CardNumber INT + ) + + -- define the forward only, read-only cursor + SET @cGetLicenseID = CURSOR FAST_FORWARD + FOR + SELECT LicenseSubscriptionDetail.LicenseId, MAX(LicenseSubscriptionDetail.Id) + FROM LicenseSubscriptionDetail WHERE + (TotalAmount >= (CASE WHEN @iStartPrice > 0 THEN @iStartPrice ELSE 0 END)) + AND (TotalAmount <= (CASE WHEN @iEndPrice = 0 THEN 0 WHEN @iEndPrice > 0 THEN @iEndPrice ELSE 9999999999 END)) + GROUP BY LicenseSubscriptionDetail.LicenseId + HAVING (MAX(SubscriptionValidFrom) BETWEEN @dtFromDate AND @dtToDate) + + -- open & fetch the cursor variables into the local variables + OPEN @cGetLicenseID + FETCH NEXT FROM @cGetLicenseID INTO @iLicenseId, @iLicenseSubscriptionDetail + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + + SET @sEdition = '' + + -- fetch the accountnumber, licenseename, licensetype, accountype of a license + SELECT @sAccountNumber = AccountNumber, @sLicenseeName = (LicenseeFirstName+' '+LicenseeLastName), + @sLicenseType = LicenseType.Title, @sAccountType = AccountType.Title, + @iCardNumber = (CASE WHEN License.CardNumber > 0 THEN License.CardNumber END), + @sInstitutionName = License.InstitutionName,@dtLicenseCreationDate = License.CreationDate + FROM License + INNER JOIN LicenseType ON License.LicenseTypeId = LicenseType.Id + INNER JOIN AccountType ON License.AccountTypeId = AccountType.Id + INNER JOIN State ON License.StateId = State.Id + INNER JOIN Country ON License.CountryId = Country.Id + WHERE License.Id = @iLicenseId AND License.IsActive = 1 + AND License.LicenseTypeId = (CASE WHEN @iLicenseTypeId > 0 THEN @iLicenseTypeId ELSE License.LicenseTypeId END) + AND License.AccountTypeId = (CASE WHEN @iAccountTypeId > 0 THEN @iAccountTypeId ELSE License.AccountTypeId END) + AND State.Id = (CASE WHEN @iStateId > 0 THEN @iStateId ELSE State.Id END) + AND Country.Id = (CASE WHEN @iCountryId > 0 THEN @iCountryId ELSE Country.Id END) + AND License.Zip = (CASE WHEN LEN(@sZip)>0 THEN @sZip ELSE License.Zip END) + AND License.LicenseTypeId <> 5 + + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + -- fetch startdate, enddate, subscriptionprice of a license + SELECT @mSubscriptionPrice = LicenseSubscriptionDetail.TotalAmount, + @dtStartDate = LicenseSubscriptionDetail.SubscriptionValidFrom, + @dtEndDate = LicenseSubscriptionDetail.SubscriptionValidThrough + FROM LicenseSubscriptionDetail + WHERE LicenseSubscriptionDetail.Id = @iLicenseSubscriptionDetail + + -- fetch all the editions mapped as a string with a license + SELECT @sEdition = Edition.Title + '; ' + @sEdition + FROM LicenseToEdition INNER JOIN Edition + ON LicenseToEdition.EditionId = Edition.Id + WHERE LicenseToEdition.LicenseId = @iLicenseId + -- remove the trailing comma-separator from the edition-string + -- AMI SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1); + IF LEN(@sEdition)> 1 + -- remove the trailing comma-separator from the edition-string + SET @sEdition = SUBSTRING(@sEdition,1,LEN(@sEdition)-1) + ELSE + SET @sEdition = @sEdition + + -- insert into the temporary table + INSERT INTO #SubscribedLicenseReport + (AccountNumber, LicenseeName, LicenseType, InstitutionName, Edition, ValidFrom, ValidThrough,LicenseCreationDate, Price, AccountType,CardNumber) + VALUES(@sAccountNumber,@sLicenseeName,@sLicenseType,@sInstitutionName,@sEdition,@dtStartDate,@dtEndDate,@dtLicenseCreationDate,@mSubscriptionPrice,@sAccountType,@iCardNumber) + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetLicenseID INTO @iLicenseId,@iLicenseSubscriptionDetail + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetLicenseID + DEALLOCATE @cGetLicenseID + + -- Selecting the desired result from temporary table + --SELECT AccountNumber, LicenseeName, LicenseType,InstitutionName, AccountType, Edition, + --CONVERT(VARCHAR,ValidFrom,101) as StartDate, CONVERT(VARCHAR,ValidThrough,101) as EndDate, + --CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + --CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,CardNumber + --FROM #SubscribedLicenseReport ORDER BY AccountNumber + + + SELECT RowNum, AccountNumber, LicenseeName, LicenseType,InstitutionName, AccountType, Edition, + StartDate, EndDate, + LicenseCreationDate, + SubscriptionPrice,CardNumber + from ( + SELECT ROW_NUMBER() OVER (ORDER BY AccountNumber) AS RowNum, AccountNumber, LicenseeName, LicenseType,InstitutionName, AccountType, Edition, + CONVERT(VARCHAR,ValidFrom,101) as StartDate, CONVERT(VARCHAR,ValidThrough,101) as EndDate, + CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,CardNumber + FROM #SubscribedLicenseReport) as Tempt + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo + ORDER BY AccountNumber + + select @recordCount = count(ResultTable.AccountNumber) + from ( + SELECT AccountNumber, LicenseeName, LicenseType,InstitutionName, AccountType, Edition, + CONVERT(VARCHAR,ValidFrom,101) as StartDate, CONVERT(VARCHAR,ValidThrough,101) as EndDate, + CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, + CONVERT(NUMERIC(14,2),Price) as SubscriptionPrice,CardNumber + FROM #SubscribedLicenseReport) as ResultTable + + -- Dropping the temporary table + DROP TABLE #SubscribedLicenseReport +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUsageReport.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUsageReport.sql new file mode 100644 index 0000000..34f51e3 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUsageReport.sql @@ -0,0 +1,143 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetUsageReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetUsageReport] +GO + +CREATE PROCEDURE [dbo].[usp_GetUsageReport] + -- Add the parameters for the stored procedure here + -- FromDate & ToDate are mandatory parameters + @sFromDate varchar(20), @sToDate varchar(20), @sAccoutNumber varchar(50)='', + @sZip varchar(20) = '', @iState int, @iCountry int, + @pageNo int, @pageLength int, @recordCount int out +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + SET NOCOUNT ON + DECLARE @cGetUserDetails CURSOR + DECLARE @iUserId INT + DECLARE @sAccountNumber VARCHAR(50) + DECLARE @iCardNumber INT + DECLARE @sLoginId VARCHAR(50) + DECLARE @sFirstName VARCHAR(100) + DECLARE @sLastName VARCHAR(100) + DECLARE @sUserType VARCHAR(50) + DECLARE @dtFromDate DATETIME + DECLARE @dtToDate DATETIME + DECLARE @dtLicenseCreationDate DATETIME + DECLARE @sLicenseState VARCHAR(50) + DECLARE @sLicenseZip VARCHAR(20) + DECLARE @sLicenseCountry VARCHAR(50) + DECLARE @sInstitutionName VARCHAR(100) + DECLARE @iTotalLogins INT + DECLARE @dtLastLogin DATETIME + + -- convert the datatype of fromdate & todate parameter to datetime + SELECT @dtFromDate = CONVERT(DATETIME,@sFromDate) + SELECT @dtToDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sToDate))) + + -- create a temporary table to store the results of users logged into the system within a particular time period + CREATE TABLE #UsageReport + ( + LoginId VARCHAR(50), + FirstName VARCHAR(100), + LastName VARCHAR(100), + AccountNumber VARCHAR(50), + CardNumber INT, + UserType VARCHAR(50), + LicenseCreationDate DATETIME, + LicenseState VARCHAR(50), + LicenseZip VARCHAR(20), + LicenseCountry VARCHAR(50), + InstitutionName VARCHAR(100), + TotalLogins INT, + LastLoginDate DATETIME + ) + + -- define the forward only, read-only cursor + SET @cGetUserDetails = CURSOR FAST_FORWARD + FOR + SELECT LoginDetail.UserId, COUNT(1) as TotalLogins, MAX(LoginDetail.LoginTime) + FROM LoginDetail WHERE + (LoginTime) BETWEEN @dtFromDate AND @dtToDate + GROUP BY LoginDetail.UserId + + -- open & fetch the cursor variables into the local variables + OPEN @cGetUserDetails + FETCH NEXT FROM @cGetUserDetails INTO @iUserId, @iTotalLogins, @dtLastLogin + -- start of while loop + WHILE @@FETCH_STATUS = 0 + BEGIN + -- fetch account number, state, zip, country of the license to which the user is belonged + SELECT @sAccountNumber = License.AccountNumber, + @dtLicenseCreationDate = License.CreationDate, + @sInstitutionName = License.InstitutionName, + @sLicenseState = State.StateName, + @sLicenseZip = License.Zip, + @sLicenseCountry = Country.CountryName, + @iCardNumber = (CASE WHEN License.CardNumber > 0 THEN License.CardNumber END) + FROM AIAUserToLicenseEdition + INNER JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id + INNER JOIN License ON LicenseToEdition.LicenseId = License.Id + INNER JOIN State ON License.StateId = State.Id + INNER JOIN Country ON License.CountryId = Country.Id + WHERE AIAUserToLicenseEdition.UserId = @iUserId + AND License.IsActive = 1 + AND License.AccountNumber = (CASE WHEN LEN(@sAccoutNumber)>0 THEN @sAccoutNumber ELSE License.AccountNumber END) + AND State.Id = (CASE WHEN @iState > 0 THEN @iState ELSE State.Id END) + AND Country.Id = (CASE WHEN @iCountry > 0 THEN @iCountry ELSE Country.Id END) + AND License.Zip = (CASE WHEN LEN(@sZip)>0 THEN @sZip ELSE License.Zip END) + --AND License.LicenseTypeId <> 5 + --AND License.Country = (CASE WHEN LEN(@sCountry)>0 THEN @sCountry ELSE License.Country END) + + -- check whether the above query returns any row + IF @@Rowcount > 0 + BEGIN + -- fetch loginid, firstname, lastname, usertype of the user + SELECT @sLoginId = AIAUser.LoginId, @sFirstName = AIAUser.Firstname, + @sLastName = AIAUser.LastName, @sUserType = UserType.Title + FROM AIAUser + INNER JOIN UserType ON AIAUser.UserTypeId = UserType.Id + WHERE AIAUser.Id = @iUserId + AND AIAUser.IsActive = 1 + + IF @@Rowcount > 0 + BEGIN + -- insert into the temporary table + INSERT INTO #UsageReport + (LoginId, FirstName, LastName, AccountNumber,CardNumber ,UserType,LicenseCreationDate, LicenseState, LicenseZip, + LicenseCountry,InstitutionName, TotalLogins, LastLoginDate) + VALUES(@sLoginId, @sFirstName, @sLastName, @sAccountNumber, @iCardNumber, @sUserType,@dtLicenseCreationDate, + @sLicenseState, @sLicenseZip, @sLicenseCountry,@sInstitutionName, @iTotalLogins, @dtLastLogin) + END + END + -- fetch the next record from cursor + FETCH NEXT FROM @cGetUserDetails INTO @iUserId, @iTotalLogins, @dtLastLogin + -- end of while loop + END + -- close the cursor to free up resources + CLOSE @cGetUserDetails + DEALLOCATE @cGetUserDetails + + -- Selecting the desired result from temporary table + --SELECT LoginId, FirstName, LastName, AccountNumber, CardNumber,UserType,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, LicenseZip, LicenseState, + --LicenseCountry,InstitutionName, TotalLogins, CONVERT(VARCHAR,LastLoginDate,101) as LastLogin FROM #UsageReport ORDER BY AccountNumber + + Select RowNum,LoginId, FirstName, LastName, AccountNumber, CardNumber,UserType,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, LicenseZip, LicenseState, + LicenseCountry,InstitutionName, TotalLogins, LastLogin + from ( + SELECT ROW_NUMBER() OVER (ORDER BY LoginId) AS RowNum ,LoginId, FirstName, LastName, AccountNumber, CardNumber,UserType,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, LicenseZip, LicenseState, + LicenseCountry,InstitutionName, TotalLogins, CONVERT(VARCHAR,LastLoginDate,101) as LastLogin FROM #UsageReport) as usr + WHERE RowNum > @pageLength * (@pageNo - 1) AND RowNum <= @pageLength * @pageNo order by AccountNumber + + + --Calculate total number of records + select @recordCount = count(ResultTable.LoginId) from (SELECT LoginId, FirstName, LastName, AccountNumber, CardNumber,UserType,CONVERT(VARCHAR,LicenseCreationDate,101) as LicenseCreationDate, LicenseZip, LicenseState, + LicenseCountry,InstitutionName, TotalLogins, CONVERT(VARCHAR,LastLoginDate,101) as LastLogin FROM #UsageReport) as ResultTable; + -- Dropping the temporary table + DROP TABLE #UsageReport +END + + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUserTyeByAccountNumber.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUserTyeByAccountNumber.sql new file mode 100644 index 0000000..ee351f0 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_GetUserTyeByAccountNumber.sql @@ -0,0 +1,53 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetUserTyeByAccountNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetUserTyeByAccountNumber] +GO + +CREATE PROCEDURE [dbo].[usp_GetUserTyeByAccountNumber] + -- Add the parameters for the stored procedure here + @iUserTypeId tinyint, @iLicenseId int +AS +BEGIN + -- returns the metadata + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + DECLARE @sUserType varchar(50) + DECLARE @sLicenseType varchar(50) + -- create a temporary table to store the usertype according to the role and accountnumber + CREATE TABLE #UserTypeToAccountNumber + ( + Id tinyint, + Title varchar(50) + ) + + --SELECT @sUserType = Title FROM UserType WHERE Id = @iUserTypeId + + IF @iLicenseId = 0 + BEGIN + IF @iUserTypeId = 1 + BEGIN + INSERT INTO #UserTypeToAccountNumber SELECT Id, Title FROM UserType WHERE Title = 'General Admin' AND IsActive = 1 + END + END + ELSE + BEGIN + SELECT @sLicenseType = LicenseType.Title FROM License INNER JOIN LicenseType ON LicenseType.Id = License.LicenseTypeId + WHERE License.Id = @iLicenseId + IF @sLicenseType = 'Site License' + BEGIN + INSERT INTO #UserTypeToAccountNumber SELECT Id, Title FROM UserType WHERE Title IN ('Client Admin', 'District Admin') + END + ELSE IF @sLicenseType = 'Concurrent License' + BEGIN + INSERT INTO #UserTypeToAccountNumber SELECT Id, Title FROM UserType WHERE Title IN ('Client Admin', 'Concurrent User') ORDER BY Priority ASC + END + END + SELECT Id,Title FROM #UserTypeToAccountNumber + -- Dropping the temporary table + DROP TABLE #UserTypeToAccountNumber +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertAIAUser.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertAIAUser.sql index f06166c..bd4d1d8 100644 --- a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertAIAUser.sql +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertAIAUser.sql diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewDiscount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewDiscount.sql new file mode 100644 index 0000000..8539bc1 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewDiscount.sql @@ -0,0 +1,53 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_InsertNewDiscount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_InsertNewDiscount] +GO + +CREATE PROCEDURE [dbo].[usp_InsertNewDiscount] + -- Add the parameters for the stored procedure here + @dPercentage DECIMAL(5,2), @sStartDate VARCHAR(20), @sEndDate VARCHAR(20), @sDiscountCode VARCHAR(255)='' +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + BEGIN TRY + BEGIN TRANSACTION + DECLARE @iDiscountId INT, @iDiscountExists INT + DECLARE @iActive TINYINT + DECLARE @dtStartDate DATETIME, @dtEndDate DATETIME + DECLARE @sErrorStatus CHAR(2) + + SET @iActive = 1 + SET @sErrorStatus = 'ok' + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + + INSERT INTO Discount (Percentage, StartDate, EndDate, IsActive) + VALUES(@dPercentage, @dtStartDate, @dtEndDate, @iActive) + -- to get the last inserted discount id identity value in the current session + SET @iDiscountId = SCOPE_IDENTITY() + + IF @sDiscountCode = '' + BEGIN + SET @sDiscountCode = 'InteractiveAnatomy'+RIGHT('000'+CAST(@iDiscountId AS VARCHAR(10)), 3) + SET @iDiscountExists = (SELECT Id FROM Discount WHERE DiscountCode = @sDiscountCode) + IF @iDiscountExists > 0 + BEGIN + UPDATE Discount SET IsActive = 0 WHERE Id = @iDiscountExists + END + END + UPDATE Discount SET DiscountCode = @sDiscountCode WHERE Id = @iDiscountId + + COMMIT + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewLicenseAccount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewLicenseAccount.sql new file mode 100644 index 0000000..aa3c12a --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertNewLicenseAccount.sql @@ -0,0 +1,164 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_InsertNewLicenseAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_InsertNewLicenseAccount] +GO + +CREATE PROCEDURE [dbo].[usp_InsertNewLicenseAccount] + -- Add the parameters for the stored procedure here + @sAccountNumber varchar(50), @sLicenseeFname varchar(50), @sLicenseeLname varchar(50), + @iLicenseTypeId tinyint, @iAccountTypeId tinyint, @sInstitutionName varchar(100)='', @sAddress1 varchar(100)='', + @sAddress2 varchar(100)='', @sCity varchar(50)='', @sZip varchar(20)='', @iStateId int, @iCountryId int, + @sPhone varchar(30) = '', @sEmailId varchar(50), @iTotalLogins int, @sStartDate varchar(20), + @sEndDate varchar(20), @sMasterIP varchar(100) = '', @sEditionList varchar(256), @iPrice numeric(14,2),@sProductKey varchar(50), + @sSiteIPTo varchar(100) = '',@sSiteMasterIPTo varchar(100) = '',@iNoofImages int +AS +BEGIN + + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + BEGIN TRY + BEGIN TRANSACTION + DECLARE @cEditionLogins CURSOR + DECLARE @iLicenseId INT + DECLARE @iSiteId INT + DECLARE @iLicenseEditionId INT + DECLARE @iIsDistrictSiteAccount TINYINT + DECLARE @iActive TINYINT + DECLARE @iIsMasterIP TINYINT + DECLARE @iModesty TINYINT + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @sErrorStatus CHAR(2) + DECLARE @dtCurrentDate DATETIME + DECLARE @sitem VARCHAR(100) + DECLARE @sRecordDelimiter CHAR(1) + DECLARE @sEditionLoginDelimiter CHAR(1) + DECLARE @sCountryCode VARCHAR(10) + DECLARE @iIsInsEditionSelected TINYINT + DECLARE @iIsLibEditionSelected TINYINT + DECLARE @iIsAcademicLibEditionSelected TINYINT + + -- set the parameters to default values + SET @iActive = 1 + SET @iIsMasterIP = 1 + SET @iIsDistrictSiteAccount = 0 + SET @iModesty = 0 + SET @sRecordDelimiter = '|' + SET @sEditionLoginDelimiter = '-' + SET @dtCurrentDate = getdate() + SET @sErrorStatus = 'ok' + SET @iIsInsEditionSelected = 0; + SET @iIsLibEditionSelected = 0; + SET @iIsAcademicLibEditionSelected = 0; + + IF @iStateId = 0 + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + -- set the state to Other if the country is Non-US + SET @sCountryCode = (SELECT CountryCode from Country WHERE Id = @iCountryId) + IF @sCountryCode != 'US' + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + + INSERT INTO License(AccountNumber, LicenseeFirstName, LicenseeLastName, LicenseTypeId, AccountTypeId, + InstitutionName, EmailId, Address1, Address2, City, Zip, StateId, CountryId, Phone, TotalLogins, IsActive, + IsDistrictSiteLicense, CreationDate,ProductId) VALUES (@sAccountNumber, @sLicenseeFname, @sLicenseeLname, @iLicenseTypeId, + @iAccountTypeId, @sInstitutionName, @sEmailId, @sAddress1, @sAddress2, @sCity, @sZip, @iStateId, @iCountryId, + @sPhone, @iTotalLogins, @iActive, @iIsDistrictSiteAccount, @dtCurrentDate,@sProductKey) + -- to get the last inserted license id identity value in the current session + SET @iLicenseId = SCOPE_IDENTITY() + + INSERT INTO LicenseSubscriptionDetail(LicenseId, SubscriptionValidFrom, SubscriptionValidThrough, + TotalAmount, AmountPaid,NoofImages) VALUES(@iLicenseId, @dtStartDate, @dtEndDate, @iPrice, @iPrice,@iNoofImages) + + -- check if license is site license + IF @iLicenseTypeId = 3 + BEGIN + INSERT INTO Site (SiteIP, Title, InstituteName, Address1, Address2, City, Zip, Phone, + StateId, CountryId, IsMaster, IsActive, CreationDate, SiteIPTo, SiteMasterIpTo) + VALUES(@sMasterIP, @sMasterIP, @sInstitutionName, @sAddress1, @sAddress2, @sCity, @sZip, @sPhone, + @iStateId, @iCountryId, @iIsMasterIP, @iActive, @dtCurrentDate,@sSiteIPTo, @sSiteMasterIPTo) + -- to get the last inserted site id identity value in the current session + SET @iSiteId = SCOPE_IDENTITY() + END + + SET @cEditionLogins = CURSOR FAST_FORWARD FOR SELECT item FROM dbo.fnSplit(@sEditionList,@sRecordDelimiter) + OPEN @cEditionLogins + FETCH NEXT FROM @cEditionLogins INTO @sitem + WHILE @@FETCH_STATUS = 0 + BEGIN + INSERT INTO LicenseToEdition(LicenseId, EditionId, TotalLogins, IsModesty) + SELECT @iLicenseId, SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1), + SUBSTRING(@sitem,CHARINDEX(@sEditionLoginDelimiter,@sitem)+1,LEN(@sitem)), @iModesty + + -- chekc if selected edition is instructor or library edition + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) <= 4 + BEGIN + SET @iIsInsEditionSelected = 1; + END + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) > 4 + BEGIN + SET @iIsLibEditionSelected = 1; + END + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) = 9 + BEGIN + SET @iIsAcademicLibEditionSelected = 1; + END + + -- check if license is site license + IF @iLicenseTypeId = 3 + BEGIN + -- to get the last inserted licenseedition id identity value in the current session + SET @iLicenseEditionId = SCOPE_IDENTITY() + INSERT INTO SiteToLicenseEdition (SiteId, LicenseEditionId, IsModesty) VALUES (@iSiteId, @iLicenseEditionId, @iModesty) + END + FETCH NEXT FROM @cEditionLogins INTO @sitem + END + + IF @iIsInsEditionSelected = 1 AND @iIsLibEditionSelected = 1 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id in (8,9,10) then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + ELSE IF @iIsInsEditionSelected = 1 AND @iIsLibEditionSelected = 0 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id > 7 then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + ELSE IF @iIsInsEditionSelected = 0 AND @iIsLibEditionSelected = 1 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id < 11 and ResourceModule.id <> 6 then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + + IF @iIsAcademicLibEditionSelected = 1 + BEGIN + -- insert ADAM Image Resouce to license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, 1 as Status FROM ResourceModule WHERE ResourceModule.Id = 13; + END + ELSE + BEGIN + -- insert ADAM Image Resouce to license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, 0 as Status FROM ResourceModule WHERE ResourceModule.Id = 13; + END + + + COMMIT TRANSACTION + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertSingleLicenseAccount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertSingleLicenseAccount.sql new file mode 100644 index 0000000..ed7a79c --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertSingleLicenseAccount.sql @@ -0,0 +1,166 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_InsertSingleLicenseAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_InsertSingleLicenseAccount] +GO + +CREATE PROCEDURE [dbo].[usp_InsertSingleLicenseAccount] + -- Add the parameters for the stored procedure here + @sAccountNumber varchar(50), @sLicenseeFname varchar(50), @sLicenseeLname varchar(50), @iAccountTypeId tinyint, + @sInstitutionName varchar(100)='', @sAddress1 varchar(100)='', @sAddress2 varchar(100)='', @sCity varchar(50)='', + @sZip varchar(20)='', @iStateId int, @iCountryId int, @sPhone varchar(30)='', @sEmailId varchar(50), @iTotalLogins int, + @sStartDate varchar(20), @sEndDate varchar(20), @sEditionList varchar(256), @iPrice numeric(14,2),@sProductKey varchar(50), + @sLoginId varchar(50), @sPassword varchar(50), @iSecurityQuesId tinyint, @sSecurityAnswer varchar(50), @iCreatorId int,@iNoofImages int +AS +BEGIN + + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + BEGIN TRY + BEGIN TRANSACTION + DECLARE @cEditionLogins CURSOR + DECLARE @iLicenseId INT + DECLARE @iSiteId INT + DECLARE @iLicenseEditionId INT + DECLARE @iIsDistrictSiteAccount TINYINT + DECLARE @iLicenseTypeId TINYINT + DECLARE @iUserTypeId TINYINT + DECLARE @iAIAUserId INT + DECLARE @iActive TINYINT + DECLARE @iIsMasterIP TINYINT + DECLARE @iModesty TINYINT + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @sErrorStatus CHAR(2) + DECLARE @dtCurrentDate DATETIME + DECLARE @sitem VARCHAR(100) + DECLARE @sRecordDelimiter CHAR(1) + DECLARE @sEditionLoginDelimiter CHAR(1) + DECLARE @sCountryCode VARCHAR(10) + DECLARE @iIsInsEditionSelected TINYINT + DECLARE @iIsLibEditionSelected TINYINT + DECLARE @iIsAcademicLibEditionSelected TINYINT + + -- set the parameters to default values + SET @iActive = 1 + SET @iIsDistrictSiteAccount = 0 + SET @iModesty = 0 + SET @sRecordDelimiter = '|' + SET @sEditionLoginDelimiter = '-' + SET @dtCurrentDate = getdate() + SET @sErrorStatus = 'ok' + SET @iIsInsEditionSelected = 0; + SET @iIsLibEditionSelected = 0; + SET @iIsAcademicLibEditionSelected = 0; + + IF @iStateId = 0 + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + -- set the state to Other if the country is Non-US + SET @sCountryCode = (SELECT CountryCode from Country WHERE Id = @iCountryId) + IF @sCountryCode != 'US' + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + IF @iSecurityQuesId = 0 + BEGIN + SET @iSecurityQuesId = NULL + END + IF LEN(@sSecurityAnswer) = 0 + BEGIN + SET @sSecurityAnswer = NULL + END + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + + -- fetch the licensetypeid of the single license + SELECT @iLicenseTypeId = Id from LicenseType WHERE Title = 'Single License' + -- fetch the usertypeid of the single user + SELECT @iUserTypeId = Id from UserType WHERE Title = 'Single User' + + + INSERT INTO License(AccountNumber, LicenseeFirstName, LicenseeLastName, LicenseTypeId, AccountTypeId, + InstitutionName, EmailId, Address1, Address2, City, Zip, StateId, CountryId, Phone, TotalLogins, IsActive, + IsDistrictSiteLicense, CreationDate,ProductId) VALUES (@sAccountNumber, @sLicenseeFname, @sLicenseeLname, @iLicenseTypeId, + @iAccountTypeId, @sInstitutionName, @sEmailId, @sAddress1, @sAddress2, @sCity, @sZip, @iStateId, @iCountryId, + @sPhone, @iTotalLogins, @iActive, @iIsDistrictSiteAccount, @dtCurrentDate,@sProductKey) + -- to get the last inserted license id identity value in the current session + SET @iLicenseId = SCOPE_IDENTITY() + + INSERT INTO LicenseSubscriptionDetail(LicenseId, SubscriptionValidFrom, SubscriptionValidThrough, + TotalAmount, AmountPaid,NoofImages) VALUES(@iLicenseId, @dtStartDate, @dtEndDate, @iPrice, @iPrice ,@iNoofImages) + + SET @cEditionLogins = CURSOR FAST_FORWARD FOR SELECT item FROM dbo.fnSplit(@sEditionList,@sRecordDelimiter) + OPEN @cEditionLogins + FETCH NEXT FROM @cEditionLogins INTO @sitem + WHILE @@FETCH_STATUS = 0 + BEGIN + INSERT INTO LicenseToEdition(LicenseId, EditionId, TotalLogins, IsModesty) + SELECT @iLicenseId, SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1), + SUBSTRING(@sitem,CHARINDEX(@sEditionLoginDelimiter,@sitem)+1,LEN(@sitem)), @iModesty + + -- chekc if selected edition is instructor or library edition + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) <= 4 + BEGIN + SET @iIsInsEditionSelected = 1; + END + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) > 4 + BEGIN + SET @iIsLibEditionSelected = 1; + END + IF SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) = 9 + BEGIN + SET @iIsAcademicLibEditionSelected = 1; + END + + FETCH NEXT FROM @cEditionLogins INTO @sitem + END + SET @iLicenseEditionId = SCOPE_IDENTITY() + INSERT INTO AIAUser(LoginId, Password, Firstname, Lastname, UserTypeId, EmailId, IsActive, SecurityQuestionId, SecurityAnswer, + CreatorId, CreationDate, ModifierId, ModifiedDate) VALUES(@sLoginId, @sPassword, @sLicenseeFname, @sLicenseeLname, + @iUserTypeId, @sEmailId, @iActive, @iSecurityQuesId, @sSecurityAnswer, @iCreatorId, @dtCurrentDate, @iCreatorId, @dtCurrentDate) + SET @iAIAUserId = SCOPE_IDENTITY() + + INSERT INTO AIAUserToLicenseEdition(UserId, LicenseEditionId) VALUES(@iAIAUserId, @iLicenseEditionId) + + IF @iIsInsEditionSelected = 1 AND @iIsLibEditionSelected = 1 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id in (8,9,10) then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + ELSE IF @iIsInsEditionSelected = 1 AND @iIsLibEditionSelected = 0 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id > 7 then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + ELSE IF @iIsInsEditionSelected = 0 AND @iIsLibEditionSelected = 1 + BEGIN + -- insert All resource module of license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id < 11 and ResourceModule.id <> 6 then 0 else 1 end as Status FROM ResourceModule WHERE ResourceModule.Id <> 13; + END + + IF @iIsAcademicLibEditionSelected = 1 + BEGIN + -- insert ADAM Image Resouce to license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, 1 as Status FROM ResourceModule WHERE ResourceModule.Id = 13; + END + ELSE + BEGIN + -- insert ADAM Image Resouce to license + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, 0 as Status FROM ResourceModule WHERE ResourceModule.Id = 13; + END + + COMMIT TRANSACTION + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertTestLicenseAccount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertTestLicenseAccount.sql new file mode 100644 index 0000000..d10912d --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_InsertTestLicenseAccount.sql @@ -0,0 +1,110 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_InsertTestLicenseAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_InsertTestLicenseAccount] +GO + +CREATE PROCEDURE [dbo].[usp_InsertTestLicenseAccount] + -- Add the parameters for the stored procedure here + @sAccountNumber varchar(50), @sLicenseeFname varchar(50), @sLicenseeLname varchar(50), @sLoginId varchar(50), @sPassword varchar(50), + @sEmailId varchar(50), @iAccountTypeId tinyint, @iEditionId tinyint, @sAddress varchar(100)='', @sCity varchar(50)='', + @sZip varchar(20)='', @iStateId int, @iCountryId int, @sPhone varchar(30)='', @sStartDate varchar(20), @sEndDate varchar(20), @iCreatorId int ,@iNoofImages int +AS +BEGIN + + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + BEGIN TRY + BEGIN TRANSACTION + DECLARE @iLicenseId int + DECLARE @iLicenseEditionId int + DECLARE @iAIAUserId int + DECLARE @iLicenseTypeId tinyint + DECLARE @iUserTypeId tinyint + DECLARE @iAmount tinyint + DECLARE @iTotalLogins tinyint + DECLARE @iActive tinyint + DECLARE @iModesty tinyint + DECLARE @dtStartDate datetime + DECLARE @dtEndDate datetime + DECLARE @sErrorStatus char(2) + DECLARE @dtCurrentDate datetime + DECLARE @sCountryCode VARCHAR(10) + + -- set the parameters to default values + SET @iTotalLogins = 1 + SET @iActive = 1 + SET @iAmount = 0 + SET @iModesty = 0 + SET @dtCurrentDate = getdate() + SET @sErrorStatus = 'ok' + + IF @iStateId = 0 + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + -- set the state to Other if the country is Non-US + SET @sCountryCode = (SELECT CountryCode from Country WHERE Id = @iCountryId) + IF @sCountryCode != 'US' + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + + -- fetch the licensetypeid of the test account license + SELECT @iLicenseTypeId = Id from LicenseType WHERE Title = 'Test Account License' + -- fetch the usertypeid of the test account user + SELECT @iUserTypeId = Id from UserType WHERE Title = 'Test Account' + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + + INSERT INTO License(AccountNumber, LicenseeFirstName, LicenseeLastName, LicenseTypeId, AccountTypeId, + EmailId, Address1, City, Zip, StateId, CountryId, Phone, TotalLogins, IsActive, IsDistrictSiteLicense, + CreationDate) VALUES (@sAccountNumber, @sLicenseeFname, @sLicenseeLname, @iLicenseTypeId, @iAccountTypeId, + @sEmailId, @sAddress, @sCity, @sZip, @iStateId, @iCountryId, @sPhone, @iTotalLogins, @iActive, 0, @dtCurrentDate ) + -- to get the last inserted identity value in the current session + SET @iLicenseId = SCOPE_IDENTITY() + + INSERT INTO LicenseSubscriptionDetail(LicenseId, SubscriptionValidFrom, SubscriptionValidThrough, + TotalAmount, AmountPaid, AmountPending ,NoofImages) VALUES(@iLicenseId, @dtStartDate, @dtEndDate, @iAmount, @iAmount, @iAmount ,@iNoofImages) + + IF @iEditionId <= 4 + BEGIN + -- insert All resource module of license for Instructor Edition + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id > 7 then 0 else 1 end as Status FROM ResourceModule; + END + ELSE IF @iEditionId = 8 + BEGIN + -- insert All resource module of license for Library Edition + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id < 11 and ResourceModule.id <> 6 or ResourceModule.id = 13 then 0 else 1 end as Status FROM ResourceModule; + END + ELSE IF @iEditionId = 9 + BEGIN + -- insert All resource module of license for Library Edition + INSERT INTO ModuleToLicense SELECT @iLicenseId as LicenseId,ResourceModule.Id as ModuleId, CASE when ResourceModule.id < 11 and ResourceModule.id <> 6 then 0 else 1 end as Status FROM ResourceModule; + END + + INSERT INTO LicenseToEdition(LicenseId, EditionId, TotalLogins, IsModesty) + VALUES(@iLicenseId, @iEditionId, @iTotalLogins, @iModesty) + SET @iLicenseEditionId = SCOPE_IDENTITY() + + INSERT INTO AIAUser(LoginId, Password, Firstname, Lastname, UserTypeId, EmailId, IsActive, + CreatorId, CreationDate, ModifierId, ModifiedDate) VALUES(@sLoginId, @sPassword, @sLicenseeFname, @sLicenseeLname, + @iUserTypeId, @sEmailId, @iActive, @iCreatorId, @dtCurrentDate, @iCreatorId, @dtCurrentDate) + SET @iAIAUserId = SCOPE_IDENTITY() + + INSERT INTO AIAUserToLicenseEdition(UserId, LicenseEditionId) VALUES(@iAIAUserId, @iLicenseEditionId) + + COMMIT TRANSACTION + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateAiaUserPassword.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateAiaUserPassword.sql new file mode 100644 index 0000000..b5b0f25 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateAiaUserPassword.sql @@ -0,0 +1,30 @@ + if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_UpdateAiaUserPassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_UpdateAiaUserPassword] +GO + +CREATE PROCEDURE [dbo].[usp_UpdateAiaUserPassword] + -- Add the parameters for the stored procedure here + @Id int, + @NewPassword VARCHAR(50), + @Status bit out +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + set @Status = 0; + BEGIN TRY + BEGIN TRANSACTION + UPDATE AIAUser SET Password= @NewPassword,ModifiedDate=getdate() where Id = @Id; + COMMIT TRANSACTION + set @Status = 1; + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + END CATCH + +END + + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateDiscount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateDiscount.sql new file mode 100644 index 0000000..91cd7e7 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateDiscount.sql @@ -0,0 +1,37 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_UpdateDiscount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_UpdateDiscount] +GO + +CREATE PROCEDURE [dbo].[usp_UpdateDiscount] + -- Add the parameters for the stored procedure here + @iDiscountId INT, @dPercentage DECIMAL(5,2), @sStartDate VARCHAR(20), @sEndDate VARCHAR(20), @iActive TINYINT, @sDiscountCode VARCHAR(255)='' +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + BEGIN TRY + BEGIN TRANSACTION + DECLARE @dtStartDate DATETIME, @dtEndDate DATETIME + DECLARE @sErrorStatus CHAR(2) + + SET @sErrorStatus = 'ok' + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + + UPDATE Discount SET Percentage = @dPercentage, StartDate = @dtStartDate, EndDate = @dtEndDate, + IsActive = @iActive, DiscountCode = @sDiscountCode WHERE Id = @iDiscountId + + COMMIT + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateLicenseAccount.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateLicenseAccount.sql new file mode 100644 index 0000000..cd05ecf --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateLicenseAccount.sql @@ -0,0 +1,155 @@ + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_UpdateLicenseAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_UpdateLicenseAccount] +GO + +CREATE PROCEDURE [dbo].[usp_UpdateLicenseAccount] + -- Add the parameters for the stored procedure here + @iLicenseId int, @sLicenseeFname varchar(50), @sLicenseeLname varchar(50), + @iLicenseTypeId tinyint, @iAccountTypeId tinyint, @sInstitutionName varchar(100)='', @sAddress1 varchar(100)='', + @sAddress2 varchar(100)='', @sCity varchar(50)='', @sZip varchar(20)='', @iStateId int, @iCountryId int, + @sPhone varchar(30) = '', @sEmailId varchar(50), @iIsActive tinyint, @iTotalLogins int = 0, @iIsRennew tinyint, + @sStartDate varchar(20), @sEndDate varchar(20), @sRenewDate varchar(20), @sMasterIP varchar(100) = '', + @sEditionList varchar(256), @iPrice numeric(14,2), @sProductKey varchar(50), @sSiteIPTo varchar(100) = '', @sSiteMasterIPTo varchar(100) = '', + @iNoofImages int +AS +BEGIN + + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + BEGIN TRY + BEGIN TRANSACTION + DECLARE @cEditionLogins CURSOR + DECLARE @iSiteId INT + DECLARE @iLicenseEditionId INT + DECLARE @iModesty TINYINT + DECLARE @dtStartDate DATETIME + DECLARE @dtEndDate DATETIME + DECLARE @dtRenewDate DATETIME + DECLARE @sErrorStatus CHAR(2) + DECLARE @dtCurrentDate DATETIME + DECLARE @sitem VARCHAR(100) + DECLARE @sRecordDelimiter CHAR(1) + DECLARE @sEditionLoginDelimiter CHAR(1) + DECLARE @sPaymentMode VARCHAR(10) + DECLARE @iLicenseSubscriptionId INT + DECLARE @iSubscriptionId SMALLINT + DECLARE @dtCancellationDate DATETIME + DECLARE @iEditionExists TINYINT + DECLARE @sCountryCode VARCHAR(10) + + -- set the parameters to default values + SET @iModesty = 0 + SET @sRecordDelimiter = '|' + SET @sEditionLoginDelimiter = '-' + SET @iSubscriptionId = NULL + SET @dtCancellationDate = NULL + SET @dtCurrentDate = getdate() + SET @sPaymentMode = 'CASH' + SET @sErrorStatus = 'ok' + + IF @iStateId = 0 + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + + -- set the state to Other if the country is Non-US + SET @sCountryCode = (SELECT CountryCode from Country WHERE Id = @iCountryId) + IF @sCountryCode != 'US' + BEGIN + SET @iStateId = (SELECT Id FROM State WHERE StateName='Other') + END + + -- convert the datatype of startdate & enddate parameter to datetime + SELECT @dtStartDate = CONVERT(DATETIME,@sStartDate) + SELECT @dtRenewDate = CONVERT(DATETIME,@sRenewDate) + SELECT @dtEndDate = DATEADD(ms,-3,DATEADD(DAY,1,CONVERT(DATETIME,@sEndDate))) + -- if user inactive the license then set the cancellation date to current date + IF @iIsActive = 0 + BEGIN + SET @dtCancellationDate = @dtCurrentDate + END + + UPDATE License SET LicenseeFirstName = @sLicenseeFname, LicenseeLastName = @sLicenseeLname, + AccountTypeId = @iAccountTypeId, InstitutionName = @sInstitutionName, EmailId = @sEmailId, + Address1 = @sAddress1, Address2 = @sAddress2, City = @sCity, Zip = @sZip, StateId = @iStateId, + CountryId = @iCountryId, Phone = @sPhone, TotalLogins = @iTotalLogins, IsActive = @iIsActive, + ModifiedDate = @dtCurrentDate, CancellationDate = @dtCancellationDate, ProductId = @sProductKey WHERE Id = @iLicenseId + + SET @iLicenseSubscriptionId = (SELECT MAX(Id) FROM LicenseSubscriptionDetail WHERE LicenseId = @iLicenseId) + -- if the subscription of license is renew + IF @iIsRennew = 1 + BEGIN + -- check if license is single license + IF @iLicenseTypeId = 2 + BEGIN + SET @iSubscriptionId = (SELECT SubscriptionPlanId FROM LicenseSubscriptionDetail WHERE Id = @iLicenseSubscriptionId) + END + INSERT INTO LicenseSubscriptionDetail(LicenseId, SubscriptionPlanId, SubscriptionValidFrom, + SubscriptionValidThrough, RenewalDate, PaymentMode, TotalAmount, AmountPaid,NoofImages) + VALUES(@iLicenseId, @iSubscriptionId, @dtStartDate, @dtEndDate, @dtRenewDate, @sPaymentMode, @iPrice, @iPrice,@iNoofImages) + UPDATE License SET NoOfRenewals = NoOfRenewals + 1 WHERE Id = @iLicenseId + END + ELSE + BEGIN + UPDATE LicenseSubscriptionDetail SET SubscriptionValidFrom = @dtStartDate, + SubscriptionValidThrough = @dtEndDate, TotalAmount = @iPrice, AmountPaid = @iPrice , NoofImages =@iNoofImages + WHERE Id = @iLicenseSubscriptionId + END + + -- check if license is site license + IF @iLicenseTypeId = 3 + BEGIN + + SET @iSiteId = (SELECT DISTINCT Max(Site.Id) FROM LicenseToEdition + INNER JOIN SiteToLicenseEdition ON LicenseToEdition.Id = SiteToLicenseEdition.LicenseEditionId + INNER JOIN Site ON SiteToLicenseEdition.SiteId = Site.Id + WHERE LicenseToEdition.LicenseId=@iLicenseId AND Site.IsMaster=1 AND Site.IsActive=1) + + UPDATE Site SET SiteIP = @sMasterIP, Title = @sMasterIP, ModifiedDate = @dtCurrentDate, + SiteIPTo = @sSiteIPTo, SiteMasterIPTo = @sSiteMasterIPTo + WHERE Id = @iSiteId + END + + SET @cEditionLogins = CURSOR FAST_FORWARD FOR SELECT item FROM dbo.fnSplit(@sEditionList,@sRecordDelimiter) + OPEN @cEditionLogins + FETCH NEXT FROM @cEditionLogins INTO @sitem + WHILE @@FETCH_STATUS = 0 + BEGIN + SET @iEditionExists = (SELECT 1 FROM LicenseToEdition WHERE LicenseId = @iLicenseId AND EditionId = SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1)) + + IF @iEditionExists IS NULL OR @iEditionExists = 0 + BEGIN + INSERT INTO LicenseToEdition(LicenseId, EditionId, TotalLogins, IsModesty) + SELECT @iLicenseId, SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1), + SUBSTRING(@sitem,CHARINDEX(@sEditionLoginDelimiter,@sitem)+1,LEN(@sitem)), @iModesty + -- check if license is site license + IF @iLicenseTypeId = 3 + BEGIN + -- to get the last inserted licenseedition id identity value in the current session + SET @iLicenseEditionId = SCOPE_IDENTITY() + INSERT INTO SiteToLicenseEdition (SiteId, LicenseEditionId, IsModesty) VALUES (@iSiteId, @iLicenseEditionId, @iModesty) + END + END + ELSE + BEGIN + UPDATE LicenseToEdition SET TotalLogins = SUBSTRING(@sitem,CHARINDEX(@sEditionLoginDelimiter,@sitem)+1,LEN(@sitem)) + WHERE LicenseId = @iLicenseId + AND EditionId = SUBSTRING(@sitem,1,CHARINDEX(@sEditionLoginDelimiter,@sitem)-1) + END + FETCH NEXT FROM @cEditionLogins INTO @sitem + END + + COMMIT TRANSACTION + SELECT @sErrorStatus as SPStatus + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + SELECT Error_Message() as SPStatus + END CATCH + +END + diff --git a/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateUserProfile.sql b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateUserProfile.sql new file mode 100644 index 0000000..515f829 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/dbo.usp_UpdateUserProfile.sql @@ -0,0 +1,31 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_UpdateUserProfile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_UpdateUserProfile] +GO +CREATE PROCEDURE [dbo].[usp_UpdateUserProfile] + -- Add the parameters for the stored procedure here + @Id int, + @FirstName VARCHAR(100), + @LastName VARCHAR(100), + @EmailId varchar(50), + @Status int out +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + set @Status = 0; + BEGIN TRY + BEGIN TRANSACTION + UPDATE AIAUser SET FirstName= @FirstName, LastName= @LastName, EmailId = @EmailId + where Id = @Id; + COMMIT TRANSACTION + set @Status = 1; + END TRY + BEGIN CATCH + IF @@TRANCOUNT > 0 + ROLLBACK TRANSACTION + END CATCH + +END + diff --git a/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountAdmin.sql b/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountAdmin.sql new file mode 100644 index 0000000..e83c2b0 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountAdmin.sql @@ -0,0 +1,41 @@ +USE [AIADatabaseV5] +GO +/****** Object: StoredProcedure [dbo].[usp_GetSiteAccountAdmin] Script Date: 2/1/2018 12:15:55 PM ******/ +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO +-- ============================================= +-- Author: magic +-- Create date: 5/6/2018 +-- Description: Fetch building level accounts client admins for corresponding given Account Number. +-- ============================================= + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSiteAccountAdmin]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSiteAccountAdmin] +GO + +CREATE PROCEDURE [dbo].[usp_GetSiteAccountAdmin] + -- Add the parameters for the stored procedure here + @AccountNumber varchar(50)='' + +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + SELECT AIAUser.Id, AIAUser.Password, AIAUser.LoginId, AIAUser.FirstName, AIAUser.UserTypeId, AIAUser.LastName, AIAUser.EmailId, AIAUser.IsActive, + AIAUser.SecurityQuestionId, AIAUser.SecurityAnswer, AIAUser.CreatorId, AIAUser.CreationDate, AIAUser.ModifierId, AIAUser.ModifiedDate, + AIAUser.DeactivationDate + FROM AIAUser + INNER JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId + INNER JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id + INNER JOIN License ON LicenseToEdition.LicenseId = License.Id + WHERE (AIAUser.IsActive = 1) AND (License.AccountNumber = @AccountNumber) AND (AIAUser.UserTypeId = 4); + +END + + + +GO diff --git a/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountSites.sql b/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountSites.sql new file mode 100644 index 0000000..44a20c5 --- /dev/null +++ b/500-DBDump/AIA-StoredProcedures/usp_GetSiteAccountSites.sql @@ -0,0 +1,67 @@ +USE [AIADatabaseV5] +GO +/****** Object: StoredProcedure [dbo].[usp_GetSiteAccountSites] Script Date: 2/1/2018 12:15:55 PM ******/ +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO +-- ============================================= +-- Author: magic +-- Create date: 5/6/2018 +-- Description: Fetch building level accounts details for corresponding given Account Number. +-- ============================================= + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSiteAccountSites]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[usp_GetSiteAccountSites] +GO + +CREATE PROCEDURE [dbo].[usp_GetSiteAccountSites] + -- Add the parameters for the stored procedure here + @strAccountNumber varchar(50)='', @pageNo int, @pageLength int, @recordCount int out + +AS +BEGIN + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + --Get the records on the basis of parameters page length and page number rows + select LD.Id, LD.SiteIp, LD.Title, LD.SiteIPTo, LD.SiteMasterIPTo, LD.CreationDate, LD.ModifiedDate, LD.InstituteName, + LD.Department, LD.UserId, LD.FirstName, LD.EmailId + from + (Select ROW_NUMBER() OVER (ORDER BY Site.Id) AS RowNo, + Site.Id,Site.SiteIp,Site.Title,ISNULL(Site.SiteIPTo,'') as SiteIPTo,ISNULL(Site.SiteMasterIPTo,'') as SiteMasterIPTo, + CONVERT(VARCHAR,Site.CreationDate,101) as CreationDate, + CONVERT(VARCHAR,Site.ModifiedDate,101) as ModifiedDate, + Site.InstituteName, Site.Department, AIAUser.Id as UserId,AIAUser.FirstName,AIAUser.EmailId + from License join LicenseToEdition on License.Id = LicenseToEdition.LicenseId + join SiteToLicenseEdition on LicenseToEdition.Id = SiteToLicenseEdition.LicenseEditionId + join AIAUserToLicenseEdition on SiteToLicenseEdition.LicenseEditionId = AIAUserToLicenseEdition.LicenseEditionId + join AIAUserToSite on SiteToLicenseEdition.SiteId = AIAUserToSite.SiteId + join Site on SiteToLicenseEdition.SiteId = Site.Id + join AIAUser on AIAUserToLicenseEdition.UserId = AIAUser.Id + where Site.IsActive=1 and License.AccountNumber=@strAccountNumber) + as LD + where + RowNo > @pageLength * (@pageNo - 1) AND + RowNo <= @pageLength * @pageNo + + --Calculate total number of records + select @recordCount = count(ResultTable.Id) from + (Select Site.Id,Site.SiteIp,Site.Title,ISNULL(Site.SiteIPTo,'') as SiteIPTo,ISNULL(Site.SiteMasterIPTo,'') as SiteMasterIPTo, + CONVERT(VARCHAR,Site.CreationDate,101) as CreationDate, + CONVERT(VARCHAR,Site.ModifiedDate,101) as ModifiedDate, + Site.InstituteName, Site.Department, AIAUser.Id as UserId,AIAUser.FirstName,AIAUser.EmailId + from License join LicenseToEdition on License.Id = LicenseToEdition.LicenseId + join SiteToLicenseEdition on LicenseToEdition.Id = SiteToLicenseEdition.LicenseEditionId + join AIAUserToLicenseEdition on SiteToLicenseEdition.LicenseEditionId = AIAUserToLicenseEdition.LicenseEditionId + join AIAUserToSite on SiteToLicenseEdition.SiteId = AIAUserToSite.SiteId + join Site on SiteToLicenseEdition.SiteId = Site.Id + join AIAUser on AIAUserToLicenseEdition.UserId = AIAUser.Id + where Site.IsActive=1 and License.AccountNumber=@strAccountNumber) as ResultTable; + +END + + + +GO