private void DeleteSmartObject(string smoName)
        {
            try
            {
                ManagementServerConnect();
                SmartObjectExplorer checkSmartObjectExist = _smoManagementServer.GetSmartObjects(smoName);

                if (checkSmartObjectExist.SmartObjects.Count > 0)
                {
                    _smoManagementServer.DeleteSmartObject(smoName, true);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
                ManagementServerCloseConnection();
            }
        }
示例#2
0
        public static List <SmartObject> SmartObjectExplorer()
        {
            List <SmartObject> list = new List <SmartObject>();

            SmartObjectManagementServer smomgt = new SmartObjectManagementServer();

            smomgt.CreateConnection();
            try
            {
                smomgt.Connection.Open(ConnectToK2());

                SourceCode.SmartObjects.Management.SmartObjectExplorer smartobjects = smomgt.GetSmartObjects();

                foreach (SourceCode.SmartObjects.Management.SmartObjectInfo info in smartobjects.SmartObjectList)
                {
                    list.Add(SmartObjectBuilder(info));
                }
            }
            catch (Exception ex)
            {
                list.Add(new SmartObject
                {
                    Description  = ex.Message,
                    Name         = ex.Source,
                    ArtefactType = "SmartObject Error"
                });
            }
            finally
            {
                smomgt.Connection.Close();
            }
            return(list);
        }
 internal virtual SmartObjectExplorer GetSmartObjects(SearchProperty searchProperty, SearchOperator searchOperator, string value)
 {
     return(_smartObjectManagementServer.GetSmartObjects(searchProperty, searchOperator, value));
 }