public bool Handle(Dto.EventBus.ChannelNewMsgEvent evt) { try { if (evt == null) { return(true); } ConversationMessageService bll = new ConversationMessageService(); if (evt.Messages != null && evt.Messages.Length > 0) { List <ResponseConversationMsgDTO> msgs = new List <ResponseConversationMsgDTO>(); for (int i = 0; i < evt.Messages.Length; i++) { if (bll.Single(evt.Messages[i].ConversationMessageID) == null) { msgs.Add(evt.Messages[i]); } } if (msgs.Count > 0) { if (bll.Insert(msgs)) { return(true); } else { return(false); } } } return(true); } catch (Exception E) { LogHelper.DefaultLogger.Error(E); } return(false); }
public bool Handle(EventBus.Events.ChannelNewMsgEvent evt) { try { if (evt == null) { return(true); } ConversationMessageService bll = new ConversationMessageService(null); if (evt.Messages != null && evt.Messages.Length > 0) { List <ConversationMessage> msgs = new List <ConversationMessage>(); for (int i = 0; i < evt.Messages.Length; i++) { if (bll.Single <ConversationMessage>(evt.Messages[i].ConversationMessageID) == null) { msgs.Add(evt.Messages[i]); } } if (msgs.Count > 0) { if (bll.Insert(msgs.ToArray())) { return(true); } else { return(false); } } } return(true); } catch (Exception E) { LogHelper.WriteError(E); } return(false); }