public void CreateSurveyTicket(Client client) { string tokenString = Guid.NewGuid().ToString(); var sql = @"insert into SurveyTickets (Client_SID, Token, ExpirationDate, TokenUsed, TokenUsedDate) values (@Client_SID, @Token, @ExpirationDate , @TokenUsed, null)"; _dbConnection.Execute(sql, new { Client_SID = client.Client_SID, Token = tokenString, ExpirationDate = DateTime.Now.AddDays(21), TokenUsed = false }); String link = "https://newbegininingcenter.azurewebsites.net/#!/survey/" + client.Client_SID.ToString() + "/" + tokenString; var emailTemplateService = new EmailTemplateService(); var body = emailTemplateService.getMailBody(link); var emailService = new EmailService(); emailService.sendMail("New Beginnings Follow Up Survey", body, client.Email); }
public void ResendSurveyTicket(Client client) { string link = ""; var sql = @"select Ticket_SID, Client_SID, Token, ExpirationDate, TokenUsed from SurveyTickets where Client_SID = @client_SID"; var reader = _dbConnection.ExecuteReader(sql, new { Client_SID = client.Client_SID }); DataTable dt = new DataTable(); dt.Load(reader); if (dt.Rows.Count > 0) { link = "https://newbeginningscenter.azurewebsites.net/survey/" + client.Client_SID.ToString() + "/" + dt.Rows[0]["Token"].ToString(); var emailTemplateService = new EmailTemplateService(); var body = emailTemplateService.getMailBody(link); EmailService emailService = new EmailService(); emailService.sendMail("New Beginnings Follow Up Survey", body, client.Email); } }