public void ChildLeave(Guid childID, eChildStatus status)
        {
            if (children.ContainsKey(childID))
            {
                var child     = children[childID];
                var advisorID = child.Advisor;
                var text      = Child.StatusText(child.Name == childID.ToString() ? "Client" : child.Name, status);
                if (advisorID.HasValue && advisors.ContainsKey(advisorID.Value))
                {
                    ChildSay(childID, text, eMessageType.Leave);
                    var advisor = advisors[advisorID.Value];
                    advisor.Child  = null;
                    advisor.Status = eAdvisorStatus.Hold;
                }

                children.Remove(childID);
            }
        }
Esempio n. 2
0
        public static string StatusText(string name, eChildStatus reason)
        {
            DateTime when = DateTime.Now;
            string   text = "";

            switch (reason)
            {
            case eChildStatus.Active:
                text = string.Format("{0} is typing a message", name);
                break;

            case eChildStatus.Ready:
                text = string.Format("{0} has an advisor assigned", name);
                break;

            case eChildStatus.Waiting:
                text = string.Format("{0} is waiting for an advisor", name);
                break;

            case eChildStatus.Offline:
                text = string.Format("{0} left the chat at {1}", name, when.ToShortTimeString());
                break;

            case eChildStatus.Timeout:
                text = string.Format("{0} left the chat at {1}, due to timeout", name, when.ToShortTimeString());
                break;

            case eChildStatus.Panic:
                text = string.Format("{0} left the chat at {1} due to panic...", name, when.ToShortTimeString());
                break;

            default:
                text = "";
                break;
            }
            return(text);
        }
        public void ChildLeave(Guid childID, eChildStatus status)
        {
            if (children.ContainsKey(childID))
            {
                var child = children[childID];
                var advisorID = child.Advisor;
                var text = Child.StatusText(child.Name == childID.ToString() ? "Client" : child.Name, status);
                if (advisorID.HasValue && advisors.ContainsKey(advisorID.Value))
                {
                    ChildSay(childID, text, eMessageType.Leave);
                    var advisor = advisors[advisorID.Value];
                    advisor.Child = null;
                    advisor.Status = eAdvisorStatus.Hold;
                }

                children.Remove(childID);
            }
        }
Esempio n. 4
0
 public static string StatusText(string name, eChildStatus reason)
 {
     DateTime when = DateTime.Now;
     string text = "";
     switch (reason)
     {
         case eChildStatus.Active:
             text = string.Format("{0} is typing a message", name);
             break;
         case eChildStatus.Ready:
             text = string.Format("{0} has an advisor assigned", name);
             break;
         case eChildStatus.Waiting:
             text = string.Format("{0} is waiting for an advisor", name);
             break;
         case eChildStatus.Offline:
             text = string.Format("{0} left the chat at {1}", name, when.ToShortTimeString());
             break;
         case eChildStatus.Timeout:
             text = string.Format("{0} left the chat at {1}, due to timeout", name, when.ToShortTimeString());
             break;
         case eChildStatus.Panic:
             text = string.Format("{0} left the chat at {1} due to panic...", name, when.ToShortTimeString());
             break;
         default:
             text = "";
             break;
     }
     return text;
 }