You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
4.8 KiB
163 lines
4.8 KiB
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Collections;
|
|
|
|
using ZwSoft.ZwCAD.DatabaseServices;
|
|
using ZwSoft.ZwCAD.Runtime;
|
|
using ZwSoft.ZwCAD.Geometry;
|
|
using ZwSoft.ZwCAD.ApplicationServices;
|
|
using ZwSoft.ZwCAD.EditorInput;
|
|
|
|
|
|
|
|
using Teamcenter.Hello;
|
|
using Teamcenter.Soa.Client;
|
|
using Teamcenter.ClientX;
|
|
using Teamcenter.Services.Strong.Core;
|
|
using Teamcenter.Soa.Client.Model;
|
|
using Teamcenter.Soa.Exceptions;
|
|
using Teamcenter.Services.Strong.Query;
|
|
|
|
using Teamcenter.Services.Strong.Core._2007_06.DataManagement;
|
|
using Teamcenter.Services.Strong.Core._2006_03.Reservation;
|
|
|
|
using Teamcenter.Services.Strong.Core._2006_03.FileManagement;
|
|
|
|
using Teamcenter.Soa.Internal.Client.Model;
|
|
using Teamcenter.Soa.Internal.Client;
|
|
|
|
using HelloTeamcenter.hello;
|
|
|
|
|
|
using User = Teamcenter.Soa.Client.Model.Strong.User;
|
|
using Folder = Teamcenter.Soa.Client.Model.Strong.Folder;
|
|
using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject;
|
|
using Item = Teamcenter.Soa.Client.Model.Strong.Item;
|
|
using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision;
|
|
using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery;
|
|
using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset;
|
|
using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults;
|
|
using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile;
|
|
|
|
|
|
|
|
namespace HelloTeamcenter.form
|
|
{
|
|
public partial class Search1 : Form
|
|
{
|
|
public Search1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public List<ALLOBJECT> itemlist = new List<ALLOBJECT>();
|
|
|
|
|
|
public Document appdoc;
|
|
public User user;
|
|
public Editor ed;
|
|
public bool hasRight = true;
|
|
|
|
public Hashtable itemtypetable;
|
|
|
|
public string xmlpath = "";
|
|
|
|
private void Search1_Load(object sender, EventArgs e)
|
|
{
|
|
this.textBox1.Text = "";
|
|
this.textBox2.Text = "";
|
|
|
|
}
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
string name = textBox1.Text;
|
|
string item_id = textBox2.Text;
|
|
|
|
if (name == "")
|
|
{
|
|
name = "*";
|
|
}
|
|
if (item_id == "")
|
|
{
|
|
item_id = "*";
|
|
}
|
|
|
|
|
|
DataManagementService dmService = DataManagementService.getService(Session.getConnection());
|
|
OriginTool tool = new OriginTool();
|
|
SavedQueryResults found = tool.getSearchItem(item_id, name, "*", "*");
|
|
if (found != null && found.NumOfObjects > 0)
|
|
{
|
|
this.treeView1.Nodes.Clear();
|
|
for (int i = 0; i < found.NumOfObjects; i++)
|
|
{
|
|
Item item = found.Objects[i] as Item;
|
|
ModelObject[] objects = { item };
|
|
String[] attributes = { "object_string", "revision_list" };
|
|
dmService.RefreshObjects(objects);
|
|
dmService.GetProperties(objects, attributes);
|
|
|
|
ModelObject[] revlist = item.Revision_list;
|
|
|
|
dmService.RefreshObjects(revlist);
|
|
|
|
bool isCheck = this.checkBox1.Checked;
|
|
if (isCheck)
|
|
{
|
|
revlist = new ModelObject[] { revlist[revlist.Length - 1] };
|
|
}
|
|
|
|
for (int k = 0; k < revlist.Length; k++)
|
|
{
|
|
String[] attr = { "object_string" };
|
|
|
|
ItemRevision itemRev = revlist[k] as ItemRevision;
|
|
ModelObject[] obj2 = { itemRev };
|
|
|
|
dmService.RefreshObjects(obj2);
|
|
|
|
dmService.GetProperties(obj2, attr);
|
|
|
|
string inname = itemRev.Object_string;
|
|
TreeNode childnode = new TreeNode(inname, 3, 3);
|
|
this.treeView1.Nodes.Add(childnode);
|
|
ALLOBJECT perobject = new ALLOBJECT();
|
|
perobject.workobject = itemRev;
|
|
perobject.treenode = childnode;
|
|
itemlist.Add(perobject);
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
}
|
|
foreach (TreeNode ch in treeView1.Nodes)
|
|
{
|
|
ch.EnsureVisible();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
|
|
{
|
|
TreeNode nownode = this.treeView1.SelectedNode;
|
|
|
|
foreach (TreeNode ch in nownode.Nodes)
|
|
{
|
|
ch.EnsureVisible();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|