private void LoadAvaliableAgent(OrgUserItem parentItem, string parentId)
 {
     try
     {
         WebRequest webRequest = new WebRequest
         {
             Session = CurrentApp.Session,
             Code    = (int)S3603Codes.OptGetCtrolAgent
         };
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add(parentId);
         Service36031Client client = new Service36031Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service36031"));
         //var client = new Service36031Client();
         WebReturn webReturn = client.UmpTaskOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException("Fail.\tListData is null");
             return;
         }
         foreach (string strInfo in webReturn.ListData)
         {
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                              StringSplitOptions.RemoveEmptyEntries);
             if (arrInfo.Length < 3)
             {
                 continue;
             }
             string      strId       = arrInfo[0];
             string      strName     = arrInfo[1];
             string      strFullName = arrInfo[2];
             OrgUserItem item        = new OrgUserItem
             {
                 ObjType     = ConstValue.RESOURCE_AGENT,
                 ObjID       = Convert.ToInt64(strId),
                 Name        = strName,
                 Description = strFullName,
                 Data        = strInfo,
                 Icon        = "Images/user_suit.png"
             };
             Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
             _mListOrgUserItems.Add(item);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Beispiel #2
0
 private void LoadAvaliableUsers(OrgUserItem parentItem, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)RequestCode.WSGetUserObjList;
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add("0");
         webRequest.ListData.Add(ConstValue.RESOURCE_USER.ToString());
         webRequest.ListData.Add(parentID);
         Service11012Client client = new Service11012Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service11012"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("Fail.\tListData is null"));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string   strInfo = webReturn.ListData[i];
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                              StringSplitOptions.RemoveEmptyEntries);
             if (arrInfo.Length < 3)
             {
                 continue;
             }
             string      strID       = arrInfo[0];
             string      strName     = arrInfo[1];
             string      strFullName = arrInfo[2];
             OrgUserItem item        = new OrgUserItem();
             item.ObjType     = ConstValue.RESOURCE_USER;
             item.ObjID       = Convert.ToInt64(strID);
             item.Name        = strName;
             item.Description = strFullName;
             item.Data        = strInfo;
             item.Icon        = "Images/user.ico";
             Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
             mListOrgUserItems.Add(item);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
 private void AddChild(OrgUserItem parent, OrgUserItem child)
 {
     Dispatcher.Invoke(new Action(() => parent.AddChild(child)));
 }
        private void LoadAvaliableOrgs(OrgUserItem parentItem, string parentId)
        {
            try
            {
                WebRequest webRequest = new WebRequest
                {
                    Session = CurrentApp.Session,
                    Code    = (int)RequestCode.WSGetUserObjList
                };
                webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                webRequest.ListData.Add("0");
                webRequest.ListData.Add(ConstValue.RESOURCE_ORG.ToString());
                webRequest.ListData.Add(parentId);
                Service11012Client client = new Service11012Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service11012"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowException("Fail.\tListData is null");
                    return;
                }
                foreach (string strInfo in webReturn.ListData)
                {
                    string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                                     StringSplitOptions.RemoveEmptyEntries);
                    if (arrInfo.Length < 2)
                    {
                        continue;
                    }
                    string      strId   = arrInfo[0];
                    string      strName = arrInfo[1];
                    OrgUserItem item    = new OrgUserItem
                    {
                        ObjType = ConstValue.RESOURCE_ORG,
                        ObjID   = Convert.ToInt64(strId),
                        Name    = strName,
                        Data    = strInfo,
                        Icon    = strId == ConstValue.ORG_ROOT.ToString() ? "Images/rootorg.ico" : "Images/org.ico"
                    };
                    LoadAvaliableOrgs(item, strId);
                    //LoadAvaliableUsers(item, strID);
                    if (S3603App.GroupingWay.Contains("A"))
                    {
                        LoadAvaliableAgent(item, strId);
                    }

                    Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
                    _mListOrgUserItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }