private static void SendNewOrganizationCreatedMessage(Person person, string loginName) { var organization = person.Organization; var subject = $"{FieldDefinitionType.Organization.GetFieldDefinitionLabel()} added: {person.Organization.GetDisplayName()}"; var message = $@" <div style='font-size: 12px; font-family: Arial'> <strong>{FieldDefinitionType.Organization.GetFieldDefinitionLabel()} created:</strong> {organization.GetDisplayNameAsUrl()}<br /> <strong>Created on:</strong> {DateTime.Now}<br /> <strong>Created because:</strong> New user logged in<br /> <strong>New user:</strong> {person.GetFullNameFirstLast()} ({person.Email})<br /> <br /> <p> You may want to <a href=""{ SitkaRoute<OrganizationController>.BuildAbsoluteUrlFromExpression(x => x.Detail(organization .OrganizationID)) }"">add detail for this {FieldDefinitionType.Organization.GetFieldDefinitionLabel()}</a> such as its abbreviation, { FieldDefinitionType.OrganizationType.GetFieldDefinitionLabel() }, website, logo, etc. This will make its {FieldDefinitionType.Organization.GetFieldDefinitionLabel()} summary page display better. </p> <br /> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {loginName}<br /> <br /> </div> <div>You received this email because you are set up as a point of contact for support - if that's not correct, let us know: { NeptuneWebConfiguration.SitkaSupportEmail }</div>. </div> "; SendMessageImpl(person, subject, message); }
public void CanRetrieveWebServiceListForAllTenants() { AssertCustom.IgnoreUntil(DateTime.Parse("6/1/2022 12:00"), "Ignoring test for longer due to the same reasons from the previous commit on this line. - SMG"); var allTenantCanonicalHostnames = ProjectFirmaModels.Models.Tenant.All.Select(t => t.CanonicalHostNameLocal).ToList(); var sitkaTenantCanonicalHostName = ProjectFirmaModels.Models.Tenant.SitkaTechnologyGroup.CanonicalHostNameLocal; var testUrlForSitkaTenant = SitkaRoute <WebServicesController> .BuildAbsoluteUrlFromExpression(wsc => wsc.List()); var failedMessages = new List <string>(); foreach (var currentTenantCanonicalHostname in allTenantCanonicalHostnames) { // build the url var currentTestUrl = testUrlForSitkaTenant.Replace(sitkaTenantCanonicalHostName, currentTenantCanonicalHostname); try { var responseText = HttpHelper.GetUrl(currentTestUrl); Assert.That(!responseText.Contains("<title>Sitka Keystone", StringComparison.InvariantCultureIgnoreCase), "Test Precondition - hoping to end up on the service site not on the keystone website"); Assert.That(responseText, Is.StringContaining("service")); } catch (Exception e) { failedMessages.Add($"Url: {currentTestUrl}, unexpected exception: {e}"); } } Assert.That(!failedMessages.Any(), $"Received the following errors: {string.Join("\r\n", failedMessages)}"); }
private static void SendNewUserCreatedMessage(Person person, string loginName) { var subject = $"{MultiTenantHelpers.GetToolDisplayName()} User added: {person.GetFullNameFirstLast()} ({person.GetOrganizationDescriptor()})"; var message = $@" <div style='font-size: 12px; font-family: Arial'> <strong>User added:</strong> {person.GetFullNameFirstLast()}<br /> <strong>Organization</strong> {person.GetOrganizationDescriptor()} <br /> <strong>Added on:</strong> {DateTime.Now}<br /> <strong>Email:</strong> {person.Email}<br /> <br /> <p> You may want to <a href=""{ SitkaRoute<UserController>.BuildAbsoluteUrlFromExpression(x => x.Detail(person.PersonID)) }"">assign this user roles</a> to allow them to work with specific areas of the site. Or you can leave the user with an unassigned role if they don't need special privileges. </p> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {loginName}<br /> <br /> </div> <div>{$"- {MultiTenantHelpers.GetToolDisplayName()} team"}<br/><br/><img src=""cid:tool-logo"" width=""160"" /></div> <div>You received this email because you are set up as a point of contact for support - if that's not correct, let us know: { FirmaWebConfiguration.SitkaSupportEmail }.</div> </div> "; SendMessageImpl(person, subject, message); }
public void CanRetrieveWebServiceListForAllTenants() { AssertCustom.IgnoreUntil(DateTime.Parse("12/15/2021 12:00"), "Test added by SLG and SMG 12/10/2019 is not working, may not be able to make it work properly as written. Tests attempt to see web services urls but that requires login through Keystone which is not easy to do. May be able to re-write as a controller test. Ignoring for now. -MF"); var allTenantCanonicalHostnames = ProjectFirmaModels.Models.Tenant.All.Select(t => t.CanonicalHostNameLocal).ToList(); var sitkaTenantCanonicalHostName = ProjectFirmaModels.Models.Tenant.SitkaTechnologyGroup.CanonicalHostNameLocal; var testUrlForSitkaTenant = SitkaRoute <WebServicesController> .BuildAbsoluteUrlFromExpression(wsc => wsc.List()); var failedMessages = new List <string>(); foreach (var currentTenantCanonicalHostname in allTenantCanonicalHostnames) { // build the url var currentTestUrl = testUrlForSitkaTenant.Replace(sitkaTenantCanonicalHostName, currentTenantCanonicalHostname); try { var responseText = HttpHelper.GetUrl(currentTestUrl); Assert.That(!responseText.Contains("<title>Sitka Keystone", StringComparison.InvariantCultureIgnoreCase), "Test Precondition - hoping to end up on the service site not on the keystone website"); Assert.That(responseText, Is.StringContaining("service")); } catch (Exception e) { failedMessages.Add($"Url: {currentTestUrl}, unexpected exception: {e}"); } } Assert.That(!failedMessages.Any(), $"Received the following errors: {string.Join("\r\n", failedMessages)}"); }
public void TestInvoiceJsonApi() { var invoiceJsonUrl = SitkaRoute <InvoiceController> .BuildAbsoluteUrlFromExpression(c => c.InvoiceJsonApi()); var webClient = new WebClient(); var jsonContent = webClient.DownloadString(invoiceJsonUrl); Assert.IsNotEmpty(jsonContent, $"Got nothing at all back from URL {invoiceJsonUrl}"); }
public void TestGrantAllocationProgramIndexProjectCodeJsonApi() { var grantAllocationProgramIndexProjectCodeJsonUrl = SitkaRoute <GrantAllocationProgramIndexProjectCodeController> .BuildAbsoluteUrlFromExpression(c => c.GrantAllocationProgramIndexProjectCodeJsonApi()); var webClient = new WebClient(); var jsonContent = webClient.DownloadString(grantAllocationProgramIndexProjectCodeJsonUrl); Assert.IsNotEmpty(jsonContent, $"Got nothing at all back from URL {grantAllocationProgramIndexProjectCodeJsonUrl}"); }
public void TestAgreementJsonApi() { var agreementJsonUrl = SitkaRoute <AgreementController> .BuildAbsoluteUrlFromExpression(c => c.AgreementJsonApi()); Console.WriteLine($"Attempting to retrieve JSON URL: {agreementJsonUrl}"); var webClient = new WebClient(); string jsonContent = null; // Having some trouble with bad SSL handshakes - but only on Sprague, so I'm adding some debugging to hopefully clarify. -- SLG 1/9/2020 try { jsonContent = webClient.DownloadString(agreementJsonUrl); } catch (Exception e) { Console.WriteLine($"Problem retrieving {agreementJsonUrl}: {e.Message}"); throw; } //Assert.IsNotEmpty(jsonContent, $"Got nothing at all back from URL {agreementJsonUrl}"); }