Re: AgentUserId is member of what department

  •  02-20-2011, 6:07 PM

    Re: AgentUserId is member of what department

    Dear DavidMag,
     
    The following snippet demonstrates how to load departments and opertors from database, you can find this snippet in file "ManageDepartments.aspx" which can be found in download package.
     
    private void DataGrid3_DataBinding(object sender, EventArgs e)
     {
      string deptname=(string)ManageLiveSupport.DataGrid2.DataKeys[Item.ItemIndex];

      CuteChat.SupportDepartment[] departments=CuteChat.ChatWebUtility.LoadDepartments();
      
      foreach(CuteChat.SupportDepartment department in departments)
      {
       if(department.Name==deptname)
       {
        DataTable table=new DataTable();

        table.Columns.Add("LoginName",typeof(string));
        table.Columns.Add("DisplayName",typeof(string));

        foreach(CuteChat.SupportAgent agent in department.Agents)
        {
         string loginName=CuteChat.ChatProvider.Instance.FromUserId(agent.UserId);
         string dispName=null;
         CuteChat.ChatProvider.Instance.GetUserInfo(loginName,ref dispName);
         table.Rows.Add(new object[]{loginName,dispName});
        }
        table.AcceptChanges();
        DataGrid3.DataSource=table.DefaultView;
       }
      }
     }
     
    Thank you for asking
View Complete Thread