public static void GetPortalTicketsSQL(LoginUser loginUser, SqlCommand command, TabularReport tabularReport, bool inlcudeHiddenFields, bool isSchemaOnly)
        {
            StringBuilder    builder          = new StringBuilder();
            TabularReportSql tabularReportSql = new TabularReportSql(loginUser);

            tabularReportSql.GetTabluarSelectClause(command, builder, tabularReport, inlcudeHiddenFields, isSchemaOnly);
            if (isSchemaOnly)
            {
                command.CommandText = builder.ToString();
            }
            else
            {
                string primaryTableKeyFieldName = null;
                if (tabularReport.Subcategory == 70)
                {
                    primaryTableKeyFieldName = "UserTicketsView.TicketID";
                }
                else if (tabularReport.Subcategory == 74)
                {
                    primaryTableKeyFieldName = "TicketsView.TicketID";
                }


                Report.GetWhereClause(loginUser, command, builder, tabularReport.Filters, primaryTableKeyFieldName);

                command.CommandText = builder.ToString();
            }
        }
        public static void GetTabularSqlForExports(LoginUser loginUser, SqlCommand command, TabularReport tabularReport, bool inlcudeHiddenFields, bool isSchemaOnly, int?reportID, bool useUserFilter, string sortField = null, string sortDir = null)
        {
            StringBuilder    builder          = new StringBuilder();
            TabularReportSql tabularReportSql = new TabularReportSql(loginUser);

            tabularReportSql.GetTabluarSelectClause(command, builder, tabularReport, inlcudeHiddenFields, isSchemaOnly, sortField, sortDir);
            if (isSchemaOnly)
            {
                command.CommandText = builder.ToString();
            }
            else
            {
                string primaryTableKeyFieldName = null;
                if (tabularReport.Subcategory == 70)
                {
                    primaryTableKeyFieldName = "UserTicketsView.TicketID";
                }

                GetWhereClauseForExport(loginUser, command, builder, tabularReport.Filters, primaryTableKeyFieldName);
                if (useUserFilter && reportID != null)
                {
                    Report report = Reports.GetReport(loginUser, (int)reportID, loginUser.UserID);
                    if (report != null && report.Row["Settings"] != DBNull.Value)
                    {
                        try
                        {
                            UserTabularSettings userFilters = JsonConvert.DeserializeObject <UserTabularSettings>((string)report.Row["Settings"]);

                            if (userFilters != null)
                            {
                                GetWhereClauseForExport(loginUser, command, builder, userFilters.Filters);
                            }
                        }
                        catch (Exception ex)
                        {
                            ExceptionLogs.LogException(loginUser, ex, "Tabular SQL - User filters");
                        }
                    }
                }

                command.CommandText = builder.ToString();
            }
        }
示例#3
0
 public ReportTablePage(LoginUser loginUser, Report report)
 {
     _loginUser        = loginUser;
     _report           = report;
     _tabularReportSql = new TabularReportSql(report.Collection.LoginUser);;
 }