public static string GetSubjectLine(this SupportRequestType supportRequestType) { var a = FieldDefinitionEnum.Project.ToType(); switch (supportRequestType.ToEnum) { case SupportRequestTypeEnum.ReportBug: case SupportRequestTypeEnum.ForgotLoginInfo: case SupportRequestTypeEnum.ProvideFeedback: case SupportRequestTypeEnum.RequestOrganizationNameChange: case SupportRequestTypeEnum.Other: return(supportRequestType.SupportRequestTypeDisplayName); case SupportRequestTypeEnum.NewOrganizationOrFundingSource: return($"Need an {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()} or {FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabel()} added to the list"); case SupportRequestTypeEnum.AddOrganizationToKeystone: return($"Need an {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()} added to Keystone"); case SupportRequestTypeEnum.HelpWithProjectUpdate: return($"Can't figure out how to update my {a.GetFieldDefinitionLabel()}"); case SupportRequestTypeEnum.RequestProjectPrimaryContactChange: return($"Request a change to a {a.GetFieldDefinitionLabel()}'s {FieldDefinitionEnum.ProjectPrimaryContact.ToType().GetFieldDefinitionLabel()}"); case SupportRequestTypeEnum.RequestPermissionToAddProjects: return($"Request permission to add { a.GetFieldDefinitionLabelPluralized()}"); default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Enum types are equal by primary key /// </summary> public bool Equals(SupportRequestType other) { if (other == null) { return(false); } return(other.SupportRequestTypeID == SupportRequestTypeID); }
public void SendMessage(string ipAddress, string userAgent, string currentUrl, SupportRequestType supportRequestType, Project project) { var subject = $"Support Request for Project Firma - {DateTime.Now.ToStringDateTime()}"; var projectSummaryUrl = project == null ? string.Empty : $"<strong>{FieldDefinition.Project.GetFieldDefinitionLabel()}:</strong> <a href=\"{SitkaRoute<ProjectController>.BuildAbsoluteUrlHttpsFromExpression(x => x.Detail(project))}\">{project.DisplayName}</a><br />"; var message = string.Format(@" <div style='font-size: 12px; font-family: Arial'> <strong>{0}</strong><br /> <br /> <strong>From:</strong> {1} - {2}<br /> <strong>Email:</strong> {3}<br /> <strong>Phone:</strong> {4}<br /> {5} <br /> <strong>Subject:</strong> {6}<br /> <br /> <strong>Description:</strong><br /> {7} <br /> <br /> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {8}<br /> IP ADDRESS: {9}<br /> USERAGENT: {10}<br /> URL FROM: {11}<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: {12}</div>. </div> ", subject, RequestPersonName, RequestPersonOrganization ?? "(not provided)", RequestPersonEmail, RequestPersonPhone ?? "(not provided)", projectSummaryUrl, supportRequestType.SupportRequestTypeDisplayName, RequestDescription.HtmlEncodeWithBreaks(), RequestPerson != null ? $"{RequestPerson.FullNameFirstLast} (UserID {RequestPerson.PersonID})" : "(anonymous user)", ipAddress, userAgent, currentUrl, Common.FirmaWebConfiguration.SitkaSupportEmail); // Create Notification var mailMessage = new MailMessage { From = new MailAddress(Common.FirmaWebConfiguration.DoNotReplyEmail), Subject = subject, Body = message, IsBodyHtml = true }; // Reply-To Header mailMessage.ReplyToList.Add(RequestPersonEmail); // TO field SupportRequestType.SetEmailRecipientsOfSupportRequest(mailMessage); SitkaSmtpClient.Send(mailMessage); }
public static void SendMessage(SupportRequestLog supportRequestLog, string ipAddress, string userAgent, string currentUrl, SupportRequestType supportRequestType, DatabaseEntities databaseEntities, int defaultSupportPersonID) { var subject = $"Support Request for Project Firma - {DateTime.Now.ToStringDateTime()}"; var message = $@" <div style='font-size: 12px; font-family: Arial'> <strong>{subject}</strong><br /> <br /> <strong>From:</strong> {supportRequestLog.RequestPersonName} - {supportRequestLog.RequestPersonOrganization ?? "(not provided)"}<br /> <strong>Email:</strong> {supportRequestLog.RequestPersonEmail}<br /> <strong>Phone:</strong> {supportRequestLog.RequestPersonPhone ?? "(not provided)"}<br /> <br /> <strong>Subject:</strong> {supportRequestType.SupportRequestTypeDisplayName}<br /> <br /> <strong>Description:</strong><br /> {supportRequestLog.RequestDescription.HtmlEncodeWithBreaks()} <br /> <br /> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {(supportRequestLog.RequestPerson != null ? $"{supportRequestLog.RequestPerson.GetFullNameFirstLast()} (UserID {supportRequestLog.RequestPerson.PersonID})" : "(anonymous user)")}<br /> IP ADDRESS: {ipAddress}<br /> USERAGENT: {userAgent}<br /> URL FROM: {currentUrl}<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: {FirmaWebConfiguration.SitkaSupportEmail}</div>. </div> "; // Create Notification var mailMessage = new MailMessage { From = new MailAddress(FirmaWebConfiguration.DoNotReplyEmail), Subject = subject, Body = message, IsBodyHtml = true }; // Reply-To Header mailMessage.ReplyToList.Add(supportRequestLog.RequestPersonEmail); // TO field SupportRequestTypeModelExtensions.SetEmailRecipientsOfSupportRequest(databaseEntities, mailMessage, defaultSupportPersonID); SitkaSmtpClient.Send(mailMessage); }
public void SendMessage(string ipAddress, string userAgent, string currentUrl, SupportRequestType supportRequestType) { SendMessage(ipAddress, userAgent, currentUrl, supportRequestType, null); }
public static void SendMessage(SupportRequestLog supportRequestLog, string ipAddress, string userAgent, string currentUrl, SupportRequestType supportRequestType, DatabaseEntities databaseEntities, int defaultSupportPersonID) { var subject = $"Support Request for Project Firma - {DateTime.Now.ToStringDateTime()}"; var message = $@" <div style='font-size: 12px; font-family: Arial'> <strong>{subject}</strong><br /> <br /> <strong>From:</strong> {supportRequestLog.RequestPersonName} - {supportRequestLog.RequestPersonOrganization ?? "(not provided)"}<br /> <strong>Email:</strong> {supportRequestLog.RequestPersonEmail}<br /> <strong>Phone:</strong> {supportRequestLog.RequestPersonPhone ?? "(not provided)"}<br /> <br /> <strong>Subject:</strong> {supportRequestType.SupportRequestTypeDisplayName}<br /> <br /> <strong>Description:</strong><br /> {supportRequestLog.RequestDescription.HtmlEncodeWithBreaks()} <br /> <br /> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {(supportRequestLog.RequestPerson != null ? $"{supportRequestLog.RequestPerson.GetFullNameFirstLast()} (UserID {supportRequestLog.RequestPerson.PersonID})" : "(anonymous user)")}<br /> IP ADDRESS: {ipAddress}<br /> USERAGENT: {userAgent}<br /> URL FROM: {currentUrl}<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: {FirmaWebConfiguration.SitkaSupportEmail}.</div> <br/><br/><img src=""cid:tool-logo"" width=""160"" /> </div> "; // Create Notification var mailMessage = new MailMessage { From = new MailAddress(FirmaWebConfiguration.DoNotReplyEmail), Subject = subject, Body = message, IsBodyHtml = true }; var tenantAttribute = MultiTenantHelpers.GetTenantAttributeFromCache(); var toolLogo = tenantAttribute.TenantSquareLogoFileResourceInfo ?? tenantAttribute.TenantBannerLogoFileResourceInfo; var htmlView = AlternateView.CreateAlternateViewFromString(message, null, "text/html"); htmlView.LinkedResources.Add( new LinkedResource(new MemoryStream(toolLogo.FileResourceData.Data), "img/jpeg") { ContentId = "tool-logo" }); mailMessage.AlternateViews.Add(htmlView); // Reply-To Header mailMessage.ReplyToList.Add(supportRequestLog.RequestPersonEmail); // TO field SupportRequestTypeModelExtensions.SetEmailRecipientsOfSupportRequest(databaseEntities, mailMessage, defaultSupportPersonID); SitkaSmtpClient.Send(mailMessage); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static SupportRequestLog CreateNewBlank(SupportRequestType supportRequestType) { return(new SupportRequestLog(default(DateTime), default(string), default(string), supportRequestType, default(string))); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public SupportRequestLog(DateTime requestDate, string requestPersonName, string requestPersonEmail, SupportRequestType supportRequestType, string requestDescription) : this() { // Mark this as a new object by setting primary key with special value this.SupportRequestLogID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.RequestDate = requestDate; this.RequestPersonName = requestPersonName; this.RequestPersonEmail = requestPersonEmail; this.SupportRequestTypeID = supportRequestType.SupportRequestTypeID; this.RequestDescription = requestDescription; }