Exemplo n.º 1
0
 public IEnumerable <Lite <ExcelReportEntity> > GetExcelReports(string queryKey)
 {
     return(ExcelLogic.GetExcelReports(QueryLogic.ToQueryName(queryKey)));
 }
Exemplo n.º 2
0
        static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx)
        {
            if (ctx.Prefix.HasText())
            {
                return(null);
            }

            if (ExcelReport && DynamicQueryManager.Current.QueryAllowed(typeof(ExcelReportEntity), false))

            {
                var items = new List <IMenuItem>();

                if (ToExcelPlain)
                {
                    items.Add(PlainExcel(ctx).ToMenuItem());
                }

                List <Lite <ExcelReportEntity> > reports = ExcelLogic.GetExcelReports(ctx.QueryName);

                if (reports.Count > 0)
                {
                    if (items.Count > 0)
                    {
                        items.Add(new MenuItemSeparator());
                    }

                    foreach (Lite <ExcelReportEntity> report in reports)
                    {
                        items.Add(new MenuItem(ctx.Prefix, "sfExcelReport" + report.Id)
                        {
                            Title   = report.ToString(),
                            Text    = report.ToString(),
                            OnClick = Module["toExcelReport"](ctx.Prefix, ctx.Url.Action("ExcelReport", "Excel"), report.Key()),
                        });
                    }
                }

                items.Add(new MenuItemSeparator());

                var current = QueryLogic.GetQueryEntity(ctx.QueryName).ToLite().Key();

                items.Add(new MenuItem(ctx.Prefix, "qbReportAdminister")
                {
                    Title   = ExcelMessage.Administer.NiceToString(),
                    Text    = ExcelMessage.Administer.NiceToString(),
                    OnClick = Module["administerExcelReports"](ctx.Prefix, Finder.ResolveWebQueryName(typeof(ExcelReportEntity)), current),
                });

                items.Add(new MenuItem(ctx.Prefix, "qbReportCreate")
                {
                    Title   = ExcelMessage.CreateNew.NiceToString(),
                    Text    = ExcelMessage.CreateNew.NiceToString(),
                    OnClick = Module["createExcelReports"](ctx.Prefix, ctx.Url.Action("Create", "Excel"), current),
                });

                return(new ToolBarButton[]
                {
                    new ToolBarDropDown(ctx.Prefix, "tmExcel")
                    {
                        Title = "Excel",
                        Text = "Excel",
                        Items = items
                    }
                });
            }
            else
            {
                if (ToExcelPlain)
                {
                    return new ToolBarButton[] { PlainExcel(ctx) }
                }
                ;
            }

            return(null);
        }