示例#1
0
        public static SReportTemplateTable GetTemplateVariants(String AReportType, String AAuthor, Boolean ADefaultOnly = false)
        {
            LoadTemplatesFromBackupFile(AReportType);
            SReportTemplateTable Tbl         = new SReportTemplateTable();
            SReportTemplateRow   TemplateRow = Tbl.NewRowTyped(false);

            TemplateRow.ReportType = AReportType;
            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                                                                      TEnforceIsolationLevel.eilMinimum,
                                                                      ref Transaction,
                                                                      delegate
            {
                Tbl = SReportTemplateAccess.LoadUsingTemplate(TemplateRow, Transaction);
            });

            String filter = String.Format("(s_author_c ='{0}' OR s_private_l=false)", AAuthor);

            if (ADefaultOnly)
            {
                filter += " AND (s_default_l=true OR s_private_default_l=true)";
            }

            Tbl.DefaultView.RowFilter = filter;
            Tbl.DefaultView.Sort      =
                (ADefaultOnly) ? "s_private_default_l DESC, s_default_l DESC" : "s_readonly_l DESC, s_default_l DESC, s_private_default_l DESC";

            SReportTemplateTable Ret = new SReportTemplateTable();

            Ret.Merge(Tbl.DefaultView.ToTable());
            Ret.AcceptChanges();
            return(Ret);
        }
示例#2
0
        private bool SaveChanges()
        {
            if (DataChangedFlag)
            {
                FTemplateTable.Merge(TRemote.MReporting.WebConnectors.SaveTemplates(FTemplateTable));
                DataChangedFlag = false;
            }

            return(true);
        }
示例#3
0
        public static SReportTemplateTable GetTemplateVariants(String AReportType, String AAuthor, Boolean ADefaultOnly = false)
        {
            SReportTemplateTable Tbl          = new SReportTemplateTable();
            SReportTemplateTable Ret          = new SReportTemplateTable();
            TDBTransaction       Transaction  = null;
            TDataBase            dbConnection = new TDataBase();

            try
            {
                dbConnection = TReportingDbAdapter.EstablishDBConnection(true, "GetTemplateVariants");
                LoadTemplatesFromBackupFile(AReportType, dbConnection);

                dbConnection.BeginAutoReadTransaction(
                    ref Transaction,
                    delegate
                {
                    SReportTemplateRow TemplateRow = Tbl.NewRowTyped(false);
                    TemplateRow.ReportType         = AReportType;

                    Tbl = SReportTemplateAccess.LoadUsingTemplate(TemplateRow, Transaction);
                });

                String filter = String.Format("(s_author_c ='{0}' OR s_private_l=false)", AAuthor);

                if (ADefaultOnly)
                {
                    filter += " AND (s_default_l=true OR s_private_default_l=true)";
                }

                Tbl.DefaultView.RowFilter = filter;

                if (Tbl.DefaultView.Count > 0)
                {
                    Tbl.DefaultView.Sort =
                        (ADefaultOnly) ? "s_private_default_l DESC, s_default_l DESC" :
                        "s_readonly_l DESC, s_default_l DESC, s_private_default_l DESC";
                }
                else // Something went wrong, but I'll try not to return empty-handed.
                {
                    Tbl.DefaultView.RowFilter = "";
                }

                Ret.Merge(Tbl.DefaultView.ToTable());
                Ret.AcceptChanges();
            }
            finally
            {
                dbConnection.CloseDBConnection();
            }
            return(Ret);
        }
示例#4
0
        private bool SaveChanges()
        {
            if (DataChangedFlag)
            {
                SReportTemplateTable Tbl = TRemote.MReporting.WebConnectors.SaveTemplates(FTemplateTable);

                if (Tbl != null)
                {
                    FTemplateTable.Merge(Tbl);
                }

                DataChangedFlag = false;
            }

            return(true);
        }
示例#5
0
        public static SReportTemplateTable GetTemplateVariants(String AReportType, String AAuthor, Boolean ADefaultOnly = false)
        {
            LoadTemplatesFromBackupFile(AReportType);
            SReportTemplateTable Tbl = new SReportTemplateTable();
            SReportTemplateRow TemplateRow = Tbl.NewRowTyped(false);
            TemplateRow.ReportType = AReportType;
            TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted);
            Tbl = SReportTemplateAccess.LoadUsingTemplate(TemplateRow, Transaction);
            DBAccess.GDBAccessObj.RollbackTransaction();

            String filter = String.Format("(s_author_c ='{0}' OR s_private_l=false)", AAuthor);

            if (ADefaultOnly)
            {
                filter += " AND (s_default_l=true OR s_private_default_l=true)";
            }

            Tbl.DefaultView.RowFilter = filter;
            Tbl.DefaultView.Sort =
                (ADefaultOnly) ? "s_private_default_l DESC, s_default_l DESC" : "s_readonly_l DESC, s_default_l DESC, s_private_default_l DESC";

            SReportTemplateTable Ret = new SReportTemplateTable();
            Ret.Merge(Tbl.DefaultView.ToTable());
            Ret.AcceptChanges();
            return Ret;
        }