private void PpmSync_Load(object sender, EventArgs e) { if (eppm == null) { MessageBox.Show("No eppm Connection"); return; } using (EPSService epsServ = new EPSService()) { epsServ.Url = String.Format("{0}/p6ws/services/EPSService", Properties.Settings.Default.EppmWsUrl); epsServ.CookieContainer = eppm.sessionCookie; using (ProjectService projServ = new ProjectService()) { projServ.Url = String.Format("{0}/p6ws/services/V1/ProjectService", Properties.Settings.Default.EppmWsUrl); projServ.CookieContainer = eppm.sessionCookie; TreeNode[] treeNodes = _readEPS2Tree(epsServ, null, projServ); if (treeNodes != null) { projectTree.Nodes.AddRange(treeNodes); projectTree.Enabled = true; } } } //using(Code) }
public P6EpsService(P6AuthenticationService authenticationService) { _epsService = new EPSService { CookieContainer = authenticationService.CookieContainer, Url = authenticationService.AuthService.Url.Replace("AuthenticationService", "EPSService") }; }
private TreeNode[] _readEPS2Tree(EPSService epss, int?parentObjectId, ProjectService projServ = null) { //epss.CookieContainer = eppmConnection.sessionCookie; //string[] fields = new string(["ObjectId", "ParentObjectId", "Id", "Name"]); string[] fields = new string[4] { "ObjectId", "ParentObjectId", "Id", "Name" }; ReadEPS readEPS = new ReadEPS(); readEPS.Field = new EPSFieldType[4] { EPSFieldType.ObjectId, EPSFieldType.ParentObjectId, EPSFieldType.Id, EPSFieldType.Name }; readEPS.Filter = (parentObjectId == null) ? "ParentObjectId IS NULL" : String.Format("ParentObjectId = {0}", parentObjectId); EPS[] res = epss.ReadEPS(readEPS); if (res.Length == 0) { return(null); } TreeNode[] treeNodes = new TreeNode[res.Length]; int i = 0; foreach (EPS r in res) { TreeNode nod = new TreeNode(); nod.Text = r.Name; nod.Tag = String.Format("eps-{0}", r.ObjectId); TreeNode[] nodes = this._readEPS2Tree(epss, r.ObjectId, projServ); if (nodes != null) { nod.Nodes.AddRange(nodes); } if (projServ != null) { TreeNode[] projs = this._readProjects(projServ, r.ObjectId); if (projs != null) { nod.Nodes.AddRange(projs); } } nod.Expand(); treeNodes[i] = nod; i++; } return(treeNodes); }
private void Win_OnEppmConnected(EppmConnection eppmConnection) { this.eppmConnection = eppmConnection; this.eppmConnectBtn.Text = "Отключиться"; this.isEppmConnect = true; this.eppmStatusConnection.Text = String.Format("Подключено к {0}", this.eppmConnection.dbName); using (EPSService epsServ = new EPSService()) { epsServ.Url = String.Format("{0}/p6ws/services/EPSService", Properties.Settings.Default.EppmWsUrl); epsServ.CookieContainer = eppmConnection.sessionCookie; using (ProjectService projServ = new ProjectService()) { projServ.Url = String.Format("{0}/p6ws/services/V1/ProjectService", Properties.Settings.Default.EppmWsUrl); projServ.CookieContainer = eppmConnection.sessionCookie; TreeNode[] treeNodes = _readEPS2Tree(epsServ, null, projServ); if (treeNodes != null) { projectTree.Nodes.AddRange(treeNodes); projectTree.Enabled = true; } } } }