CuteChat.ChatWebUtility.HasReadyAgents()

Last post 11-12-2012, 1:56 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  11-12-2012, 11:46 AM 75213

    CuteChat.ChatWebUtility.HasReadyAgents()

    Hi,

     

    Just wondering how the HasReadyAgents() works? Can you provide a glimse of the technicality behind how it determines if/when agents are online?

     

    Thanks, 

  •  11-12-2012, 1:56 PM 75216 in reply to 75213

    Re: CuteChat.ChatWebUtility.HasReadyAgents()

    Hi JJallad,

     

    Please try the example page below, it shows you how to get the online agent and this agent's department.

     

    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4.   
    5. <script runat="server">  
    6.     protected override void OnLoad(EventArgs e)  
    7.     {  
    8.         CuteChat.ChatPortal portal = CuteChat.ChatSystem.Instance.GetCurrentPortal();  
    9.         lock (portal)  
    10.         {  
    11.             if (portal.IsPlaceStarted("SupportAgent"))  
    12.             {  
    13.                 CuteChat.SupportAgentChannel sac = (CuteChat.SupportAgentChannel)portal.GetPlace("SupportAgent");  
    14.                 foreach (CuteChat.ChatPlaceUser user in sac.GetAllUsers())  
    15.                 {  
    16.                     if (user != null)  
    17.                     {  
    18.                         label1.Text += "user name: ";  
    19.                         label1.Text += user.DisplayName;  
    20.                         label1.Text += "<br/>";  
    21.                         label1.Text += "department: ";  
    22.                         CuteChat.SupportDepartment[] supportDepartments = CuteChat.ChatSystem.Instance.GetCurrentPortal().DataManager.GetDepartments();  
    23.                         for (int i = 0; i < supportDepartments.Length; i++)  
    24.                         {  
    25.                             for (int j = 0; j < supportDepartments[i].Agents.Length; j++)  
    26.                             {  
    27.                                 if (user.Identity.UniqueId == supportDepartments[i].Agents[j].UserId)  
    28.                                 {  
    29.                                     label1.Text += supportDepartments[i].Name;  
    30.                                     label1.Text += ",";  
    31.                                 }  
    32.                             }  
    33.   
    34.                         }  
    35.   
    36.                     }  
    37.                 }  
    38.   
    39.             }  
    40.         }  
    41.         base.OnLoad(e);  
    42.     }  
    43. </script>  
    44.   
    45. <html xmlns="http://www.w3.org/1999/xhtml">  
    46. <head runat="server">  
    47.     <title>Untitled Page</title>  
    48. </head>  
    49. <body>  
    50.     <form id="form1" runat="server">  
    51.         <asp:Label ID="label1" runat="server"></asp:Label>  
    52.     </form>  
    53. </body>  
    54. </html>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML