private void LoadManager(ObjectItem parentItem, string ParentID) { DataRow[] DT = S1103App.IDataTable11006.Select(string.Format("C004={0}", ParentID)); foreach (DataRow drOrg in DT) { ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_ORG; item.ObjID = Convert.ToInt64(drOrg["C001"].ToString()); item.Name = S1103App.DecryptString(drOrg["C002"].ToString()); item.IsChecked = false; if (item.ObjID.ToString() == ConstValue.ORG_ROOT.ToString()) { item.Icon = "Images/root.ico"; } else { item.Icon = "Images/org.ico"; } //加载下面的机构和用户 LoadManager(item, item.ObjID.ToString()); LoadUser(item, item.ObjID.ToString()); Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); } }
private void LoadAvaliableRealExts(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1101Codes.GetControlRealExtensionInfoList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(parentID); //Service11011Client client = new Service11011Client(); Service11011Client client = new Service11011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11011")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("InitControlExtension 1 Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); return; } //List<ObjectItem> listChild = new List<ObjectItem>(); for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <BasicUserInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("InitControlExtension Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } BasicUserInfo ExtensionInfo = optReturn.Data as BasicUserInfo; if (ExtensionInfo.IsDeleted == "0") { ObjectItem item = new ObjectItem(); item.ObjType = S1101Consts.OBJTYPE_REALEXTENSION; item.ObjID = ExtensionInfo.UserID; item.Icon = "Images/RealExtension.ico"; item.Name = ExtensionInfo.Account; item.FullName = ExtensionInfo.FullName; item.Description = ExtensionInfo.FullName; item.Data = ExtensionInfo; //listChild.Add(item); Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListObjectItems.Add(item); } } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadAvaliableAgents(ObjectItem 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_AGENT.ToString()); webRequest.ListData.Add(parentID); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); 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]; ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_AGENT; item.ObjID = Convert.ToInt64(strID); item.Name = strName.Replace("@", @"\"); item.Description = strFullName; item.Data = strInfo; item.Icon = "Images/agent.ico"; Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListObjectItems.Add(item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadDriverList() { try { if (ServerItem == null) { return; } var serverInfo = ServerItem.Info; if (serverInfo == null) { return; } string strAddress = serverInfo.FullName; WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S2106Codes.GetDiskDriverList; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add(strAddress); Service21061Client client = new Service21061Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service21061")); WebReturn webReturn = client.DoOperation(webRequest); if (!webReturn.Result) { ShowException(string.Format("WSFail.\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.None); if (arrInfo.Length < 2) { continue; } DirInfo dirInfo = new DirInfo(); dirInfo.Name = arrInfo[0]; dirInfo.Path = arrInfo[0] + "\\"; ObjectItem item = new ObjectItem(); item.Data = dirInfo; item.Name = dirInfo.Name; item.Icon = "/UMPS2106;component/Themes/Default/UMPS2106/Images/00006.png"; Dispatcher.Invoke(new Action(() => mRootItem.AddChild(item))); } } catch (Exception ex) { ShowException(ex.Message); } }
private void AddChildObjectItem(ObjectItem parent, ObjectItem child) { Dispatcher.Invoke(new Action(() => { if (parent != null) { parent.AddChild(child); } })); }
//加载录音服务器树 private void LoadVCLog(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1101Codes.GetResourceObjList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("221"); //webRequest.ListData.Add("1"); Service11011Client client = new Service11011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11011")); WebHelper.SetServiceClient(client); 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]; ResourceInfo RI = new ResourceInfo(); for (int j = 0; j < mListResourcesInfo.Count; j++) { if (strInfo == mListResourcesInfo[j].ResourceID.ToString()) { ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_ORG; item.ObjID = mListResourcesInfo[j].ResourceID; item.Name = mListResourcesInfo[j].Tostring(); item.Data = mListResourcesInfo[j]; item.Icon = "Images/voiceserver.png"; Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListObjectItems.Add(item); } } } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadSkillGroup(ObjectItem mRootItemSG) { foreach (DataRow drOrg in S1103App.IDataTable11009.Rows) { ObjectItem item = new ObjectItem(); item.Icon = "Images/skillgroup.png"; item.ObjType = 906; item.ObjID = Convert.ToInt64(drOrg["C001"].ToString()); item.Name = string.Format("{0}({1})", S1103App.DecryptString(drOrg["C006"].ToString()), drOrg["C008"].ToString()); item.IsChecked = false; Dispatcher.Invoke(new Action(() => mRootItemSG.AddChild(item))); //mListObjectItem.Add(item); } }
private void LoadUser(ObjectItem parentItem, string ParentID) { DataRow[] DT_User = S1103App.IDataTable11005.Select(string.Format("C006={0}", ParentID)); foreach (DataRow drOrg in DT_User) { ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_USER; item.ObjID = Convert.ToInt64(drOrg["C001"].ToString()); item.Name = string.Format("{0}({1})", S1103App.DecryptString(drOrg["C002"].ToString()), S1103App.DecryptString(drOrg["C003"].ToString())); item.Icon = "Images/user.ico"; item.IsChecked = false; //加载下面的机构和用户 LoadManager(item, item.ObjID.ToString()); Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); } }
private void GetChildDirItems(ObjectItem parentItem) { try { string strAddress = string.Empty; if (string.IsNullOrEmpty(strAddress)) { ShowException(string.Format("Server address is empty")); return; } if (parentItem == null) { return; } var parentDir = parentItem.Data as DirInfo; if (parentDir == null) { return; } ServerRequestInfo requestInfo = new ServerRequestInfo(); requestInfo.ServerHost = strAddress; requestInfo.ServerPort = 8009; requestInfo.Command = (int)ServerRequestCommand.GetChildDirectoryList; requestInfo.ListData.Add(parentDir.Path); OperationReturn optReturn = XMLHelper.SeriallizeObject(requestInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1110Codes.GetServerInfo; webRequest.Data = optReturn.Data.ToString(); Service11102Client client = new Service11102Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11102")); WebReturn webReturn = null; if (MainPage != null) { MainPage.SetBusy(true, CurrentApp.GetMessageLanguageInfo("004", "Getting server directory information")); } mWorker = new BackgroundWorker(); mWorker.DoWork += (s, de) => { try { webReturn = client.DoOperation(webRequest); client.Close(); } catch (Exception ex) { ShowException(ex.Message); } }; mWorker.RunWorkerCompleted += (s, re) => { mWorker.Dispose(); if (MainPage != null) { MainPage.SetBusy(false, string.Empty); } if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("ListData is null")); return; } parentItem.Children.Clear(); for (int i = 0; i < webReturn.ListData.Count; i++) { string info = webReturn.ListData[i]; string[] arrInfo = info.Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.None); if (arrInfo.Length < 2) { continue; } DirInfo dirInfo = new DirInfo(); dirInfo.Name = arrInfo[0]; dirInfo.Path = arrInfo[1]; ObjectItem item = new ObjectItem(); item.Type = S1110Consts.OBJECTITEMTYPE_DIRINFO; item.Name = dirInfo.Name; item.Icon = string.Format("../Themes/Default/UMPS1110/Images/{0}", "folder.png"); item.Description = dirInfo.Path; item.Data = dirInfo; parentItem.AddChild(item); } if (mConfigObject != null) { switch (mConfigObject.ObjectType) { case S1110Consts.RESOURCE_VOICESERVER: case S1110Consts.RESOURCE_NTIDRVPATH: //GetChildFileItems(parentItem); break; } } parentItem.IsExpanded = true; }; mWorker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }
private void AddChildObject(ObjectItem parentItem, ObjectItem item) { Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); }
private void LoadCtlUser(ObjectItem parentItem, long parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetUserCtlObjList; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add("0"); webRequest.ListData.Add(ConstValue.RESOURCE_USER.ToString()); webRequest.ListData.Add(parentID.ToString()); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012")); WebReturn webReturn = client.DoOperation(webRequest); if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("ListData is null")); return; } OperationReturn optReturn; int count = 0; for (int i = 0; i < webReturn.ListData.Count; i++) { string strInfo = webReturn.ListData[i]; optReturn = XMLHelper.DeserializeObject <ResourceObject>(strInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ResourceObject obj = optReturn.Data as ResourceObject; if (obj == null) { ShowException(string.Format("ResourceObject is null.")); return; } ObjectItem item = new ObjectItem(); item.Data = obj; item.ObjID = obj.ObjID; item.ObjType = ConstValue.RESOURCE_USER; item.Name = obj.Name; string strFullName = obj.FullName; if (string.IsNullOrEmpty(strFullName)) { strFullName = obj.Name; } item.FullName = strFullName; item.Description = strFullName; item.Icon = "Images/user.ico"; Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListCtlObjects.Add(item); count++; } CurrentApp.WriteLog("LoadCtlUser", string.Format("End.\t{0}\t{1}", parentID, count)); } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadCtlAgent(ObjectItem parentItem, long parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetUserCtlObjList; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add("0"); webRequest.ListData.Add(ConstValue.RESOURCE_AGENT.ToString()); webRequest.ListData.Add(parentID.ToString()); webRequest.ListData.Add("2"); // Service11012Client client = new Service11012Client(); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012")); WebReturn webReturn = client.DoOperation(webRequest); if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("ListData is null")); return; } OperationReturn optReturn; for (int i = 0; i < webReturn.ListData.Count; i++) { string strInfo = webReturn.ListData[i]; optReturn = XMLHelper.DeserializeObject <ResourceObject>(strInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ResourceObject obj = optReturn.Data as ResourceObject; if (obj == null) { ShowException(string.Format("ResourceObject is null.")); return; } AgentInfo agentInfo = new AgentInfo(); agentInfo.SerialID = obj.ObjID; agentInfo.AgentID = obj.Name; agentInfo.AgentName = obj.FullName; agentInfo.OrgID = parentID; agentInfo.State = obj.State; agentInfo.Tenure = obj.Tenure; ObjectItem item = new ObjectItem(); item.Data = agentInfo; item.ObjID = agentInfo.SerialID; item.ObjType = ConstValue.RESOURCE_AGENT; item.Name = agentInfo.AgentID; string strFullName = agentInfo.AgentName; if (string.IsNullOrEmpty(strFullName)) { strFullName = obj.Name; } item.FullName = strFullName; item.Description = strFullName; // item.Icon = "Images/agent.ico"; item.State = agentInfo.State; if (item.State == 0) { item.Icon = "Images/agent.ico"; } else { item.Icon = "Images/agentforbid.ico"; } item.AgentTenure = agentInfo.Tenure; Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListCtlObjects.Add(item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadAvaliableOrgs(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S1101Codes.GetOrganizationList; webRequest.Session = CurrentApp.Session; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add(parentID); Service11011Client client = new Service11011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11011")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } List <ObjectItem> listChild = new List <ObjectItem>(); for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <BasicOrgInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } BasicOrgInfo orgInfo = optReturn.Data as BasicOrgInfo; if (orgInfo != null) { ObjectItem item = new ObjectItem(); item.ObjType = S1101Consts.OBJTYPE_ORG; item.ObjID = orgInfo.OrgID; orgInfo.OrgName = orgInfo.OrgName; orgInfo.StrStartTime = DateTime.Parse(orgInfo.StrStartTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); orgInfo.StrEndTime = orgInfo.StrEndTime; if (!orgInfo.StrEndTime.ToUpper().Equals("UNLIMITED")) { orgInfo.EndTime = DateTime.Parse(orgInfo.StrEndTime).ToLocalTime(); orgInfo.StrEndTime = DateTime.Parse(orgInfo.StrEndTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); } orgInfo.CreateTime = orgInfo.CreateTime.ToLocalTime(); item.Name = orgInfo.OrgName; item.FullName = item.Name; item.Description = orgInfo.Description; item.State = Convert.ToInt32(orgInfo.IsActived); item.ObjParentID = orgInfo.ParentID; if (item.State == 1) { item.TipState = CurrentApp.GetLanguageInfo("1101T10109", "IsActived"); } else { item.TipState = CurrentApp.GetLanguageInfo("1101T10110", "Disable"); } if (item.ObjID == ConstValue.ORG_ROOT) { item.Icon = "Images/root.ico"; } else { item.Icon = "Images/org.ico"; } item.Data = orgInfo; LoadAvaliableOrgs(item, orgInfo.OrgID.ToString()); Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); } } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadUserOrgs(ObjectItem parentItem) { string OrgID = string.Empty; try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetUserObjList; webRequest.ListData.Add(UserItem.ObjID.ToString()); webRequest.ListData.Add("0"); webRequest.ListData.Add(ConstValue.RESOURCE_ORG.ToString()); webRequest.ListData.Add("-1"); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); } if (webReturn.ListData.Count > 0) //for (int i = 0; i < webReturn.ListData.Count; i++) { string strInfo = webReturn.ListData[0]; string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.RemoveEmptyEntries); if (arrInfo.Length < 2) { return; } OrgID = arrInfo[0]; string strName = arrInfo[1]; ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_ORG; item.ObjID = Convert.ToInt64(OrgID); item.Name = strName; item.Data = strInfo; if (OrgID == ConstValue.ORG_ROOT.ToString()) { item.Icon = "Images/root.ico"; } else { item.Icon = "Images/org.ico"; } LoadAvaliableOrgs(item, OrgID); LoadAvaliableUsers(item, OrgID); if (PageParent.InitParameter.Contains("A")) { LoadAvaliableAgents(item, OrgID); } if (PageParent.InitParameter.Contains("E")) { LoadAvaliableExts(item, OrgID); } if (PageParent.InitParameter.Contains("R")) { LoadAvaliableRealExts(item, OrgID); } Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); mListObjectItems.Add(item); } } catch (Exception ex) { ShowException(ex.Message); } }