public JsonResult SendChatHistoryToEmail(string toEmail, int chatId) { LiveChatLog chatLog = _liveChatService.GetChatLog(chatId); string subject = string.Format(EngineContext.Current.Resolve <ILocalizationService>().GetResource("Plugins.Widgets.LiveChat.Email.SupportChatHistoryFor"), chatLog.Name); string body = _liveChatService.GetMessages(chatLog.Messages); return(SendToEmail(toEmail, subject, body)); }
public bool SaveChat(string id, ChatClient client) { bool isSaved = false; try { XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add(string.Empty, string.Empty); XmlSerializer serializer = new XmlSerializer(client.ChatMessages.GetType()); string chatMessagesSerialized = ""; using (StringWriter textWriter = new StringWriter()) { serializer.Serialize(textWriter, client.ChatMessages, ns); chatMessagesSerialized = textWriter.ToString(); } LiveChatLog chatLog = new LiveChatLog() { SessionId = id, Name = client.Name, Messages = chatMessagesSerialized, Email = client.Email, ClientIp = client.Ip, Url = client.Url, OperatingSystem = client.OperatingSystem, Browser = client.Browser, ConnectedAt = client.ConnectedAt, }; InsertChatLog(chatLog); isSaved = true; } catch (Exception ex) { isSaved = false; //throw ex; } return(isSaved); }