public ContactModel(Contact contact)
        {
            Peer = new PeerModel(contact);
            Peer.DisplayPresence = true;

            Detail = contact.CompanyName;

            Rainbow.Model.Presence presence = Helper.SdkWrapper.GetAggregatedPresenceFromContactId(contact.Id);
            Presence = presence?.PresenceLevel;

            if (String.IsNullOrEmpty(contact.FirstName))
            {
                FirstNameForSort = Peer.DisplayName.ToUpper();
            }
            else
            {
                FirstNameForSort = contact.FirstName.ToUpper();
            }

            if (String.IsNullOrEmpty(contact.LastName))
            {
                LastNameForSort = Peer.DisplayName.ToUpper();
            }
            else
            {
                LastNameForSort = contact.LastName.ToUpper();
            }

            CompanyForSort = contact.CompanyName?.ToUpper();
        }
Exemple #2
0
        public static String GetPresenceSourceFromPresence(Rainbow.Model.Presence presence)
        {
            String result = null;

            if (presence != null)
            {
                if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Online)
                {
                    if (presence.Resource.StartsWith("mobile"))
                    {
                        result = "presence_online_mobile.png";
                    }
                    else
                    {
                        result = "presence_online.png";
                    }
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Offline)
                {
                    result = "presence_offline.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Away)
                {
                    result = "presence_away.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Xa)
                {
                    result = "presence_xa.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Dnd)
                {
                    result = "presence_dnd.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Busy)
                {
                    result = "presence_busy.png";
                }
            }

            if (!String.IsNullOrEmpty(result))
            {
                return(NamespaceResources + ".images.presence." + result);
            }

            return(result);
        }
Exemple #3
0
        public static String GetPresenceSourceFromPresence(Rainbow.Model.Presence presence, Boolean isCurrentUser)
        {
            String presenceSource = "";

            if (presence != null)
            {
                if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Online)
                {
                    if (presence.Resource.StartsWith("mobile"))
                    {
                        presenceSource = "presence_online_mobile.png";
                    }
                    else
                    {
                        presenceSource = "presence_online.png";
                    }
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Offline)
                {
                    presenceSource = "presence_offline.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Away)
                {
                    presenceSource = "presence_away.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Dnd)
                {
                    presenceSource = "presence_dnd.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Busy)
                {
                    presenceSource = "presence_busy.png";
                }
                else if ((presence.PresenceLevel == Rainbow.Model.PresenceLevel.Xa) && // Use XA display only for current user
                         isCurrentUser)
                {
                    presenceSource = "presence_xa.png";
                }
            }
            return(presenceSource);
        }
Exemple #4
0
        public static String GetPresenceSourceFromPresence(Rainbow.Model.Presence presence)
        {
            String presenceSource = "";

            if (presence != null)
            {
                if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Online)
                {
                    if (presence.Resource.StartsWith("mobile"))
                    {
                        presenceSource = "presence_online_mobile.png";
                    }
                    else
                    {
                        presenceSource = "presence_online.png";
                    }
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Offline)
                {
                    presenceSource = "presence_offline.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Away)
                {
                    presenceSource = "presence_away.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Xa)
                {
                    presenceSource = "presence_xa.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Dnd)
                {
                    presenceSource = "presence_dnd.png";
                }
                else if (presence.PresenceLevel == Rainbow.Model.PresenceLevel.Busy)
                {
                    presenceSource = "presence_busy.png";
                }
            }
            return(presenceSource);
        }