コード例 #1
0
        private void InitControlExtension(string parentID)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = Session;
                webRequest.Code    = (int)S3107Codes.GetControlAgentInfoList;
                webRequest.ListData.Add(Session.UserID.ToString());
                webRequest.ListData.Add(parentID);
                webRequest.ListData.Add("E");
                //Service31071Client client = new Service31071Client();
                Service31071Client client = new Service31071Client(WebHelper.CreateBasicHttpBinding(Session), WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service31071"));
                //WebHelper.SetServiceClient(client);
                WebReturn webReturn = client.UMPTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowExceptionMessage(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;
                    }

                    CtrolAgent ctrolEx = new CtrolAgent();
                    ctrolEx.AgentID       = arrInfo[0];
                    ctrolEx.AgentName     = arrInfo[1];
                    ctrolEx.AgentFullName = arrInfo[2];
                    ctrolEx.AgentOrgID    = parentID;
                    if (ListCtrolExtension.Where(p => p.AgentID == ctrolEx.AgentID).Count() == 0)
                    {
                        ListCtrolExtension.Add(ctrolEx);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex.Message);
            }
        }
コード例 #2
0
        //private void tv_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    Thread t = new Thread(() =>
        //    {
        //        Thread.Sleep(500);//次线程休眠1秒
        //        Dispatcher.Invoke(new Action(() =>
        //        {
        //            List<CtrolAgent> lstCtrolAgentTemp = new List<CtrolAgent>();
        //            GetAgentIsCheck(mRootItem, ref lstCtrolAgentTemp);
        //            if (lstCtrolAgentTemp.Count > 0)
        //            {
        //                string stra = "";
        //                foreach (CtrolAgent ca in lstCtrolAgentTemp)
        //                {
        //                    stra += ca.AgentName + ",";
        //                }
        //                stra = stra.TrimEnd(',');
        //                txtAgent.Text = stra;
        //            }
        //            else
        //                txtAgent.Text = "";
        //        }));
        //    });
        //    t.Start();
        //}

        private void GetAgentIsCheck(ObjectItemClient parent, ref List <CtrolAgent> lstCtrolAgent)
        {
            foreach (ObjectItemClient o in parent.Children)
            {
                if (o.IsChecked == true && o.ObjType == ConstValue.RESOURCE_AGENT)//座席編號103
                {
                    CtrolAgent ctrolAgent = new CtrolAgent();
                    ctrolAgent.AgentID       = o.ObjID.ToString();
                    ctrolAgent.AgentName     = o.Name;
                    ctrolAgent.AgentFullName = o.Description;
                    lstCtrolAgent.Add(ctrolAgent);
                }
                if (o.ObjType == ConstValue.RESOURCE_ORG && o.Children.Count > 0)
                {
                    GetAgentIsCheck(o, ref lstCtrolAgent);
                }
            }
        }