コード例 #1
0
        /// <summary>
        /// Reads the dataset from the offline file using the binary format option
        /// </summary>
        /// <returns>A DataSet</returns>
        private void LoadBinary()
        {
            FileStream clsStream      = null;
            IFormatter clsFormat      = new BinaryFormatter();
            String     strOfflineFile = OfflineFile;

            try
            {
                if (File.Exists(strOfflineFile))
                {
                    clsStream = new FileStream(strOfflineFile, FileMode.Open, FileAccess.Read, FileShare.Read);
                    _dataSet  = (DataSet)clsFormat.Deserialize(clsStream);
                }
                else
                {
                    // Nothing to do
                }
            }
            catch (SerializationException se)
            {
                ApplicationLog.WriteError("Failed to Read Offline file.  ", se);
                throw;
            }
            finally
            {
                if (clsStream != null)
                {
                    clsStream.Close();
                }
            }
        }
コード例 #2
0
 public void On_DisclosureDialogShown(object oSender, EventArgs oEvt)
 {
     try
     {
         // WNW - De-reference to our target control.
         var     oLoanOfficer = "Loan Officer";
         var     wsOpsManager = "Wholesale Ops Manager";
         var     msDate       = Loan.Fields["Log.MS.Date.Disclosures Sent TPO"].Value;
         Persona oMLO         = EncompassApplication.Session.Users.Personas.GetPersonaByName(oLoanOfficer);
         Persona oWOM         = EncompassApplication.Session.Users.Personas.GetPersonaByName(wsOpsManager);
         if (EncompassApplication.CurrentUser.Personas.Contains(oMLO))
         {
             var oBorrowerPairsCBO = (WINFORM.ComboBox)(m_ActiveForm.Controls[3]).Controls[1];
             oBorrowerPairsCBO_Focused();
             oBorrowerPairsCBO.SelectedIndex         = 0;
             oBorrowerPairsCBO.SelectedIndexChanged += OBorrowerPairsCBO_SelectedIndexChanged;
             oBorrowerPairsCBO.SelectedIndex         = 0;
         }
         if (EncompassApplication.CurrentUser.Personas.Contains(oWOM) & msDate != null)
         {
             var oBorrowerPairsCBO = (WINFORM.ComboBox)(m_ActiveForm.Controls[3]).Controls[1];
             oBorrowerPairsWSCBO_Focused();
             oBorrowerPairsCBO.SelectedIndex         = 0;
             oBorrowerPairsCBO.SelectedIndexChanged += OBorrowerPairsWSCBO_SelectedIndexChanged;
             oBorrowerPairsCBO.SelectedIndex         = 0;
         }
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"Error in On: {oEx.Message}");
     }
 }
コード例 #3
0
        public void On_LoanOpened(object oSender, EventArgs oEvt)
        {
            try
            {
                var oDisclosureTrackingType = EMLog.DisclosureTracking2015Log.DisclosureTrackingType.LE;

                var oBPs = EncompassApplication.CurrentLoan.Log.Disclosures2015.borrowerPairIDsDistribution(oDisclosureTrackingType);

                try
                {
                    foreach (string oUserType in new[] { "LP", "CL", "UW" })
                    {
                        var oUser = EncompassApplication.Session.Users.GetUser($"{oUserType}ID");

                        IdentifyOutsourceUsers(oUser, oUserType);
                    }
                }
                catch (NullReferenceException oEx)
                {
                    ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"USER TYPE NOT DEFINED: {oEx.Message}");
                }
            }
            catch (Exception oEx)
            {
                ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_LoanOpened Error {oEx.Message}");
            }
            finally
            {
                EncompassApplication.CurrentLoan.FieldChange  += this.On_FieldChanged;
                EncompassApplication.CurrentLoan.BeforeCommit += this.On_LoanPreSave;
                EncompassApplication.CurrentLoan.Committed    += this.On_LoanPostSave;
            }
        }
コード例 #4
0
ファイル: PageBase.cs プロジェクト: JaganPaineedi/SvnGit
 /// <summary>
 ///     Handles errors that may be encountered when displaying this page.
 ///     <param name="e">An EventArgs that contains the event data.</param>
 /// </summary>
 protected override void OnError(EventArgs e)
 {
     ApplicationLog.WriteError(ApplicationLog.FormatException(Server.GetLastError(), UNHANDLED_EXCEPTION));
     Session["error"] = Server.GetLastError().Message;
     ErrorPage        = fPopup ? "PopupError.aspx" : "Error.aspx";
     base.OnError(e);
 }
コード例 #5
0
        private static void LoadPlugins()
        {
            string strPluginPath = DatabaseConfiguration.DatabaseSettings.PluginLocation;
            string strConfigPath = Path.GetDirectoryName(ApplicationConfiguration.AppConfig.FilePath);

            string[] plugins      = new string[] { };
            Assembly thisAssembly = Assembly.GetCallingAssembly();

            // Add default plugins from our Framework assembly
            LoadedPlugin sql   = new LoadedPlugin(thisAssembly.Location, typeof(SqlProviderPlugin));
            LoadedPlugin odbc  = new LoadedPlugin(thisAssembly.Location, typeof(OdbcProviderPlugin));
            LoadedPlugin oledb = new LoadedPlugin(thisAssembly.Location, typeof(OleDbProviderPlugin));

            _plugins.Add(sql.ProviderPlugin.ProviderType, sql);
            _plugins.Add(odbc.ProviderPlugin.ProviderType, odbc);
            _plugins.Add(oledb.ProviderPlugin.ProviderType, oledb);

            // If the configuration file did not specify a plugin location use the default from the registry
            if (string.IsNullOrEmpty(strPluginPath))
            {
                strPluginPath = DefaultPluginLocation;
            }

            // If the plugins do not exist where the config file was loaded, check the location of the executable
            if (Directory.Exists(Path.Combine(strConfigPath, strPluginPath)) == true)
            {
                strPluginPath = Path.Combine(strConfigPath, strPluginPath);
            }
            else
            {
                strPluginPath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), strPluginPath);
            }

            try
            {
                plugins = Directory.GetFiles(strPluginPath, "*.dll");
            }
            catch { }
            foreach (string plugin in plugins)
            {
                try
                {
                    foreach (LoadedPlugin p in LoadPlugins(Assembly.LoadFile(plugin)))
                    {
                        _plugins.Add(p.ProviderPlugin.ProviderType, p);
                    }
                }
                catch (Exception exception)
                {
                    Exception meaningfulException = exception;

                    while (null != meaningfulException.InnerException)
                    {
                        meaningfulException = meaningfulException.InnerException;
                    }
                    ApplicationLog.WriteError(string.Format("Unable to load plugin {0}", plugin), meaningfulException ?? exception);
                }
            }
        }
コード例 #6
0
 public void On_FieldChanged(object oSender, FieldChangeEventArgs oEvt)
 {
     try
     {
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_FieldChanged Error {oEx.Message}");
     }
 }
コード例 #7
0
 public override void CreateControls()
 {
     try
     {
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"Error on CreateControls: {oEx.Message}");
     }
 }
コード例 #8
0
 public void On_LoanPostSave(object oSender, PersistentObjectEventArgs oEvt)
 {
     try
     {
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_LoanPostSave Error {oEx.Message}");
     }
 }
コード例 #9
0
ファイル: emailPDF.aspx.cs プロジェクト: norio-soft/proteo
        private bool SendPDF()
        {
            bool success = false;

            try
            {
                // Retrieve the PDF to send via email.
                string     url     = _pdfLocation;
                WebRequest request = WebRequest.Create(url);
                request.Credentials = CredentialCache.DefaultCredentials;
                ((HttpWebRequest)request).UserAgent = "Orchestrator";
                WebResponse response = request.GetResponse();

                if (((HttpWebResponse)response).StatusCode == HttpStatusCode.OK)
                {
                    // PDF has been received so we need to create the email and send it on it's way.
                    // Send the pdf document to the email address supplied.
                    MailMessage mailMessage = new MailMessage();

                    mailMessage.From = new MailAddress(Orchestrator.Globals.Configuration.MailFromAddress,
                                                       Orchestrator.Globals.Configuration.MailFromName);

                    mailMessage.To.Add(txtEmailAddress.Text);
                    mailMessage.Subject    = "Requested " + _formTypeId.ToString();
                    mailMessage.IsBodyHtml = false;
                    mailMessage.Body       = GenerateBodyText(url);

                    // Close the request object.
                    response.Close();

                    try
                    {
                        SmtpClient smtp = new System.Net.Mail.SmtpClient();
                        smtp.Host        = Globals.Configuration.MailServer;
                        smtp.Credentials = new NetworkCredential(Globals.Configuration.MailUsername,
                                                                 Globals.Configuration.MailPassword);

                        smtp.Send(mailMessage);
                        success = true;
                        mailMessage.Dispose();
                    }
                    catch (Exception eX)
                    {
                        ApplicationLog.WriteError("SendPDF", eX.Message);
                    }
                }
            }
            catch (Exception eX)
            {
                ApplicationLog.WriteError("SendPDF", eX.Message);
            }

            return(success);
        }
コード例 #10
0
 public void On_LoanPreSave(object oSender, CancelableEventArgs oEvt)
 {
     try
     {
         var oBorrowerPairDis = EncompassApplication.CurrentLoan.Log.Disclosures2015;
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_LoanPreSave Error {oEx.Message}");
     }
 }
コード例 #11
0
        public void Mondo_Common_ApplicationLog_WriteError()
        {
            List <string>  errors = new List <string>();
            ApplicationLog log    = new ApplicationLog();

            log.Register(new TestLog(errors));

            log.WriteError(new Exception("Bob's hair is on fire"));

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Bob's hair is on fire", errors[0]);
        }
コード例 #12
0
 static PluginManager()
 {
     try
     {
         LoadPlugins();
     }
     catch (Exception exception)
     {
         ApplicationLog.WriteError("Failed to load Control.Database plugins.", exception, component: "Control.Database");
         // There is a chance that the loaded assembly doesn't have all of the references that it needs
         // In this case we want to add the default types..
     }
 }
コード例 #13
0
 public ConnectionType(string providerType, string connectionString)
 {
     SetProviderType(providerType);
     try
     {
         _connectionStringBuilder.ConnectionString = connectionString;
     }
     catch (Exception ex)
     {
         // This could be an invalid connection string for the provider
         ApplicationLog.WriteError("Unable to set the connection string.", ex);
     }
 }
コード例 #14
0
        public override async void Execute()
        {
            try
            {
                DateRange range         = TagsExporter.GetDateRange();
                var       tagActivities = await GetTagActivitiesAsync(range.From, range.To).ConfigureAwait(false);

                TagsExporter.ExportTags(tagActivities, range);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError(ex);
            }
        }
 public override void Execute()
 {
     try
     {
         DateRange range         = TagsExporter.GetDateRange();
         var       tagActivities = GetTagActivities(range.From, range.To);
         TagsExporter.ExportTags(tagActivities, range);
     }
     catch (Exception ex)
     {
         ApplicationLog.WriteError(ex);
         return;
     }
 }
コード例 #16
0
 public void On_Logout(object oSender, EventArgs oEvt)
 {
     try
     {
     }
     catch (Exception oEx)
     {
         ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_Logout Error {oEx.Message}");
     }
     finally
     {
         EncompassApplication.LoanOpened  -= this.On_LoanOpened;
         EncompassApplication.LoanClosing -= this.On_LoanClosing;
     }
 }
コード例 #17
0
        public static void HandleError(Exception Ex, string Name, object data = null)
        {
            try
            {
                if (string.IsNullOrEmpty(Name))
                {
                    return;
                }

                ApplicationLog.WriteError(nameof(HotUpdatePlugin), $"{Name}{Environment.NewLine}{Ex.ToString()}");
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.ToString());
            }
        }
コード例 #18
0
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            string allReportFileNmaes = Request.QueryString[DDSetup.QueryReportName];
            string sessionUid         = Request.QueryString[DDSetup.ReportParameterUid];


            int?userid = DDSetup.GetUserIdFromSessionId(sessionUid);

            ApplicationLog.WriteError("IsReportCompressionActivate:" + DDSetup.ReorptSetup.IsReportCompressionActivate);

            if (!userid.HasValue)
            {
                Response.Write(" access denied ");
                return;
            }



            string PdmRequestRegisterID = Request.QueryString[DDSetup.QueryPdmRequestRegisterID];

            if (string.IsNullOrEmpty(PdmRequestRegisterID))
            {
                PdmRequestRegisterID = string.Empty;
            }


            string dataSourceType = Request.QueryString[DDSetup.QueryReportDataSourceType];

            string mainreferenceID   = Request.QueryString[DDSetup.QueryReportParameterMainReferenceID];
            string masterReferenceId = Request.QueryString[DDSetup.QueryReportParameterMasterReferenceID];


            string reportBatchNumber = Request.QueryString[DDSetup.QueryReportBatchNumber];

            if (string.IsNullOrEmpty(reportBatchNumber))
            {
                reportBatchNumber = string.Empty;
            }



            if (!this.IsPostBack)
            {
                PrintUserReaTimeReport(userid, allReportFileNmaes, PdmRequestRegisterID, dataSourceType, mainreferenceID, masterReferenceId, reportBatchNumber);
            }
        }
コード例 #19
0
        public static bool PdfCompression(string FileNameOrigin, string FileNameDestination)
        {
            string GhostScriptPath = DDSetup.ReorptSetup.GhostScriptPath;

            //   GhostScriptPath = @"C:\Program Files (x86)\gs\gs9.00\bin\gswin32.exe";

            //  string FileNameOrigin = path + "\\" + reportId + ".pdf";
            //   string FileNameDestination = path + "\\" + reportId + "_compressed.pdf";

            FileNameOrigin      = "\"" + FileNameOrigin + "\"";
            FileNameDestination = "\"" + FileNameDestination + "\"";

            try
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();

                process.StartInfo.FileName = "\"" + GhostScriptPath + "\"";
                //version slow but works without bleu screen on pictures ...
                process.StartInfo.Arguments       = GetPdfCompressionSetting(FileNameOrigin, FileNameDestination, DDSetup.ReorptSetup.PdfCompressionSetting);
                process.StartInfo.UseShellExecute = true;
                process.StartInfo.WindowStyle     = ProcessWindowStyle.Normal;
                process.StartInfo.CreateNoWindow  = false;

                process.Start();
                process.WaitForExit();

                return(true);
            }
            catch (Exception ex)
            {
                string error = "Filename Origin " + FileNameOrigin + " - File Destination : " + FileNameDestination + " -  GhostScriptPath : " + GhostScriptPath;
                // Logger.LogLocation = @"C:\temp\ErrorPRINTJOB.txt";
                //  Logger.LogException("Error in print job scanner.", ex, LogCategory.Critical);
                //  Logger.LogException("Error in print job scanner.", ex, LogCategory.Critical);

                ApplicationLog.WriteError("error:" + error);

                ApplicationLog.WriteError("FileName name: " + GhostScriptPath);


                ApplicationLog.WriteError("augument name: " + GetPdfCompressionSetting(FileNameOrigin, FileNameDestination, DDSetup.ReorptSetup.PdfCompressionSetting));



                return(false);
            }
        }
コード例 #20
0
        /// <summary>
        /// Reads the dataset from the offline file using the XML format option
        /// </summary>
        private void LoadXML()
        {
            String strFile = OfflineFile;

            try
            {
                // Read the offline file
                if (System.IO.File.Exists(strFile))
                {
                    _dataSet.ReadXml(strFile, XmlReadMode.Auto);
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError("Failed to Load XML file.  ", ex);
                throw;
            }
        }
コード例 #21
0
        public void On_LoanClosing(object oSender, EventArgs oEvt)
        {
            try
            {
                mInitializedTest = false;

                EncompassApplication.CurrentLoan.Fields["CUST95FV"].Value = "N";
            }
            catch (Exception oEx)
            {
                ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_LoanClosing Error {oEx.Message}");
            }
            finally
            {
                EncompassApplication.CurrentLoan.FieldChange  -= this.On_FieldChanged;
                EncompassApplication.CurrentLoan.BeforeCommit -= this.On_LoanPreSave;
                EncompassApplication.CurrentLoan.Committed    -= this.On_LoanPostSave;
            }
        }
コード例 #22
0
        private void On_FormOpened(object sender, FormOpenedEventArgs e)
        {
            try
            {
                oCurrentProcess   = "FormOpen";
                oProcessStartTime = DateTime.Now;

                // WNW - Restricts to Forms opened from LoanScreen
                if (EncompassApplication.CurrentLoan != null)
                {
                    if (e.OpenedForm?.IsDisposed == false)
                    {
                        m_ActiveForm = e.OpenedForm;
                        var contPanel = e.OpenedForm.Controls.Find("gradientPanel2", true);

                        switch (e.OpenedForm.Name.ToLower())
                        {
                        case "efolderdialog":
                            var oButtonsToDisable = new string[] { "btnDisclosures" };

                            foreach (var oButtonID in oButtonsToDisable)
                            {
                                if (e.OpenedForm.Controls?.Find(oButtonID, true).Length > 0)
                                {
                                    Button oButton = (Button)e.OpenedForm.Controls.Find(oButtonID, true)[0];
                                    oButton.Enabled = true;
                                }
                            }
                            break;

                        case "orderdisclosuredialog":
                            e.OpenedForm.Shown -= On_DisclosureDialogShown;
                            e.OpenedForm.Shown += On_DisclosureDialogShown;
                            break;
                        }
                    }
                }
            }
            catch (Exception oEx)
            {
                ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_FormOpened Error {oEx.Message}");
            }
        }
コード例 #23
0
        //function creates or update current timeline
        private bool CreateOrUpdateTimeline()
        {
            try
            {
                PluginTimeline timeline;

                if (!IsValid())
                {
                    return(false);
                }

                if (State.EditedTimeline == null)
                {
                    timeline = (PluginTimeline)_timelineFactory.Create(PluginLoader.TimelineTypeName, TimelineTypeNames.GenericGroup);
                    timeline.SourceTypeName = PluginLoader.SourceTypeName;
                }
                else
                {
                    timeline = (PluginTimeline)State.EditedTimeline;
                }

                timeline.SourceAddress  = "";
                timeline.DisplayName    = Title;
                timeline.UpdateInterval = TimeSpan.FromMinutes(10);

                if (State.EditedTimeline == null)
                {
                    State.AddTimeline(timeline);
                }
                else
                {
                    State.UpdateTimeline(timeline);
                }

                return(true);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError(ex);
                return(false);
            }
        }
コード例 #24
0
        public override async void Execute()
        {
            processing = true;

            try
            {
                var tagSourceInstance = TagPluginsHelper.GetTagSourceInstances(
                    _tagSourceService.GetTagSourceInstances(),
                    ClientPlugin.Id)
                                        .First();

                var azureDevOpsSettings = (AzureDevOpsWorkItemTagSettings)tagSourceInstance.Settings ?? new AzureDevOpsWorkItemTagSettings();

                int days = int.Parse(azureDevOpsSettings.Days);

                var exporter = new TagsExporter(
                    organizationName: azureDevOpsSettings.Organization,
                    timeTrackerToken: azureDevOpsSettings.TimeTrackerApiSecret,
                    billableActivityId: azureDevOpsSettings.BillableActivityId,
                    nonBillableActivityId: azureDevOpsSettings.NonBillableActivityId,
                    days: days);

                DateRange range = TagsExporter.GetDateRange(days);

                var tagActivities = await GetTagActivitiesAsync(range.From, range.To).ConfigureAwait(false);

                await exporter.Export(tagActivities, range);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError(ex);
            }

            processing = false;

            if (changesQueued)
            {
                changesQueued = false;
                Execute();
            }
        }
コード例 #25
0
        public void On_Login(object oSender, EventArgs oEvt)
        {
            try
            {
                if (oCodebaseConfig == null)
                {
                    oCodebaseConfig = CDOHelper.ReadCDO <DefaultCodebaseConfig>(CDOType.GlobalLevel, "CLS.DefaultCodebaseConfig");
                }
            }
            catch (Exception oEx)
            {
                Macro.Alert("Unable to read and initalize Default Codebase Configuration.");

                ApplicationLog.WriteError(MethodBase.GetCurrentMethod().DeclaringType.Name, $"On_Login Error {oEx.Message}");
            }
            finally
            {
                EncompassApplication.LoanOpened  += this.On_LoanOpened;
                EncompassApplication.LoanClosing += this.On_LoanClosing;
            }
        }
コード例 #26
0
        private void Constructor()
        {
            try
            {
                if (OfflineFormat.Xml == _streamFormat)
                {
                    _offlineFileExt = ".xml";
                }
                else
                {
                    _offlineFileExt = ".bin";
                }

                // Create an empty dataset
                _dataSet = ClearOfflineData();
            }
            catch (System.Exception ex)
            {
                ApplicationLog.WriteError("Initialize OfflineDataSet error", ex);
                throw;
            }
        }
コード例 #27
0
        public static Activity[] GetData(PluginTimeline timeline, Func <Group> createGroup,
                                         Func <Activity> createActivity, DateTime fromLocalTime, DateTime toLocalTime)
        {
            /*
             *  get activities from your source for time range fromLocalTime-toLocalTime
             *  then create Activity objects and return the collection.
             *
             *  Here we create only one activity spanning the whole day.
             */
            try
            {
                var groupOne = CreateGroup("1-group", "Group One", "ff0000", createGroup);

                return(new Activity[]
                {
                    CreateActivity("1-activity", fromLocalTime, toLocalTime, "Sample activity", groupOne, createActivity)
                });
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError(ex);
                throw;
            }
        }
コード例 #28
0
        /// <summary>
        /// Writes the data to the offline file in binary format.
        /// </summary>
        private void SaveBinary()
        {
            FileStream      clsStream = null;
            BinaryFormatter clsFormat = new BinaryFormatter();

            try
            {
                // Serialize object to a file
                clsStream = File.Create(OfflineFile);
                clsFormat.Serialize(clsStream, _dataSet);
            }
            catch (SerializationException se)
            {
                ApplicationLog.WriteError("Failed to Save Offline binary file. ", se);
                throw;
            }
            finally
            {
                if (clsStream != null)
                {
                    clsStream.Close();
                }
            }
        }
コード例 #29
0
//	Teckpack Print
//http://localhost/ReportPublishCrystal/ReportPdfPrint.aspx?ReportName=2^4489&uid=66e7fed1-1dfc-4003-89ad-f0831a0b4138&MainReferenceID=4489&ReportDataSourceType=PLMDatabase



        private void PrintUserReaTimeReport(int?aUId, string mutipleReportFiles, string PdmRequestRegisterID, string dataSourceType, string mainreferenceID, string masterReferenceId, string reportBatchNumber)
        {
            //allReportFileNmae=ReportName=Crystal_OSC_GetTab1.rpt^21836|OSC_Proto Summary.rdlx^21863
            if (mutipleReportFiles != string.Empty)
            {
                // only create once !!

                List <Stream> pdfFileStream = new List <Stream>();


                // it is batch print
                if (!string.IsNullOrWhiteSpace(reportBatchNumber))
                {
                    List <string> requestRegistIds = DDSetup.GetPdmRequestRegisterIdsByBatchNimber(reportBatchNumber);

                    foreach (string requestRegisterID in requestRegistIds)
                    {
                        // only for single report !!
                        string singleReportId = mutipleReportFiles;

                        List <Stream> pdfFileStreamFromSearchView = PrintSearchViewPdf(aUId, singleReportId, requestRegisterID, dataSourceType, mainreferenceID, masterReferenceId);

                        pdfFileStream.AddRange(pdfFileStreamFromSearchView);
                    }
                }
                else                 // it is NOT BATCH print, need to process singe request
                {
                    if (string.IsNullOrWhiteSpace(PdmRequestRegisterID))
                    {
                        List <Stream> pdfFileStreamTeckpacks = PrintTechPackPdf(aUId, mutipleReportFiles, string.Empty, dataSourceType, mainreferenceID, masterReferenceId);

                        pdfFileStream.AddRange(pdfFileStreamTeckpacks);
                    }
                    else                     // it is searchView print Calls  for each single request PdmRequestRegisterID
                    {
                        string singleReportId = mutipleReportFiles;

                        List <Stream> pdfFileStreamFromSearchView = PrintSearchViewPdf(aUId, singleReportId, PdmRequestRegisterID, dataSourceType, mainreferenceID, masterReferenceId);

                        pdfFileStream.AddRange(pdfFileStreamFromSearchView);
                    }
                }



                using (PdfDocument outputPdfDocument = new PdfDocument())
                {
                    try
                    {
                        foreach (Stream stream in pdfFileStream)
                        {
                            // Open the document to import pages from it.
                            if (stream.Length > 0)
                            {
                                using (PdfDocument inputDocument = PdfReader.Open(stream, PdfDocumentOpenMode.Import))
                                {
                                    // Iterate pages
                                    int count = inputDocument.PageCount;
                                    for (int idx = 0; idx < count; idx++)
                                    {
                                        // Get the page from the external document...
                                        PdfPage page = inputDocument.Pages[idx];
                                        // ...and add it to the output document.
                                        outputPdfDocument.AddPage(page);
                                    }
                                    stream.Close();
                                    stream.Dispose();
                                }
                            }
                        }

                        ApplicationLog.WriteError("IsReportCompressionActivate:" + DDSetup.ReorptSetup.IsReportCompressionActivate);

                        if (DDSetup.ReorptSetup.IsReportCompressionActivate)
                        {
                            string fileID         = Guid.NewGuid().ToString();
                            string FileNameOrigin = DDSetup.ReorptSetup.ReportPdfCompressPath + "Origin_" + fileID + ".pdf";
                            outputPdfDocument.Save(FileNameOrigin);

                            string FileNameDestination = DDSetup.ReorptSetup.ReportPdfCompressPath + "Dest_" + fileID + ".pdf";
                            ReportJobManagement.PdfCompression(FileNameOrigin, FileNameDestination);
                            File.Delete(FileNameOrigin);
                            OutputPdfFile(FileNameDestination);
                        }
                        else                         // need to compress PDF
                        {
                            MemoryStream memoStream = new MemoryStream();

                            outputPdfDocument.Save(memoStream, false);
                            OutPutResponse(memoStream);
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write("Print pdf Failed" + ex.ToString());
                    }
                }

                // need to dispsoe output to release memeory
                //  outputPdfDocument.Dispose();
                // need to dispost
            }
        }
コード例 #30
0
 private static void Fatal(string Text, object data = null)
 {
     ApplicationLog.WriteError(EncompassHelper.LoanNumber(), "Fatal");
 }