private SmartObjectDefinition CreateAssociation(string smoName, string associationName, SourceCode.SmartObjects.Authoring.AssociationType associationType)
        {
            try
            {
                toolStripStatusLabel1.Text = ("Creating association between '" + smoName + "' and '" + associationName + "'");
                statusStrip1.Update();
                ManagementServerConnect();

                string smartObjectXml = _smoManagementServer.GetSmartObjectDefinition(smoName);
                SmartObjectDefinition smoDefinition = SmartObjectDefinition.Create(smartObjectXml);

                string associationXml = _smoManagementServer.GetAssociationSmartObject(associationName);
                AssociationSmartObject associationDefinition = AssociationSmartObject.Create(associationXml);

                smoDefinition.AddAssociation(associationDefinition, associationDefinition.Properties[1], smoDefinition.Properties[1], associationType, "test association");
                smoDefinition.AddDeploymentCategory("Test SmartObjects");

                smoDefinition.Build();

                return(smoDefinition);
            }

            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                ManagementServerCloseConnection();
            }
        }
Ejemplo n.º 2
0
        public static List <SmartObjectProperty> SmartObjectMethodsExplorer(Guid SmartObjectGUID)
        {
            List <SmartObjectProperty> list = new List <SmartObjectProperty>();

            SmartObjectManagementServer smomgt = new SmartObjectManagementServer();

            smomgt.CreateConnection();
            try
            {
                smomgt.Connection.Open(ConnectToK2());
                Properties prop = new Properties();

                list = prop.GetSmartObjectMethods(smomgt.GetSmartObjectInfo(smomgt.GetSmartObjectDefinition(SmartObjectGUID).ToString()).Methods);
            }
            catch (Exception ex)
            {
                list.Add(new SmartObjectProperty
                {
                    Description = ex.Message,
                    Name        = ex.Source,
                    displayname = "SmartObject Property Error"
                });
            }
            finally
            {
                smomgt.Connection.Close();
            }
            return(list);
        }
 internal virtual string GetSmartObjectDefinition(string systemName)
 {
     return(_smartObjectManagementServer.GetSmartObjectDefinition(systemName));
 }