Esempio n. 1
0
		public static void AddMessage(ChatMessage msg)
		{
			// Load the provider
			LoadProvider();

			_provider.AddChatMessage(msg);
		}
Esempio n. 2
0
		public override SendTranscriptViewModel GetTranscript(Guid chatId)
		{
			using (LCSKDbDataContext db = new LCSKDbDataContext(connectionString))
			{
				var request = db.LiveChat_ChatRequests.SingleOrDefault(x => x.ChatID == chatId);
				if (request != null)
				{
					SendTranscriptViewModel vm = new SendTranscriptViewModel();
					vm.Email = request.VisitorEmail;
					vm.Requested = request.RequestDate;
					vm.Accepted = request.AcceptDate ?? DateTime.MinValue;

					vm.Conversation = new List<ChatMessage>();

					foreach(var m in db.LiveChat_ChatMessages.OrderBy(x => x.MessageID)
						.Where(x => x.ChatID == chatId).ToList())
					{
						ChatMessage msg = new ChatMessage();
						msg.ChatId = m.ChatID;
						msg.Message = m.Message;
						msg.MessageId = m.MessageID;
						msg.Name = m.FromName;
						
						vm.Conversation.Add(msg);
					}

					return vm;
				}
				return null;
			}
		}
Esempio n. 3
0
		public override void AddChatMessage(ChatMessage msg)
		{
			using (LCSKDbDataContext db = new LCSKDbDataContext(connectionString))
			{
				LiveChat_ChatMessage entity = new LiveChat_ChatMessage();
				entity.ChatID = msg.ChatId;
				entity.FromName = msg.Name;
				entity.Message = msg.Message;
				//TODO: Change SentDate to DateTime
				//entity.SentDate = DateTime.Now;

				db.LiveChat_ChatMessages.InsertOnSubmit(entity);
				db.SubmitChanges();
			}
		}
Esempio n. 4
0
		public void AddMessage(Guid key, ChatMessage msg)
		{
			if (!IsAuthenticated(key))
				throw new Exception("The key is not authenticated");
			ChatService.AddMessage(msg);
		}
Esempio n. 5
0
		public abstract void AddChatMessage(ChatMessage msg);