public static SReportTemplateTable SaveTemplates(SReportTemplateTable editedTemplates)
        {
            TDBTransaction       Transaction      = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted);
            SReportTemplateTable ChangedTemplates = editedTemplates.GetChangesTyped();

            SReportTemplateAccess.SubmitChanges(ChangedTemplates, Transaction);
            DBAccess.GDBAccessObj.CommitTransaction();

            foreach (SReportTemplateRow Row in ChangedTemplates.Rows)
            {
                SaveTemplatesToBackupFile(Row);
            }

            return(ChangedTemplates);
        }
Exemple #2
0
        public static SReportTemplateTable SaveTemplates(SReportTemplateTable editedTemplates)
        {
            TDBTransaction       Transaction      = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted);
            SReportTemplateTable ChangedTemplates = editedTemplates.GetChangesTyped();

            if ((ChangedTemplates != null) && (ChangedTemplates.Rows.Count > 0))
            {
                SReportTemplateAccess.SubmitChanges(ChangedTemplates, Transaction);
                DBAccess.GDBAccessObj.CommitTransaction();

                foreach (SReportTemplateRow Row in ChangedTemplates.Rows)
                {
                    if (Row.RowState == DataRowState.Deleted)
                    {
                        // The template was deleted - I'll attempt to delete the backup.
                        Int32  templateId            = Convert.ToInt32(Row["s_template_id_i", DataRowVersion.Original]);
                        String reportType            = Row["s_report_type_c", DataRowVersion.Original].ToString();
                        String deletedBackupFilename = TemplateBackupFilename(reportType, templateId.ToString("D2"));

                        try
                        {
                            File.Delete(deletedBackupFilename);
                        }
                        catch (Exception) // I'm not interested in knowing why this didn't work.
                        {
                        }
                    }
                    else
                    {
                        SaveTemplateToBackupFile(Row);
                    }
                }
            }
            else
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }

            return(ChangedTemplates);
        }
Exemple #3
0
        public static SReportTemplateTable SaveTemplates(SReportTemplateTable editedTemplates)
        {
            TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted);
            SReportTemplateTable ChangedTemplates = editedTemplates.GetChangesTyped();

            SReportTemplateAccess.SubmitChanges(ChangedTemplates, Transaction);
            DBAccess.GDBAccessObj.CommitTransaction();

            foreach (SReportTemplateRow Row in ChangedTemplates.Rows)
            {
                SaveTemplatesToBackupFile(Row);
            }

            return ChangedTemplates;
        }