Пример #1
0
        public ActionResult Execute(Panasia.Core.App.Action action)
        {
            action.Execute(this);
            var actionResult = this.Results.LastOrDefault();

            if (actionResult.IsError)
            {
                throw new Exception(actionResult.ErrorMessage);
            }
            if (actionResult is IActionCommandResult)
            {
                return((actionResult as IActionCommandResult).GetResult());
            }
            else
            {
                var getResult = actionResult.GetType().GetMethod("GetResult");
                if (getResult != null)
                {
                    var result = getResult.Invoke(actionResult, null);
                    this.Log("GetResult", Category.Debug);
                    return(result as ActionResult);
                }

                throw new Exception("Web请求结果必须是IActionCommandResult" + actionResult.GetType().ToString());
            }
        }
Пример #2
0
        private static SqlReportItem CreateSqlReportItem(string dataUrl, PageGroup group, Page page, Panasia.Core.App.Action action,
                                                         CommandConfig command)
        {
            if (!string.IsNullOrEmpty(dataUrl))
            {
                if (dataUrl.StartsWith("/Share/Query", StringComparison.OrdinalIgnoreCase))
                {
                    var name = dataUrl.Substring(13).Split('&').FirstOrDefault(p => p.StartsWith("name=", StringComparison.OrdinalIgnoreCase));
                    if (name != null)
                    {
                        var shareSqlName = name.Substring(5);
                        var sqlItem      = SqlData.Current.GetShare(shareSqlName);

                        var item = new SqlReportItem
                        {
                            ModuleName  = group.Name,
                            PageID      = page.PageID,
                            PageName    = page.Title,
                            ActionName  = action.Name,
                            ActionTitle = action.Title,
                            CommandName = command.Name
                        };

                        if (sqlItem != null)
                        {
                            item.SqlName        = string.Format("{0}[{1}]", sqlItem.Name, shareSqlName);
                            item.SqlDescription = sqlItem.Description;
                            item.SqlType        = sqlItem.SqlType.ToString();

                            if (sqlItem.Group != null)
                            {
                                item.SqlTableName = sqlItem.Group.Name;
                                if (sqlItem.Group.Group != null)
                                {
                                    item.SqlGroupName = sqlItem.Group.Group.Name;
                                }
                            }
                        }
                        else
                        {
                            item.SqlName        = shareSqlName;
                            item.SqlDescription = "命令不存在";
                        }
                        item.SqlItem = sqlItem;
                        return(item);
                    }
                }
            }
            return(null);
        }