Пример #1
0
 private void InitControlAgents(CtrolAgent parentItem, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = 11;
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add(parentID);
         Service31021Client client = new Service31021Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service31021"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(CurrentApp.GetLanguageInfo("3105T00101", string.Format("ListData 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];
             CtrolAgent item        = new CtrolAgent();
             item.ObjType     = ConstValue.RESOURCE_AGENT;
             item.ObjID       = Convert.ToInt64(strID);
             item.Name        = strName;
             item.Description = strFullName;
             item.IsChecked   = true;
             item.IsExpanded  = true;
             item.Data        = strInfo;
             item.Icon        = "Images/agent.ico";
             if (item.Name != "N/A")
             {
                 AddChildObject(parentItem, item);
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Пример #2
0
 void QueryAppealResult_Loaded(object sender, RoutedEventArgs e)
 {
     mListAgents = new CtrolAgent();
     ChangeLanguage();
     InitControlTime();
     InitControlObjects();
     InitChkClick();
     TagenObjects.ItemsSource = mListAgents.Children;
 }
Пример #3
0
 private void GetOrgIsCheck(CtrolAgent parent, ref List <CtrolAgent> lstCtrolAgent)
 {
     foreach (CtrolAgent o in parent.Children)
     {
         if (o.IsChecked == true && o.ObjType == ConstValue.RESOURCE_AGENT)
         {
             CtrolAgent ctrolOrg = new CtrolAgent();
             ctrolOrg.ObjID = o.ObjID;
             ctrolOrg.Name  = o.Name;
             lstCtrolAgent.Add(ctrolOrg);
         }
         if (o.ObjType != 0 && o.Children.Count > 0)
         {
             GetOrgIsCheck(o, ref lstCtrolAgent);
         }
     }
 }
Пример #4
0
 private void AddChildObject(CtrolAgent parentItem, CtrolAgent item)
 {
     Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
 }
Пример #5
0
 private void InitControlOrgs(CtrolAgent parentItem, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = 10;
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add(parentID);
         Service31021Client client = new Service31021Client(
             WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
             WebHelper.CreateEndpointAddress(
                 CurrentApp.Session.AppServerInfo,
                 "Service31021"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(CurrentApp.GetLanguageInfo("3105T00101", string.Format("ListData 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 < 2)
             {
                 continue;
             }
             string     strID   = arrInfo[1];
             string     strName = arrInfo[0];
             CtrolAgent item    = new CtrolAgent();
             item.ObjType    = ConstValue.RESOURCE_ORG;
             item.ObjID      = Convert.ToInt64(strID);
             item.Name       = strName;
             item.IsChecked  = true;
             item.IsExpanded = true;
             item.Data       = strInfo;
             if (strID == ConstValue.ORG_ROOT.ToString())
             {
                 item.Icon = "Images/rootorg.ico";
             }
             else
             {
                 item.Icon = "Images/org.ico";
             }
             InitControlOrgs(item, strID);
             InitControlAgents(item, strID);
             AddChildObject(parentItem, item);
         }
         List <CtrolAgent> lstCtrolOrgTemp = new List <CtrolAgent>();
         GetOrgIsCheck(mListAgents, ref lstCtrolOrgTemp);
         if (lstCtrolOrgTemp.Count > 0)
         {
             AgentsStr = SaveMultiAgent(lstCtrolOrgTemp);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }