コード例 #1
0
        public void HandleConsoleCommand(string consoleId, string commandPayload)
        {
            var serializedEntityToken = commandPayload.Replace("%5C", "\\");

            var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);

            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);
        }
コード例 #2
0
        public void HandleConsoleCommand(string consoleId, string commandPayload)
        {
            string url = commandPayload;

            var entityToken = UrlToEntityTokenFacade.TryGetEntityToken(url);

            if (entityToken == null)
            {
                PageUrlData pageUrlData = PageUrls.ParseUrl(url);

                var page = pageUrlData?.GetPage();
                if (page == null)
                {
                    return;
                }

                entityToken = page.GetDataEntityToken();
            }

            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);
        }
コード例 #3
0
ファイル: FocusData.cs プロジェクト: wwl2013/C1-CMS
        public void HandleConsoleCommand(string consoleId, string commandPayload)
        {
            string[] parts = commandPayload.Split(':');
            if (parts.Length < 2)
            {
                return;
            }

            string typeName  = parts[0];
            string keyString = string.Join(":", parts.Skip(1));

            var supportedInterfaces = DataFacade.GetAllInterfaces();

            var type = supportedInterfaces.FirstOrDefault(t => t.Name == typeName || t.FullName == typeName);

            if (type == null)
            {
                return;
            }

            var keyProperty = type.GetKeyProperties().Single();

            object key = ValueTypeConverter.Convert(keyString, keyProperty.PropertyType);

            IData data;

            using (new DataConnection())
            {
                data = DataFacade.TryGetDataByUniqueKey(type, key);
                if (data == null)
                {
                    return;
                }
            }

            var entityToken = data.GetDataEntityToken();

            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);
        }