/// <summary> /// Broadcast info to client according to note info. /// </summary> /// <param name="note">billboard info</param> public void BroadCast(GCRISNote note) { BroadcastEventArgs e = new BroadcastEventArgs(); e.Note = note; List <ClientInfo> matchedLists; string[] arrTmp; arrTmp = note.GroupId.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); switch (note.GroupType) { case (int)BulletinGroupType.Department: if (note.GroupId == "0") //Send to all clients { matchedLists = m_clients.FindAll( x => (string.IsNullOrEmpty(note.Site) == true ? true : x.ClientUserInfo.Site.Equals(note.Site, StringComparison.InvariantCultureIgnoreCase))); } else { matchedLists = m_clients.FindAll( x => Array.Exists(arrTmp, m => m.Equals(x.ClientUserInfo.Department, StringComparison.OrdinalIgnoreCase)) && (string.IsNullOrEmpty(note.Site) == true ? true : x.ClientUserInfo.Site.Equals(note.Site, StringComparison.InvariantCultureIgnoreCase))); } break; case (int)BulletinGroupType.Role: matchedLists = m_clients.FindAll( x => Array.Exists(arrTmp, m => m.Equals(x.ClientUserInfo.UserRole, StringComparison.OrdinalIgnoreCase)) && (string.IsNullOrEmpty(note.Site) == true ? true : x.ClientUserInfo.Site.Equals(note.Site, StringComparison.InvariantCultureIgnoreCase))); break; case (int)BulletinGroupType.Person: matchedLists = m_clients.FindAll( x => string.Compare(x.ClientUserInfo.UserId, note.GroupId, StringComparison.OrdinalIgnoreCase) == 0); break; default: return; } SendMsg2ClientsHandler asyncSendMsg = new SendMsg2ClientsHandler(SendMsg2Clients); asyncSendMsg.BeginInvoke(matchedLists, e, null, null); }