Beispiel #1
0
        private List <VDF.Vault.Currency.Entities.IEntity> DoCustEntSearch(SrchCond[] conditions)
        {
            string     bookmark = string.Empty;
            SrchStatus status   = null;

            //search for files
            List <VDF.Vault.Currency.Entities.IEntity> retVal = new List <VDF.Vault.Currency.Entities.IEntity>();

            while (status == null || retVal.Count < status.TotalHits)
            {
                CustEnt[] ents = m_conn.WebServiceManager.CustomEntityService.FindCustomEntitiesBySearchConditions(
                    conditions, null, ref bookmark, out status);

                if (ents != null)
                {
                    foreach (CustEnt ent in ents)
                    {
                        VDF.Vault.Currency.Entities.CustomObject vdfEnt = new VDF.Vault.Currency.Entities.CustomObject(m_conn, ent);
                        retVal.Add(vdfEnt);
                    }
                }
            }

            return(retVal);
        }
 public Dictionary <string, string> getCUSTENTPropertyVal(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, CustEnt custEnt)
 {
     try
     {
         using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage
         {
             var propDefs = connection.PropertyManager.GetPropertyDefinitions(entityClassIDs, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll);
             VDF.Vault.Currency.Entities.CustomObject custObj = new VDF.Vault.Currency.Entities.CustomObject(connection, custEnt);
             foreach (var key in propDefs.Keys)
             {
                 object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null);
                 custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString());
             }
         }
     }
     catch (SystemException ex)
     {
         result = ex.ToString();
     }
     return(custPropDict);
 }
Beispiel #3
0
        void cmd_Execute(object sender, CommandItemEventArgs e)
        {
            Util.DoAction(delegate
            {
                Connection conn = e.Context.Application.Connection;

                // lookup the server product to see if we are Vault Professional
                // remember the value so we don't have to look it up again in this session
                if (m_isVaultPro == null)
                {
                    Product[] products = conn.WebServiceManager.InformationService.GetSystemProducts();
                    m_isVaultPro       = products.Any(n => n.ProductName == "Autodesk.Productstream");
                }

                FinderDialog dialog = new FinderDialog(m_isVaultPro.Value, conn);
                DialogResult result = dialog.ShowDialog();

                if (result == DialogResult.OK && dialog.GoToLocation)
                {
                    LocationContext location = null;

                    if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.ChangeOrders)
                    {
                        VDF.Vault.Currency.Entities.ChangeOrder co = dialog.GoToEntity as VDF.Vault.Currency.Entities.ChangeOrder;
                        if (co != null)
                        {
                            location = new LocationContext(SelectionTypeId.ChangeOrder, co.Number);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.CustomObject)
                    {
                        VDF.Vault.Currency.Entities.CustomObject custom = dialog.GoToEntity as VDF.Vault.Currency.Entities.CustomObject;
                        if (custom != null)
                        {
                            CustEnt custEnt = custom;
                            SelectionTypeId selectionType = new SelectionTypeId(custom.Definition.SystemName);
                            location = new LocationContext(selectionType, custEnt.Num);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Files)
                    {
                        VDF.Vault.Currency.Entities.FileIteration file = dialog.GoToEntity as VDF.Vault.Currency.Entities.FileIteration;
                        if (file != null)
                        {
                            location = new LocationContext(SelectionTypeId.File, file.Parent.FullName + "/" + file.EntityName);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Folder)
                    {
                        VDF.Vault.Currency.Entities.Folder folder = dialog.GoToEntity as VDF.Vault.Currency.Entities.Folder;
                        if (folder != null)
                        {
                            location = new LocationContext(SelectionTypeId.Folder, folder.FullName);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Items)
                    {
                        VDF.Vault.Currency.Entities.ItemRevision item = dialog.GoToEntity as VDF.Vault.Currency.Entities.ItemRevision;
                        if (item != null)
                        {
                            location = new LocationContext(SelectionTypeId.Item, item.ItemNumber);
                        }
                    }

                    if (location != null)
                    {
                        e.Context.GoToLocation = location;
                    }
                }
            });
        }
        public DataTable getCENTCollPropertyValinDataTable(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, CustEnt[] custEntscoll, List <string> properties, DataTable dTable)
        {
            try
            {
                using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage
                {
                    var propDefs = connection.PropertyManager.GetPropertyDefinitions(entityClassIDs, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll);
                    //set datatable columns
                    Debug.Write(properties.Count);
                    if (properties.Count == 0)
                    {
                        allProps = true;
                    }
                    else
                    {
                        allProps = false;
                    }

                    dTable = setProptoCol(propDefs, properties);

                    foreach (CustEnt custEnt in custEntscoll)
                    {
                        VDF.Vault.Currency.Entities.CustomObject custObj = new VDF.Vault.Currency.Entities.CustomObject(connection, custEnt);
                        row = dTable.NewRow();
                        foreach (var key in propDefs.Keys)
                        {
                            if (allProps)
                            {
                                object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null);

                                //custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString());
                                if (propValue != null)
                                {
                                    Debug.Write("\n" + key + " | " + propValue.ToString() + "\n");
                                    row[propDefs[key].DisplayName.ToString()] = propValue.ToString();
                                }
                            }
                            else
                            {
                                if (properties.Contains(propDefs[key].DisplayName.ToString()))
                                {
                                    object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null);

                                    //custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString());
                                    if (propValue != null)
                                    {
                                        Debug.Write("\n" + key + " | " + propValue.ToString() + "\n");
                                        row[propDefs[key].DisplayName.ToString()] = propValue.ToString();
                                    }
                                }
                            }
                        }
                        dTable.Rows.Add(row);
                    }
                }
            }
            catch (SystemException ex)
            {
                Debug.Write(ex.ToString());
            }
            return(dTable);
        }