Esempio n. 1
0
		public Ticket(string curPath)
		{
			path = curPath;

            Aspose.Pdf.License lic = new Aspose.Pdf.License();
            lic.SetLicense(@"c:\tempfiles\Aspose.Total.lic");
		}
        public void Start()
        {
            timer = new System.Timers.Timer(30000);
            timer.Elapsed += new ElapsedEventHandler(this.ServiceTimer_Tick);

            timer.Enabled = true;
            timer.Start();

            string careProviderIDs = string.Empty;

            ConfigurationValues.GreenwayConnection = System.Configuration.ConfigurationManager.AppSettings["greenwayConnection"];
            ConfigurationValues.WaldenFaxConnection = System.Configuration.ConfigurationManager.AppSettings["fax"];
            ConfigurationValues.ProcessFaxPath = System.Configuration.ConfigurationManager.AppSettings["processFaxPath"];
            ConfigurationValues.CreatePdfPath = System.Configuration.ConfigurationManager.AppSettings["createPdfPath"];
            ConfigurationValues.CorrespondensePath = System.Configuration.ConfigurationManager.AppSettings["correspondensePath"];
            ConfigurationValues.ArchieveFolder = System.Configuration.ConfigurationManager.AppSettings["archieveFolder"];
            ConfigurationValues.FaxAutomationUserName = System.Configuration.ConfigurationManager.AppSettings["faxAutomationUserName"];
            ConfigurationValues.UseNine = System.Configuration.ConfigurationManager.AppSettings["useNine"];
            ConfigurationValues.UserName = System.Configuration.ConfigurationManager.AppSettings["userName"];
            ConfigurationValues.ErrorLogPath = System.Configuration.ConfigurationManager.AppSettings["errorLogPath"];
            ConfigurationValues.FinalFaxPath = System.Configuration.ConfigurationManager.AppSettings["finalFaxPath"];
            ConfigurationValues.PrimeSuiteUserName = System.Configuration.ConfigurationManager.AppSettings["primeSuiteUserName"];
            ConfigurationValues.PrimeSuiteUserPassword = System.Configuration.ConfigurationManager.AppSettings["primeSuiteUserPassword"];
            ConfigurationValues.PrimeSuiteUserId = System.Configuration.ConfigurationManager.AppSettings["primeSuiteUserId"];

            Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
            pdflicense.SetLicense(System.Configuration.ConfigurationManager.AppSettings["aposePDFLicense"]);
            pdflicense.Embedded = true;

        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Aspose.Words.License Wlicense = new Aspose.Words.License();
            Wlicense.SetLicense("CoolTool.Aspose.Total.lic");
            Aspose.Cells.License XLlicense = new Aspose.Cells.License();
            XLlicense.SetLicense("CoolTool.Aspose.Total.lic");
            Aspose.Pdf.License Plicense = new Aspose.Pdf.License();
            Plicense.SetLicense("CoolTool.Aspose.Total.lic");

            if (client == Client.Edimart)
            {
                grids.Add("Vendor grid", new int[] { 15, 15, 5, 15, 30, 70, 100, 100, 100 });
                grids.Add("Ügyfél grid", new int[] { 30, 30, 20, 30, 50, 70, 100, 100, 100 });
            }
            else if (client == Client.Afford)
            {
                grids.Add("Vendor grid", new int[] { 0, 10, 10, 10, 25, 40, 65, 100, 100 });
                grids.Add("Ügyfél grid", new int[] { 0, 30, 30, 30, 45, 45, 75, 100, 100 });
            }

            LanguageHelper.Initialize();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            mainWindow = new MainWindow();

            Application.Run(mainWindow);
        }
Esempio n. 4
0
        private static void RegisterLicenses()
        {
            lock (LicenseLock)
            {
                if (!IsLicenseRegistered)
                {
                    try
                    {
                        // Aspose PDF License
                        Aspose.Pdf.License asposePdfLicense = new Aspose.Pdf.License()
                        {
                            Embedded = true
                        };
                        asposePdfLicense.SetLicense("Aspose.Pdf.lic");

                        // Aspose Cells License
                        Aspose.Cells.License asposeCellsLicense = new Aspose.Cells.License();
                        asposeCellsLicense.SetLicense("Aspose.Cells.lic");
                    }
                    catch (Exception)
                    {
                        System.Diagnostics.Debug.WriteLine("Aspose License Registration FAILED!");
                    }
                    IsLicenseRegistered = true;
                }
            }
        }
Esempio n. 5
0
        protected void Application_Start()
        {
            var Key = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 11").FirstOrDefault();

            Aspose.Words.License wordsLicense = new Aspose.Words.License();

            wordsLicense.SetLicense(@"" + Key.CONFIG_VALUE);

            Aspose.Cells.License cellsLicense = new Aspose.Cells.License();

            cellsLicense.SetLicense(@"" + Key.CONFIG_VALUE);

            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();

            pdfLicense.SetLicense(@"" + Key.CONFIG_VALUE);

            Aspose.Tasks.License TaskLicense = new Aspose.Tasks.License();
            TaskLicense.SetLicense(@"" + Key.CONFIG_VALUE);

            //AreaRegistration.RegisterAllAreas();
            //WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Esempio n. 6
0
        public Ticket(string curPath)
        {
            path = curPath;

            Aspose.Pdf.License lic = new Aspose.Pdf.License();
            lic.SetLicense(@"c:\tempfiles\Aspose.Total.lic");
        }
        /// <summary>
        /// Sets the license.
        /// </summary>
        public override void SetLicense()
        {
            License license = new License();
            license.SetLicense(AttachmentResources.LicenseFileName);

            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
            pdfLicense.SetLicense(AttachmentResources.LicenseFileName);
        }
Esempio n. 8
0
 private void SetPdfLicense()
 {
     Aspose.Pdf.License        Lic     = new Aspose.Pdf.License();
     System.Text.ASCIIEncoding Encoder = new System.Text.ASCIIEncoding();
     using (System.IO.MemoryStream ms = new System.IO.MemoryStream(Encoder.GetBytes(라이센스Key)))
     {
         Lic.SetLicense(ms);
     }
 }
Esempio n. 9
0
        static void Main(string[] args)
        {
            // Lizenz
            var license = new Aspose.Pdf.License();

            license.SetLicense(@"License\Aspose.Total.NET.lic");

            SaveAsTiff(@"InputPdf\test.pdf", @"C:\tmp\output");
        }
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
            // Set License of Aspose.Cells
            Aspose.Pdf.License lic = new Aspose.Pdf.License();
            lic.SetLicense("D:\\Licenses\\Aspose.Total.Product.Family.lic");

            Aspose.BarCode.License lic2 = new Aspose.BarCode.License();
            lic2.SetLicense("D:\\Licenses\\Aspose.Total.Product.Family.lic");
        }
Esempio n. 11
0
 ///<Summary>
 /// SetAsposePdfLicense method to Aspose.Words License
 ///</Summary>
 public static void SetAsposePdfLicense()
 {
     try
     {
         Aspose.Pdf.License pdfLic = new Aspose.Pdf.License();
         pdfLic.SetLicense(_licenseFileName);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Esempio n. 12
0
        private static void getLicense()
        {
            license = new Aspose.Pdf.License();
            var assembly = Assembly.GetExecutingAssembly();
            var stream   = assembly.GetManifestResourceStream("BSVI.FileCheck.Aspose.Total.lic");

            if (stream == null)
            {
                throw new Exception("Invalid aspose license");
            }
            license.SetLicense(stream);
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            Aspose.OCR.License ocrLicense = new Aspose.OCR.License();
            ocrLicense.SetLicense("D:\\DotNet Projects\\Aspose\\2019\\Aspose.Total.NET.lic");
            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
            pdfLicense.SetLicense("D:\\DotNet Projects\\Aspose\\2019\\Aspose.Total.NET.lic");


            Console.WriteLine("Open RunExamples.cs. \nIn Main() method Uncomment the example that you want to run.");
            Console.WriteLine("=====================================================");

            // Uncomment the example that you want to run.

            //// =====================================================
            //// =====================================================
            ////  Performing And Managing OCR
            //// =====================================================
            //// =====================================================

            //PerformOCROnImage.Run();
            //GettingWordNotification.Run();
            //ExtractingText.Run();
            //GetLocationAndSizeExample.Run();
            //ReadPartInformation.Run();
            //DetectingTextBlocks.Run();
            //GetTextPartHierarchy.Run();
            //WorkingWithDifferentLanguages.Run();
            //OCROnMultipageTIFF.Run();
            //PreprocesImagesFromOCROperation.Run();
            //ExtractPreprocessedImage.Run();
            //PerformOCROnPDF.Run();
            //LoadImagefromURLtoPerformOCR.Run();

            //// =====================================================
            //// =====================================================
            //// Formatting And Manipulating OCR
            //// =====================================================
            //// =====================================================


            //AddingUserDefinedRecognitionBlocks.Run();
            //ApplyingCorrectionFilters.Run();
            //AutomaticallyCorrectTheSpellings.Run();
            //RecognizeWhiteListedCharacters.Run();
            //SettingOcrEngineAutomaticallyDetect.Run();
            //SettingtheOcrEngine.Run();
            //SettingtheOcrEngineAutomaticallyDetectTextBlocks.Run();
            //GettingBlockNotification.Run();

            // Stop before exiting
            Console.WriteLine(Environment.NewLine + "Program Finished. Press any key to exit....");
            Console.ReadKey();
        }
 /// <summary>
 /// Adds the aspose license.
 /// </summary>
 /// <param name="serviceCollection">The service collection.</param>
 public static void AddAsposeLicense(this IServiceCollection serviceCollection)
 {
     using var stream = typeof(AsposeLicenceManagement).Assembly.GetManifestResourceStream(LicenceFileName);
     if (stream is null)
     {
         throw new MissingManifestResourceException($"Failed to locate Aspose PDF licence file ({LicenceFileName}) in current assembly.");
     }
     else
     {
         var pdflicense = new Aspose.Pdf.License();
         pdflicense.SetLicense(stream);
     }
 }
Esempio n. 15
0
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_QuickStart();

            // Initialize license object
            Aspose.Pdf.License license = new Aspose.Pdf.License();
            // Set license
            license.SetLicense("Aspose.Pdf.lic");
            Console.WriteLine("License set successfully.");
            // ExEnd:1
        }
Esempio n. 16
0
 private static void setLicense()
 {
     { //Enable Word support
         Aspose.Words.License license = new Aspose.Words.License();
         license.SetLicense("Aspose.Total.lic");
     }
     { //Enable Excel support
         Aspose.Cells.License license = new Aspose.Cells.License();
         license.SetLicense("Aspose.Total.lic");
     }
     { //Enable PDF support
         Aspose.Pdf.License license = new Aspose.Pdf.License();
         license.SetLicense("Aspose.Total.lic");
     }
 }
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_QuickStart();

            // Initialize license object
            Aspose.Pdf.License license = new Aspose.Pdf.License();
            // Set license
            license.SetLicense("MergedAPI.Aspose.Total.lic");
            // Set the value to indicate that license will be embedded in the application
            license.Embedded = true;
            Console.WriteLine("License set successfully.");
            // ExEnd:1
        }
Esempio n. 18
0
        public static void License()
        {
            string licensePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Aspose.Total.lic";

            Aspose.Pdf.License pdf_license = new Aspose.Pdf.License();
            pdf_license.SetLicense(licensePath);

            Aspose.Words.License word_license = new Aspose.Words.License();
            word_license.SetLicense(licensePath);

            Aspose.Cells.License excel_license = new Aspose.Cells.License();
            excel_license.SetLicense(licensePath);

            Aspose.Slides.License ppt_license = new Aspose.Slides.License();
            ppt_license.SetLicense(licensePath);
        }
Esempio n. 19
0
        public static void Main(string[] args)
        {
            string rootdir = Directory.GetCurrentDirectory();
            //Read Configuration from appSettings
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();

            try
            {
                //Aspoe-Excel
                Aspose.Cells.License cellLicense = new Aspose.Cells.License();
                string     filePath   = rootdir + "\\Resources\\" + "Aspose.Total.lic";
                FileStream fileStream = new FileStream(filePath, FileMode.Open);
                cellLicense.SetLicense(fileStream);
                fileStream.Close();
                //Aspoe-Pdf
                Aspose.Pdf.License pdfLicense    = new Aspose.Pdf.License();
                FileStream         fileStreampdf = new FileStream(filePath, FileMode.Open);
                pdfLicense.SetLicense(fileStreampdf);
                fileStreampdf.Close();
                //Aspoe-Word

                Aspose.Words.License wordLicense    = new Aspose.Words.License();
                FileStream           fileStreamword = new FileStream(filePath, FileMode.Open);
                wordLicense.SetLicense(fileStreamword);
                fileStreamword.Close();

                //Initialize Logger
                Log.Logger = new LoggerConfiguration()
                             .ReadFrom.Configuration(config)
                             .CreateLogger();
                Log.Information("DFPS Application Starting.......................");

                //Test t = new Test();
                //CSharpLab.Test();
                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Application start-up failed");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Esempio n. 20
0
        private void RegisterLicenses()
        {
            string licenseAsposeWordPath = Server.MapPath("~/Licenses/Aspose.Words.lic");

            if (System.IO.File.Exists(licenseAsposeWordPath))
            {
                Aspose.Words.License licenseWord = new Aspose.Words.License();
                licenseWord.SetLicense(licenseAsposeWordPath);
            }
            string licenseAsposePdfPath = Server.MapPath("~/Licenses/Aspose.Pdf.lic");

            if (System.IO.File.Exists(licenseAsposePdfPath))
            {
                Aspose.Pdf.License licensePdf = new Aspose.Pdf.License();
                licensePdf.SetLicense(licenseAsposePdfPath);
            }
        }
        public ProcessDocuments()
        {
            pathToAposeLicense = System.Configuration.ConfigurationManager.AppSettings["pathToAposeLicense"];
            pathToWatchedFolder = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder"];
            pathToWatchedFolder1 = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder1"];
            pathToWatchedFolder2 = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder2"];
            pathToWatchedFolder3 = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder3"];
            pathToWatchedFolder4 = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder4"];
            pathToWatchedFolder5 = System.Configuration.ConfigurationManager.AppSettings["pathToWatchedFolder5"];
            addFolderName1 = System.Configuration.ConfigurationManager.AppSettings["addFolderName1"];
            addFolderName2 = System.Configuration.ConfigurationManager.AppSettings["addFolderName2"];
            addFolderName3 = System.Configuration.ConfigurationManager.AppSettings["addFolderName3"];
            addFolderName4 = System.Configuration.ConfigurationManager.AppSettings["addFolderName4"];
            addFolderName5 = System.Configuration.ConfigurationManager.AppSettings["addFolderName5"];

            pathToSecondFolder = System.Configuration.ConfigurationManager.AppSettings["pathToSecondFolder"];

            Exceptions.Errors.Application = System.Configuration.ConfigurationManager.AppSettings["application"];
            Exceptions.Errors.DatabaseConnection = System.Configuration.ConfigurationManager.AppSettings["deskTopConnection"];
            Exceptions.Errors.EmailBody = System.Configuration.ConfigurationManager.AppSettings["emailBody"];
            Exceptions.Errors.EmailFrom = System.Configuration.ConfigurationManager.AppSettings["emailFrom"];
            Exceptions.Errors.EmailFromFriendly = System.Configuration.ConfigurationManager.AppSettings["emailFromFriendly"];
            Exceptions.Errors.EmailSendTo = System.Configuration.ConfigurationManager.AppSettings["emailSendTo"];
            Exceptions.Errors.EmailSendToFriendly = System.Configuration.ConfigurationManager.AppSettings["emailSendToFriendly"];
            Exceptions.Errors.EmailSubject = System.Configuration.ConfigurationManager.AppSettings["emailSubject"];
            Exceptions.Errors.SMTPHost = System.Configuration.ConfigurationManager.AppSettings["smtpHost"];
            Exceptions.Errors.SMTPPort = System.Configuration.ConfigurationManager.AppSettings["smtpPort"];
            Exceptions.Errors.SMTPHostPassword = System.Configuration.ConfigurationManager.AppSettings["smtpHostPassword"];

            //Exceptions.ExceptionHandling.InsertErrorMessage("test message" + DateTime.Now.ToShortDateString());
            //Exceptions.ExceptionHandling.SendErrorEmail("test message" + DateTime.Now.ToShortDateString());


            Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
            pdflicense.SetLicense(pathToAposeLicense);
            pdflicense.Embedded = true;

            _timer = new System.Timers.Timer(30000);
            _timer.Elapsed += new ElapsedEventHandler(this.ServiceTimer_Tick);

            _timer.Enabled = true;
            Log("timer started");
            _timer.Start();

            Console.ReadLine();
        }
Esempio n. 22
0
        public static bool InstantiateLicense(SPWeb web)
        {
            bool boolSuccess = false;

            try
            {
                Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
                using (var stream = web.GetFile("License/Aspose.Total.lic").OpenBinaryStream())
                {
                    pdfLicense.SetLicense(stream);
                }
                boolSuccess = true;
            }
            catch (Exception ex)
            {
                boolSuccess = false;
                LogError(ex.Message);
            }
            return(boolSuccess);
        }
Esempio n. 23
0
        internal static void SetUnlimitedLicense()
        {
            // This is where the test license is on my development machine.
            string testLicenseFileName = Path.Combine(LicenseDir, "Aspose.Total.NET.lic");

            if (File.Exists(testLicenseFileName))
            {
                // This shows how to use an Aspose.Words license when you have purchased one.
                // You don't have to specify full path as shown here. You can specify just the
                // file name if you copy the license file into the same folder as your application
                // binaries or you add the license to your project as an embedded resource.
                License wordsLicense = new License();
                wordsLicense.SetLicense(testLicenseFileName);

                Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
                pdfLicense.SetLicense(testLicenseFileName);

                Aspose.BarCode.License barcodeLicense = new Aspose.BarCode.License();
                barcodeLicense.SetLicense(testLicenseFileName);
            }
        }
Esempio n. 24
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Stream stream = new MemoryStream(StrToByteArray(Resource.Licence));

            stream.Position = 0;
            Aspose.Pdf.License   licensePdf   = new Aspose.Pdf.License();
            Aspose.Words.License licenseWords = new Aspose.Words.License();

            licensePdf.SetLicense(stream);
            stream.Position = 0;
            licenseWords.SetLicense(stream);
            stream.Close();

            LogHelper.InitLogger();
            LogHelper.Log.Info("Application Start");
        }
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            ConfigurationValues.DeskTopConnection = System.Configuration.ConfigurationManager.AppSettings["deskTopConnection"];            
            ConfigurationValues.WaldenFaxConnection = System.Configuration.ConfigurationManager.AppSettings["fax"];
            ConfigurationValues.TemporaryFaxPath = System.Configuration.ConfigurationManager.AppSettings["termporaryFaxPath"];
            ConfigurationValues.WhereToCopyPDfTo = System.Configuration.ConfigurationManager.AppSettings["whereToCopyPDFTo"];
            ConfigurationValues.PdfFolder = System.Configuration.ConfigurationManager.AppSettings["pdfFolder"];
            ConfigurationValues.PernamentFaxPath = System.Configuration.ConfigurationManager.AppSettings["pernamentFaxPath"];
            ConfigurationValues.ApplicationPath = System.Configuration.ConfigurationManager.AppSettings["applicationPath"];
            ConfigurationValues.UseNine = System.Configuration.ConfigurationManager.AppSettings["useNine"];
            ConfigurationValues.ReviewDocumentPath = System.Configuration.ConfigurationManager.AppSettings["reviewDocumentPath"];
            ConfigurationValues.ProcessDocumentPath = System.Configuration.ConfigurationManager.AppSettings["processDocumentPath"];
            ConfigurationValues.GreenwayConnection = System.Configuration.ConfigurationManager.AppSettings["greenwayConnection"];
            ConfigurationValues.PathToWorkingFolder = System.Configuration.ConfigurationManager.AppSettings["pathToWorkingFolder"];
            ConfigurationValues.PathToErrorFolder = System.Configuration.ConfigurationManager.AppSettings["pathToErrorFolder"];
            ConfigurationValues.PathToViewErrorFolder = System.Configuration.ConfigurationManager.AppSettings["pathToViewErrorFolder"];
            ConfigurationValues.ViewErrorDocumentPath = System.Configuration.ConfigurationManager.AppSettings["viewErrorDocumentPath"];
            ConfigurationValues.PathToArchiveFolder = System.Configuration.ConfigurationManager.AppSettings["pathToArchiveFolder"];


            ConfigurationValues.Application = System.Configuration.ConfigurationManager.AppSettings["application"];
            ConfigurationValues.EmailFrom = System.Configuration.ConfigurationManager.AppSettings["emailFrom"];
            ConfigurationValues.EmailFromFriendly = System.Configuration.ConfigurationManager.AppSettings["emailFromFriendly"];
            ConfigurationValues.EmailSendTo = System.Configuration.ConfigurationManager.AppSettings["emailSendTo"];
            ConfigurationValues.EmailSendToFriendly = System.Configuration.ConfigurationManager.AppSettings["emailSendToFriendly"];
            ConfigurationValues.EmailSubject = System.Configuration.ConfigurationManager.AppSettings["emailSubject"];
            ConfigurationValues.SmtpHost = System.Configuration.ConfigurationManager.AppSettings["smtpHost"];
            ConfigurationValues.SmtpPort = System.Configuration.ConfigurationManager.AppSettings["smtpPort"];
            ConfigurationValues.SmtpHostPassword = System.Configuration.ConfigurationManager.AppSettings["smtpHostPassword"];


            Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
            pdflicense.SetLicense(System.Configuration.ConfigurationManager.AppSettings["aposePDFLicense"]);
            pdflicense.Embedded = true;

            Aspose.BarCode.License barCodeLicense = new Aspose.BarCode.License();
            barCodeLicense.SetLicense(System.Configuration.ConfigurationManager.AppSettings["aposeBarCodeLicense"]);
        }
Esempio n. 26
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ModelBinders.Binders.Add(typeof(DateTime), new CustomDateBinder());
            ModelBinders.Binders.Add(typeof(DateTime?), new NullableCustomDateBinder());

            Stream stream = new MemoryStream(StrToByteArray(Resources.Licence));

            stream.Position = 0;
            Aspose.Pdf.License     licensePdf     = new Aspose.Pdf.License();
            Aspose.Words.License   licenseWords   = new Aspose.Words.License();
            Aspose.Cells.License   licenseCells   = new Aspose.Cells.License();
            Aspose.Slides.License  licenseSlides  = new Aspose.Slides.License();
            Aspose.BarCode.License licenseBarCode = new Aspose.BarCode.License();

            licensePdf.SetLicense(stream);
            stream.Position = 0;
            licenseWords.SetLicense(stream);
            stream.Position = 0;
            licenseCells.SetLicense(stream);
            stream.Position = 0;
            licenseSlides.SetLicense(stream);
            stream.Position = 0;
            licenseBarCode.SetLicense(stream);
            stream.Close();
            //   CreateLogins();

            //	CheckLogins();

            LogHelper.InitLogger();
            LogHelper.Log.Info("Application Start");

            EmployePermissionHelper.Init();


            QScheduler.Start();
        }
Esempio n. 27
0
 private void APISelectionAspose_CheckedChanged(object sender, EventArgs e)
 {
     if (APISelectionAspose.Checked)
     {
         var asposeLicensePath = Path.Combine(Directory.GetCurrentDirectory(), "Aspose.Pdf.lic");
         var asposeLicense     = new Aspose.Pdf.License();
         try
         {
             asposeLicense.SetLicense(asposeLicensePath);
             if (!Aspose.Pdf.Document.IsLicensed)
             {
                 throw new Exception(null);
             }
             asposeLicense.Embedded = true;
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error: Unable to load Aspose license, so you will have limited functionality. \r\nMake sure it is copied in the following directory: \r\n" + asposeLicensePath +
                             "\r\n\r\nNote: You can also try the iText7 option", "PDF Link Updater");
         }
     }
 }
Esempio n. 28
0
        public static void ImportLicense()
        {
            var asposeLicenseValue = File.ReadAllText("./license.txt");

            if (string.IsNullOrEmpty(asposeLicenseValue))
            {
                return;
            }

            using var stream = new MemoryStream();

            using var write = new StreamWriter(stream);

            write.Write(asposeLicenseValue);
            write.Flush();
            stream.Position = 0;

            var docLicense = new Aspose.Words.License();

            docLicense.SetLicense(stream);

            stream.Position = 0;
            var pdfLicense = new Aspose.Pdf.License();

            pdfLicense.SetLicense(stream);

            stream.Position = 0;
            var imagingLicense = new Aspose.Imaging.License();

            imagingLicense.SetLicense(stream);

            stream.Position = 0;
            var htmlLicense = new Aspose.Html.License();

            htmlLicense.SetLicense(stream);
        }
Esempio n. 29
0
 /// <summary>
 /// Initializes static members of the <see cref="FileManager"/> class.
 /// </summary>
 static FileManager()
 {
     var byteArray = Encoding.ASCII.GetBytes(AsposeLicense);
     using (var licenseStream = new MemoryStream(byteArray))
     {
         var pdfLicense = new Aspose.Pdf.License();
         pdfLicense.SetLicense(licenseStream);
         licenseStream.Position = 0;
         var cellLicense = new Aspose.Cells.License();
         cellLicense.SetLicense(licenseStream);
         licenseStream.Position = 0;
         var wordsLicense = new Aspose.Words.License();
         wordsLicense.SetLicense(licenseStream);
         licenseStream.Position = 0;
         var slidesLicense = new Aspose.Slides.License();
         slidesLicense.SetLicense(licenseStream);
         licenseStream.Position = 0;
         var tasksLicense = new Aspose.Tasks.License();
         tasksLicense.SetLicense(licenseStream);
         licenseStream.Position = 0;
         var diagramLicense = new Aspose.Diagram.License();
         diagramLicense.SetLicense(licenseStream);
     }
 }
Esempio n. 30
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            var license = new Aspose.Pdf.License();
            license.SetLicense(@"C:\Keys\Aspose.Pdf.lic");

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
 private static bool InvokeAposePdfLicense()
 {
     try
     {
         Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
         pdflicense.SetLicense(ConfigurationValues.AposePdfLicenseLocation);
         pdflicense.Embedded = true;
         return true;
     }
     catch (Exception er)
     {
         Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());                    
         return false;
     }
 }
Esempio n. 32
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage httpRequestMessage, ILogger log)
        {
            log.LogInformation($"ImageConverterFunction :HTTP trigger function processed request at : { DateTime.Now}");
            //Binding file content from httpRequestMessage
            var    fileContent = httpRequestMessage.Content;
            string jsonContent = fileContent.ReadAsStringAsync().Result;
            //Get headers from httpRequestMessage
            var         headers      = httpRequestMessage.Headers;
            var         jsonToReturn = string.Empty;
            string      errormessage = string.Empty;
            HeaderModel headerModel  = new HeaderModel();

            try
            {
                //Validating headers from httprequestMessage
                if (HeaderValidation.ValidateHeader(headers, ref errormessage))
                {
                    headerModel.FileExtension = headers.GetValues(Constants.FILE_EXTENSION).First();
                    headerModel.FileType      = headers.GetValues(Constants.FILE_TYPE).First();
                    log.LogInformation($"HeaderValidation success for File extension and FileType");
                }
                else
                {
                    //Header values has empty or null return badrequest response
                    log.LogInformation($"HeaderValidation Failure for File extension and FileType :{errormessage}");
                    return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent($"{errormessage}")
                    });
                }

                #region ImageToThumbnail
                //Converting Image file to Thumbnail image
                if (headerModel.FileExtension == Constants.PNG || headerModel.FileExtension == Constants.JPEG)
                {
                    try
                    {
                        //Validating Image specific headers
                        if (HeaderValidation.ValidateImageHeader(headers, ref errormessage))
                        {
                            headerModel.ThumnailImageHeight = headers.GetValues(Constants.THUMBNAIL_HEIGHT).First();
                            headerModel.ThumnailImageWidth  = headers.GetValues(Constants.THUMBNAIL_WIDTH).First();
                            headerModel.InlineImageHeight   = headers.GetValues(Constants.INLINE_HEIGHT).First();
                            headerModel.InlineImageWidth    = headers.GetValues(Constants.INLINE_WIDTH).First();
                            log.LogError($"HeaderValidation Success for Image to thumbnail conversion");
                        }
                        else
                        {
                            //Header values has empty or null return badrequest response
                            log.LogInformation($"HeaderValidation Failure in Image to thumbnail conversion: {errormessage}");
                            return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                            {
                                Content = new StringContent($"{ errormessage }", Encoding.UTF8, Constants.JSON)
                            });
                        }
                        //Convert file content to memorystream
                        var memoryStream = new MemoryStream(Convert.FromBase64String(jsonContent));
                        var imageObj     = new { thumbnail = ConvertToThumbnail(memoryStream, Convert.ToInt32(headerModel.ThumnailImageHeight), Convert.ToInt32(headerModel.ThumnailImageWidth), log), inline = ConvertToThumbnail(memoryStream, Convert.ToInt32(headerModel.InlineImageHeight), Convert.ToInt32(headerModel.InlineImageWidth), log) };
                        jsonToReturn = JsonConvert.SerializeObject(imageObj);
                    }
                    catch (Exception ex)
                    {
                        log.LogError($"Exception occurred in Image file conversion to thumbnail, Error : {ex.Message},Details:{ex.InnerException}");
                        return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                        {
                            Content = new StringContent(ex.Message, Encoding.UTF8, Constants.JSON)
                        });
                    }
                }
                #endregion

                #region PDFToThumbnail
                //Converting Pdf first page to Thumbnail image
                if (headerModel.FileExtension == Constants.PDF)
                {
                    try
                    {
                        //To include license
                        Aspose.Pdf.License license = new Aspose.Pdf.License();
                        license.SetLicense("Aspose.Pdf.lic");
                        log.LogInformation("Aspose SetLicense Success");
                        ImageFormat  format       = GetImageFormat(headerModel.FileType, log);
                        PdfConverter pdfConverter = new PdfConverter();
                        //Validating pdf file specific headers
                        if (HeaderValidation.ValidatePdfFileHeader(headers, ref errormessage))
                        {
                            headerModel.Height = headers.GetValues(Constants.HEIGHT).First();
                            headerModel.Width  = headers.GetValues(Constants.WIDTH).First();
                            log.LogInformation($"HeaderValidation Success for PDF to thumbnail conversion");
                        }
                        else
                        {
                            //Header values has empty or null return badrequest response
                            log.LogError($"HeaderValidation Failure for PDF to thumbnail conversion : {errormessage}");
                            return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                            {
                                Content = new StringContent($"{errormessage}", Encoding.UTF8, Constants.JSON)
                            });
                        }

                        var streamContent = httpRequestMessage.Content.ReadAsStreamAsync();
                        pdfConverter.BindPdf(streamContent.Result);
                        //To convert first page of PDF
                        pdfConverter.StartPage  = 1;
                        pdfConverter.EndPage    = 1;
                        pdfConverter.Resolution = new Aspose.Pdf.Devices.Resolution(100);
                        pdfConverter.DoConvert();
                        MemoryStream imageStream = new MemoryStream();
                        while (pdfConverter.HasNextImage())
                        {
                            // Save the image in the given image Format
                            pdfConverter.GetNextImage(imageStream, format);
                            // Set the stream position to the beginning of the stream
                            imageStream.Position = 0;
                        }
                        var imageObj = new { content = ConvertToThumbnail(imageStream, Convert.ToInt32(headerModel.Width), Convert.ToInt32(headerModel.Height), log), contentType = "image/" + headerModel.FileType };
                        jsonToReturn = JsonConvert.SerializeObject(imageObj);
                        pdfConverter.Close();
                        imageStream.Close();
                    }
                    catch (Exception ex)
                    {
                        log.LogError($"Exception occurred in pdf file conversion to thumbnail,Error : {ex.Message},Details:{ex.InnerException}");
                        return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                        {
                            Content = new StringContent(ex.Message, Encoding.UTF8, Constants.JSON)
                        });
                    }
                }

                #endregion
                log.LogInformation("ImageConverterFunction successfully processed.");
                return(new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent(jsonToReturn, Encoding.UTF8, Constants.JSON)
                });
            }
            catch (Exception ex)
            {
                log.LogError($"Exception occurred in ImageConverterFunction,Error: { ex.Message},Details: { ex.InnerException}");
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message, Encoding.UTF8, Constants.JSON)
                });
            }
        }
 private void AirlineClient_Load(object sender, EventArgs e)
 {
     //set license from file or embedded resource
     Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
     pdfLicense.SetLicense(@"c:\tempfiles\Aspose.Total.lic");
 }
        private void AirlineClient_Load(object sender, EventArgs e)
        {
            //set license from file or embedded resource
            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
            pdfLicense.SetLicense(@"c:\tempfiles\Aspose.Total.lic");


        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (txtSearchWord.Text.Length < 1)
            {
                MessageBox.Show("Please select page to print", "Error");
                return;
            }
            
            
            this.Cursor = Cursors.WaitCursor;
            txtSearchWord.Text = txtSearchWord.Text + ",";

            string [] pagesToBEPrinted = txtSearchWord.Text.Split(',');

            try
            {
                Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
                
                pdflicense.SetLicense(System.Configuration.ConfigurationManager.AppSettings["aposePDFLicense"]);
                pdflicense.Embedded = true;

                //O2S.Components.PDF4NET.PDFDocument searchedPDF
                //    = new O2S.Components.PDF4NET.PDFDocument(batchFilePath);

                //searchedPDF.SerialNumber = "PDF4NET-AYBAM-8ARRR-B4EX2-OXGCC-KN2Q5";            

                //O2S.Components.PDF4NET.PDFDocument newPDF
                //    = new O2S.Components.PDF4NET.PDFDocument();

                //newPDF.SerialNumber = "PDF4NET-AYBAM-8ARRR-B4EX2-OXGCC-KN2Q5";


                //Open document
                
                //pdflicense.
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(batchFilePath);
                Aspose.Pdf.Document newPdf = new Aspose.Pdf.Document();
                
                //int pageCount = 1;
                //Loop through all the pages
                //foreach (Page pdfPage in pdfDocument.Pages)
                //{
                //    Document newDocument = new Document();
                //    newDocument.Pages.Add(pdfPage);
                //    newDocument.Save("page_" + pageCount + ".pdf");
                //    pageCount++;
               // }



                for (int i = 0; i < pagesToBEPrinted.Length - 1; i++)
                {
                    Aspose.Pdf.Page aPDFPage = pdfDocument.Pages[int.Parse(pagesToBEPrinted[i])];
                    newPdf.Pages.Add(aPDFPage);
                }
                ////pd.
                ////searchedPDF.
                newPdf.Save(batchFilePathPrintPDF);

                System.Diagnostics.Process.Start(batchFilePathPrintPDF);

                //Process p = new Process();
                //p.StartInfo = new ProcessStartInfo()
                //{
                //    CreateNoWindow = true,
                //    Verb = "print",
                //    FileName = batchFilePathPrintPDF //put the correct path here
                //};
                //p.Start();



                //SendToPrinter(batchFilePathPrintPDF);

                //_newPDF.Pages..RemoveAt(iPageToDelete - 1);
                //_newPDF.Save(_reviewDocument);
                //return true;
                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Error message is " + ex.Message, "Error", MessageBoxButtons.OK);
                //return false;
            }




            //string pathToDocument = batchFilePath;

            //// create index from PDF file
            //using (Stream pdfDocumentStreamToSearch = new FileStream(pathToDocument, FileMode.Open, FileAccess.Read))
            //{
            //    SearchIndex searchIndex = new SearchIndex(pdfDocumentStreamToSearch);

            //    // create document used for rendering
            //    using (Stream pdfDocumentStreamToRasterize = new FileStream(pathToDocument, FileMode.Open, FileAccess.Read))
            //    {
            //        document = new Document(pdfDocumentStreamToRasterize);

            //        // search text in PDF document and render pages containg results
            //        searchIndex.Search(SearchHandler, txtSearchWord.Text);
            //    }
            //}



            //    //SearchIndex searchIndex;

            //    //// so we have created the index already
            //    //if (searchDictionary.TryGetValue(loadedFilePath, out searchIndex))
            //    //{
            //    //    //e.SearchIndex = searchIndex;
            //    //}
            //    //else
            //    //{
            //    //    searchIndex = new SearchIndex(File.OpenRead(loadedFilePath));
            //    //    searchDictionary.Add(loadedFilePath, searchIndex);
            //    //    int ee = searchDictionary.Count;

            //    //    //e.SearchIndex = searchIndex;
            //    //}



            ////pdfViewer1.s
      }
        static void Main(string[] args)
        {
            string careProviderIDs = string.Empty;

            ConfigurationValues.GreenwayConnection = System.Configuration.ConfigurationManager.AppSettings["greenwayConnection"];
            ConfigurationValues.WaldenFaxConnection = System.Configuration.ConfigurationManager.AppSettings["fax"];
            ConfigurationValues.ProcessFaxPath = System.Configuration.ConfigurationManager.AppSettings["processFaxPath"];
            ConfigurationValues.CreatePdfPath = System.Configuration.ConfigurationManager.AppSettings["createPdfPath"];
            ConfigurationValues.CorrespondensePath = System.Configuration.ConfigurationManager.AppSettings["correspondensePath"];
            ConfigurationValues.ArchieveFolder = System.Configuration.ConfigurationManager.AppSettings["archieveFolder"];
            ConfigurationValues.FaxAutomationUserName = System.Configuration.ConfigurationManager.AppSettings["faxAutomationUserName"];

            Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
            pdflicense.SetLicense(System.Configuration.ConfigurationManager.AppSettings["aposePDFLicense"]);
            pdflicense.Embedded = true;

            List<SignedDocument> documentsList = GetListOfDocumentssToSendViaFax(GetListOfCarProviderIDs());
            List<FaxTelephoneNumber> faxTelephoneNumberList = new List<FaxTelephoneNumber>();

            for (int i = 0; i < documentsList.Count; i++)
            {
                InsertAllSignedNotes(documentsList[i]);

                if (documentsList[i].PrimaryCareProviderID > 0 && documentsList[i].ReferringCareProviderID > 0)
                {
                    if (documentsList[i].CareProviderID == documentsList[i].PrimaryCareProviderID )
                    {
                        careProviderIDs = " (" + documentsList[i].ReferringCareProviderID.ToString() + ")";
                    }
                    else if (documentsList[i].CareProviderID != documentsList[i].ReferringCareProviderID)
                    {
                        careProviderIDs = " (" + documentsList[i].PrimaryCareProviderID.ToString() + ")";
                    }
                    else
                    {
                        careProviderIDs = " (" + documentsList[i].PrimaryCareProviderID.ToString()
                            + "," + documentsList[i].ReferringCareProviderID.ToString()
                            + ")";
                    }
                }
                else if (documentsList[i].PrimaryCareProviderID > 0 && documentsList[i].ReferringCareProviderID == 0)
                {
                    if (documentsList[i].CareProviderID != documentsList[i].PrimaryCareProviderID)
                    {
                        careProviderIDs = " (" + documentsList[i].PrimaryCareProviderID.ToString() + ")";
                    }
                }
                else if (documentsList[i].PrimaryCareProviderID == 0 && documentsList[i].ReferringCareProviderID > 0)
                {
                    if (documentsList[i].CareProviderID != documentsList[i].ReferringCareProviderID)
                    {
                        careProviderIDs = " (" + documentsList[i].ReferringCareProviderID.ToString() + ")";
                    }
                }
                else if (documentsList[i].PrimaryCareProviderID == 0 && documentsList[i].ReferringCareProviderID == 0)
                {


                }

                faxTelephoneNumberList = GetFaxNumbers(careProviderIDs);

                for (int j = 0; j < faxTelephoneNumberList.Count; j++)
                {
                    if (faxTelephoneNumberList[j].FaxNumber.Length > 0)
                    {
                        GetDocumentFromGreenway(documentsList[i].DocumentID);

                        CreateLetterToPutInFrontOfNote(faxTelephoneNumberList[j], documentsList[i]);

                        SentNotesFax sentNotesFax = new SentNotesFax();
                        sentNotesFax.DocumentID = documentsList[i].DocumentID;
                        sentNotesFax.FromProviderID = documentsList[i].CareProviderID;
                        sentNotesFax.FromProviderName = documentsList[i].CareProviderName;
                        sentNotesFax.PatientID = documentsList[i].PatientID.ToString(); ;
                        sentNotesFax.PatientName = documentsList[i].PatientName;
                        sentNotesFax.ToProviderID = faxTelephoneNumberList[j].ProviderID;
                        sentNotesFax.ToProviderName = faxTelephoneNumberList[j].FullName;
                        ////faxTelephoneNumberList[j].FullName
                        ////string[] credential = faxTelephoneNumberList[j].FullName.Split(' ');
                        ////faxTelephoneNumberList[j].Name = faxTelephoneNumberList[j].Name = " ," + credential[credential.Length - 1];

                        //PdfFileEditor pdfEditor = new PdfFileEditor();
                        SendFax sendAFax = new Models.SendFax();
                        sendAFax.AccountID = "1001";
                        sendAFax.UserID = ConfigurationValues.FaxAutomationUserName;
                        sendAFax.FaxName = documentsList[i].CareProviderName;
                        sendAFax.FaxPath = ConfigurationValues.FinalFaxPath;
                        sendAFax.FaxNumber = faxTelephoneNumberList[j].FaxNumber;
                        //sendAFax.FaxNumber = "9,2034668585";
                        sendAFax.RecipientName = faxTelephoneNumberList[j].Name;
                        sendAFax.Notes = string.Empty;
                        sendAFax.PageCount = GetPageCount(ConfigurationValues.FinalFaxPath);
                        sendAFax.FaxSent = "Y";
                        sendAFax.InUse = "N";
                        sendAFax.ToTif = "Y";
                        sendAFax.CallWait = 0;
                        sendAFax.TimesCalled = 0;
                        sendAFax.Status = "New Fax Entry";
                        sendAFax.ShowFax = "Y";
                        sendAFax.CreateTime = DateTime.Now.ToShortDateString()
                            + " " + DateTime.Now.ToShortTimeString();
                        sendAFax.CompletionTime = string.Empty;
                        sendAFax.DateStamp = DateTime.Now.ToShortDateString()
                            + " " + DateTime.Now.ToShortTimeString();

                        OperationResult operationResult = SendFax(sendAFax);
                        sentNotesFax.SendID = int.Parse(operationResult.MessageList[0]);
                        AddReportingRecord(sentNotesFax);

                        if (operationResult.Success)
                        {
                            SendFaxMultitech sendFax = new SendFaxMultitech();

                            faxTelephoneNumberList[j].FaxNumber = faxTelephoneNumberList[j].FaxNumber.Replace("(", "")
                                .Replace(")", "")
                                .Replace("-", "")
                                .Replace(" ", "");

                            //sendFax.SendTheFax(documentsList[i].PatientName, ConfigurationValues.FinalFaxPath, faxTelephoneNumberList[j].Name, faxTelephoneNumberList[j].FaxNumber, operationResult.MessageList[0], "");
                        }
                    }
                }
            }

            //Scott here are the API calls you would need to make to get the data from the Greenway API for the faxing solution.  We are working to get you access to the PrimeSuite server that the test API uses.   No one was in the office Friday at Greenway to get it done.  We will also look at the API calls for the other project today. 
            //Goal: Provide a list of signed documents for the day
            //API transactions needed:
            //Visit Search
            //Care Provider Search
            //DocumentType Get
            //Document List Search 2
            //Document Get


            //Instructions:
            //1.       Call Visit Search with desired From/Through date
            //a.       This will give you a list of all patients seen during the specified date range. If you know which provider you want to filter by that would be ideal. You will get all patients from all providers if you don’t populate the CareProviderID field. 
            //b.      Call Care Provider Search if you need the Care Provider ID’s for a Provider.
            //2.       Call Document Type get
            //a.       This will give you a list of document types and their respective IDs for the practice –parts of this list can be unique for each practice.
            //3.       Call Document List Search 2 using Patient IDs from the response of Visit search. Use Doc Type ID if you want to filter the documents by a specific type. Use DocumentStatus=2 if you only want authenticated notes
            //a.       This will give you a DocumentID in the response
            //4.       Call Document Get to retrieve a PDF of the document-you will need to populate the DocumentID and the ExportType (PDF) in the request of this transaction.

            //This is the call for the visit search
            //            ContractBuilderVisitSearch oBuilder = new ContractBuilderVisitSearch();
            //            Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchRequest visitSearchRequest = new Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchRequest();
            //            Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchCriteria visitSearchCriteria = new Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchCriteria();
            //            Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchResponse visitSearchResponse = new Greenway.PrimeSuite.DataContracts.SystemAdmin.VisitSearchResponse();

            //            visitSearchRequest = oBuilder.BuildVisitSearchRequest();
            //            visitSearchCriteria.PatientID = 1121;
            //            visitSearchRequest.VisitSearchCriteria = visitSearchCriteria;

            //            AutomatedFax.SearchVisits ocall = new SearchVisits();
            //            visitSearchResponse = ocall.GetVisitsFromSearch(visitSearchRequest, "192.168.192.11");

            //This is the call for the Care Provider Search
            ContractBuilderProviderSearch oBuilderProviderSearch = new ContractBuilderProviderSearch();
            //            Greenway.PrimeSuite.DataContracts.Person.CareProvider.CareProviderSearchRequest careProviderSearchRequest = new Greenway.PrimeSuite.DataContracts.Person.CareProvider.CareProviderSearchRequest();
            //            Greenway.PrimeSuite.DataContracts.Person.CareProvider.CareProviderSearchResponse careProviderSearchResponse = new Greenway.PrimeSuite.DataContracts.Person.CareProvider.CareProviderSearchResponse();
            //            careProviderSearchRequest = oBuilderProviderSearch.BuildProviderSearchRequest();
            //            //oBuilderProviderSearch.BuildProviderSearchRequest
            //            careProviderSearchRequest.CareProviderID = 1671;
            //            AutomatedFax.SearchProviders ocallSearchProviders = new SearchProviders();
            //            careProviderSearchResponse = ocallSearchProviders.GetProvidersFromSearch(careProviderSearchRequest, "192.168.192.11");

            //This is the call for Call Document Type
            //            ContractBuilderDocumentTypeSearch oBuilderDocumentTypeSearch = new ContractBuilderDocumentTypeSearch();
            //            Greenway.PrimeSuite.DataContracts.SystemAdmin.DocumentTypeSearchRequest documentTypeSearchRequest = new Greenway.PrimeSuite.DataContracts.SystemAdmin.DocumentTypeSearchRequest();
            //            Greenway.PrimeSuite.DataContracts.SystemAdmin.DocumentTypeSearchResponse documentTypeSearchResponse = new Greenway.PrimeSuite.DataContracts.SystemAdmin.DocumentTypeSearchResponse();
            //            documentTypeSearchRequest = oBuilderDocumentTypeSearch.BuildDocumentTypeSearchRequest();
            //            AutomatedFax.SearchDocumentType ocallSearchDocumentType = new SearchDocumentType();
            //            documentTypeSearchResponse = ocallSearchDocumentType.GetDocumentTypeFromSearch(documentTypeSearchRequest, "192.168.192.11");

            //This is the call for Document List Search 2
            //            ContractBuilderDocumentSearch oBuilderDocumentSearch = new ContractBuilderDocumentSearch();
            //            Greenway.PrimeSuite.DataContracts.Document.DocumentListSearchRequest2 documentListSearchRequest = new Greenway.PrimeSuite.DataContracts.Document.DocumentListSearchRequest2();
            //            Greenway.PrimeSuite.DataContracts.Document.DocumentListSearchResponse documentListSearchResponse = new Greenway.PrimeSuite.DataContracts.Document.DocumentListSearchResponse();
            //            documentListSearchRequest = oBuilderDocumentSearch.BuildDocumentSearchRequest();
            //            AutomatedFax.SearchDocumentSearch ocallSearchDocument = new SearchDocumentSearch();
            //            documentListSearchResponse = ocallSearchDocument.GetDocumentFromSearch(documentListSearchRequest, "192.168.192.11");

            //This is the call for Document Get
            //ContractBuilderDocumentGet oBuilderDocumentGet = new ContractBuilderDocumentGet();
            //Greenway.PrimeSuite.DataContracts.Document.DocumentGetRequest documentGetRequest = new Greenway.PrimeSuite.DataContracts.Document.DocumentGetRequest();
            //Greenway.PrimeSuite.DataContracts.Document.DocumentGetResponse documentGetResponse = new Greenway.PrimeSuite.DataContracts.Document.DocumentGetResponse();
            //documentGetRequest = oBuilderDocumentGet.BuildDocumentGethRequest();
            //AutomatedFax.SearchDocumentGet ocallGetDocument = new SearchDocumentGet();
            //documentGetResponse = ocallGetDocument.GetDocumentListFromSearch(documentGetRequest, "192.168.192.11");

            string s1 = string.Empty;
        }
Esempio n. 37
0
        public string MoveLocalToServerFile(string fileName, string batchId, string localStoragePath, string serverStoragePath, int orderNo, string partNo)
        {
            string        fileDiskNameResult = "";
            DirectoryInfo Localdirectory     = new DirectoryInfo(localStoragePath);

            if (!Localdirectory.Exists)
            {
                Localdirectory = Directory.CreateDirectory(localStoragePath);
            }
            if (!Directory.Exists(serverStoragePath))
            {
                Directory.CreateDirectory(serverStoragePath);
            }
            //Move Step 6 file to Upload Batch folder
            string UploadBatchPath = ConfigurationManager.AppSettings["TempStorageDirectory"].ToString() + "/" + orderNo + "/" + partNo.Replace(",", "-");

            if (!Directory.Exists(UploadBatchPath))
            {
                Directory.CreateDirectory(UploadBatchPath);
            }
            foreach (var file in Localdirectory.GetFiles("*" + batchId + "_" + fileName + "*"))
            {
                var    objFile     = file.Name.Split('_');
                string objFileName = string.Empty;
                if (objFile.Length > 3)
                {
                    for (int i = 0; i < objFile.Length; i++)
                    {
                        if (i > 1)
                        {
                            objFileName += objFile[i] + "_";
                        }
                    }
                    objFileName = objFileName.Trim('_');
                }
                else
                {
                    objFileName = objFile[2];
                }


                if (objFile.Length > 0 && objFile[1] == batchId && objFileName == fileName)
                {
                    string             fileType = file.Extension;
                    Aspose.Pdf.License license  = new Aspose.Pdf.License();
                    license.SetLicense("Aspose.Pdf.lic");

                    Aspose.Words.License license1 = new Aspose.Words.License();
                    license1.SetLicense("Aspose.Words.lic");

                    string fileDiskName = Guid.NewGuid().ToString();
                    if (fileType.ToUpper() == ".DOC" || fileType.ToUpper() == ".DOCX")
                    {
                        fileDiskName += ".pdf";
                        Aspose.Words.Document doc = new Aspose.Words.Document(file.FullName);
                        doc.Save(Path.Combine(serverStoragePath, fileDiskName));
                        doc.Save(Path.Combine(UploadBatchPath, fileDiskName));
                    }
                    else if (fileType.ToUpper() == ".PDF")
                    {
                        fileDiskName += ".pdf";
                        Aspose.Pdf.Document doc = new Aspose.Pdf.Document(file.FullName);
                        doc.Save(Path.Combine(serverStoragePath, fileDiskName));
                        doc.Save(Path.Combine(UploadBatchPath, fileDiskName));
                    }
                    else
                    {
                        fileDiskName += file.Extension;
                        file.CopyTo(Path.Combine(serverStoragePath, fileDiskName));
                        file.CopyTo(Path.Combine(UploadBatchPath, fileDiskName));
                    }
                    fileDiskNameResult = fileDiskName;
                    //file.Delete();
                }
            }
            return(fileDiskNameResult);
        }
 private static void LoadLicense(string ext)
 {
     switch (ext)
     {
         case ".PDF":
             var pdfLicense = new Aspose.Pdf.License();
             pdfLicense.SetLicense("Aspose.Total.lic");
             break;
         case ".DOC":
         case ".DOCX":
         case ".RTF":
             var docLicense = new Aspose.Words.License();
             docLicense.SetLicense("Aspose.Total.lic");
             break;
         case ".XLS":
         case ".XLSX":
         case ".CSV":
             var xlsLicense = new Aspose.Cells.License();
             xlsLicense.SetLicense("Aspose.Total.lic");
             break;
         case ".PPT":
         case ".PPTX":
             var pptLicense = new Aspose.Slides.License();
             pptLicense.SetLicense("Aspose.Total.lic");
             break;
         case ".VSD":
         case ".VSDX":
             var vsdLicense = new Aspose.Diagram.License();
             vsdLicense.SetLicense("Aspose.Total.lic");
             break;
         case ".MSG":
             var emaiLicense = new Aspose.Email.License();
             var msgPdfLicense = new Aspose.Words.License();
             emaiLicense.SetLicense("Aspose.Total.lic");
             msgPdfLicense.SetLicense("Aspose.Total.lic");
             break;
         default:
             var license = new Aspose.Words.License();
             license.SetLicense("Aspose.Total.lic");
             break;
     }
 }
Esempio n. 39
0
 ///<Summary>
 /// SetAsposePdfLicense method to Aspose.PDF License
 ///</Summary>
 public static void SetAsposePdfLicense()
 {
     Aspose.Pdf.License awLic = new Aspose.Pdf.License();
     awLic.SetLicense("Aspose.Total.lic");
 }
Esempio n. 40
0
        public override void Execute(Action onSuccess, Action <Exception> onFailure)
        {
            try
            {
                StorageCredentials  storageCredentials      = new StorageCredentials(System.Environment.GetEnvironmentVariable("StorageAccountName", EnvironmentVariableTarget.Process), System.Environment.GetEnvironmentVariable("StorageKeyVault", EnvironmentVariableTarget.Process));
                CloudStorageAccount account                 = new CloudStorageAccount(storageCredentials, useHttps: true);
                CloudBlobClient     storageClient           = account.CreateCloudBlobClient();
                CloudBlobContainer  storageSupportContainer = storageClient.GetContainerReference("support");

                CloudBlockBlob blob = storageSupportContainer.GetBlockBlobReference("Aspose.Total.lic");
                blob.FetchAttributes();
                long   fileByteLength = blob.Properties.Length;
                Byte[] b = new Byte[fileByteLength];
                blob.DownloadToByteArray(b, 0);

                SharedFilesConfiguration.Current.AsposeLicense = b;

                blob = storageSupportContainer.GetBlockBlobReference("ETA_Form_9061_English_FINAL_11_(expires_January_31,2020).pdf");
                blob.FetchAttributes();
                fileByteLength = blob.Properties.Length;
                b = new Byte[fileByteLength];
                blob.DownloadToByteArray(b, 0);

                SharedFilesConfiguration.Current.Form9061 = b;

                blob = storageSupportContainer.GetBlockBlobReference("8850-page2.docx");
                blob.FetchAttributes();
                fileByteLength = blob.Properties.Length;
                b = new Byte[fileByteLength];
                blob.DownloadToByteArray(b, 0);

                SharedFilesConfiguration.Current.Form8850Page2 = b;

                blob = storageSupportContainer.GetBlockBlobReference("WOTCCover.docx");
                blob.FetchAttributes();
                fileByteLength = blob.Properties.Length;
                b = new Byte[fileByteLength];
                blob.DownloadToByteArray(b, 0);

                SharedFilesConfiguration.Current.CoverLetter = b;

                Aspose.Words.License wordsLicense = new Aspose.Words.License();
                wordsLicense.SetLicense(new MemoryStream(SharedFilesConfiguration.Current.AsposeLicense));

                Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
                pdfLicense.SetLicense(new MemoryStream(SharedFilesConfiguration.Current.AsposeLicense));

                string filename = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}.pdf",
                                                State,
                                                StartDate.Month,
                                                StartDate.Day,
                                                StartDate.Year,
                                                EndDate.Month,
                                                EndDate.Day,
                                                EndDate.Year,
                                                DateTime.Now.Ticks);

                MongoClient    client   = new MongoClient(System.Environment.GetEnvironmentVariable("ScreeningCosmosDb", EnvironmentVariableTarget.Process));
                IMongoDatabase database = client.GetDatabase("Screening");
                IMongoCollection <BsonDocument> collection = database.GetCollection <BsonDocument>("Screening");

                if (Screenings != null)
                {
                    Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();

                    foreach (var screening in Screenings.OrderBy(s => s.Applicant.LastName + "_" + s.Applicant.FirstName))
                    {
                        Aspose.Pdf.Document form8850Pdf = new Aspose.Pdf.Document(RenderIRSForm8850Page2(screening));
                        pdfDocument.Pages.Add(form8850Pdf.Pages);

                        Aspose.Pdf.Document form9061Pdf = new Aspose.Pdf.Document(RenderIRSForm9061(screening));
                        pdfDocument.Pages.Add(form9061Pdf.Pages);

                        var jsonObject = JObject.FromObject(screening);

                        jsonObject.Add("Type", "StateSubmissionRecord");
                        jsonObject.Add("State", State);
                        jsonObject.Add("DatePrepared", DateTime.Now.ToString());
                        jsonObject.Add("FileProduced", string.Empty);
                        jsonObject.Add("DateSent", string.Empty);
                        jsonObject.Add("DateValidated", string.Empty);
                        jsonObject.Add("OutputFile", filename);

                        collection.InsertOne(
                            MongoDB.Bson.Serialization.BsonSerializer.Deserialize <BsonDocument>(jsonObject.ToString()));
                    }

                    Aspose.Pdf.Document wotcCoverPdf = new Aspose.Pdf.Document(RenderCoverLetter("Address Goes Here", "Salutation Goes Here", Screenings));
                    pdfDocument.Pages.Add(wotcCoverPdf.Pages);

                    MemoryStream stream = new MemoryStream();
                    pdfDocument.Save(stream);

                    CloudBlobContainer storagePackageContainer = storageClient.GetContainerReference("statepackages");
                    storagePackageContainer.CreateIfNotExists(BlobContainerPublicAccessType.Off);

                    blob = storagePackageContainer.GetBlockBlobReference(filename);

                    if (stream.Length == 0)
                    {
                        return;
                    }
                    blob.UploadFromStream(stream, stream.Length, null, null, null);
                }

                string filter = string.Format("{{ Type: 'StateSubmissionRecord', OutputFile : '{0}'}}", filename);
                var    update = Builders <BsonDocument> .Update.Set("FileProduced", DateTime.Now.ToString());

                collection.UpdateMany(filter, update);
            }
            catch (Exception e)
            {
                onFailure(e);
            }

            onSuccess();
        }
        public BaseApiResponse UploadDocument(int CompanyNo)
        {
            var response      = new BaseApiResponse();
            int FileversionID = 0;

            try
            {
                var modal = HttpContext.Current.Request.Form[0];
                var data  = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(modal);
                if (data == null)
                {
                    response.Success = false;
                }
                bool isFileUploaded = HttpContext.Current.Request.Files.AllKeys.Any();
                int  rcvdid         = 0;
                if (Convert.ToInt32(data["PartNo"]) > 0 && Convert.ToInt32(data["FileTypeId"]) == 11)
                {
                    if (Convert.ToInt32(data["RecordTypeId"]) != 41 && Convert.ToInt32(data["RecordTypeId"]) != 137)
                    {
                        int compdateResult = 0;
                        try
                        {
                            SqlParameter[] paramCompDate = { new SqlParameter("OrderId", (object)Convert.ToInt32(data["OrderId"]) ?? (object)DBNull.Value)
                                                             ,                           new SqlParameter("PartNo", (object)Convert.ToInt32(data["PartNo"]) ?? (object)DBNull.Value) };
                            compdateResult = _repository.ExecuteSQL <int>("UpdateCompDate", paramCompDate).FirstOrDefault();
                        }
                        catch (Exception ex)
                        {
                        }
                    }


                    try
                    {
                        SqlParameter[] param = { new SqlParameter("OrderId", (object)Convert.ToInt32(data["OrderId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("PartNo", (object)Convert.ToInt32(data["PartNo"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("RecordTypeId", (object)Convert.ToInt32(data["RecordTypeId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("PageNo", (object)Convert.ToInt32(data["PageNo"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("EmpId", (object)data["EmpId"].ToString() ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("isFileUploaded", (object)isFileUploaded ?? (object)DBNull.Value) };
                        rcvdid = _repository.ExecuteSQL <int>("InsertFileRCVD", param).FirstOrDefault();
                    }
                    catch (Exception ex)
                    {
                    }
                }

                string tempPath   = ConfigurationManager.AppSettings["TempStorageDirectory"].ToString();
                string serverPath = ConfigurationManager.AppSettings["UploadRoot"].ToString();
                string subFolder  = Convert.ToInt32(data["PartNo"]) <= 0 ? "/" + data["OrderId"].ToString() : "/" + data["OrderId"].ToString() + "/" + data["PartNo"].ToString();
                serverPath += subFolder;
                if (!Directory.Exists(serverPath))
                {
                    Directory.CreateDirectory(serverPath);
                }
                string tempFullPath = tempPath + subFolder;
                if (!Directory.Exists(tempFullPath))
                {
                    Directory.CreateDirectory(tempFullPath);
                }
                Guid CreatedByGUID = new Guid(data["CreatedBy"].ToString());
                int  RecordTypeID  = 0;

                try
                {
                    RecordTypeID = Convert.ToInt32(data["RecordTypeId"]);
                }
                catch (Exception Ex)
                {
                }



                if (HttpContext.Current.Request.Files.AllKeys.Any())
                {
                    for (int i = 0; i < HttpContext.Current.Request.Files.Count; i++)
                    {
                        var    httpPostedFile = HttpContext.Current.Request.Files[i];
                        string FileExtension  = System.IO.Path.GetExtension(httpPostedFile.FileName);
                        string fileType       = FileExtension;
                        string FileName       = httpPostedFile.FileName;
                        string fileGuid       = Guid.NewGuid().ToString();

                        string fDiskName = fileGuid + FileExtension;
                        httpPostedFile.SaveAs(tempPath + "/" + subFolder + "/" + fileGuid + FileExtension);
                        if (!string.IsNullOrEmpty(FileExtension) && (FileExtension.ToUpper() == ".DOC" || FileExtension.ToUpper() == ".DOCX"))
                        {
                            FileExtension = ".Pdf";
                        }
                        string FileDiskName = fileGuid + FileExtension;   //DateTime.Now.ToString("yyyyMMddHHmmssfff")


                        SqlParameter[] param = { new SqlParameter("OrderId", (object)Convert.ToInt32(data["OrderId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("PartNo", (object)Convert.ToInt32(data["PartNo"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("FileName", (object)FileName ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("FileTypeId", (object)Convert.ToInt32(data["FileTypeId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("IsPublic", (object)Convert.ToBoolean(data["IsPublic"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("RecordTypeId", (object)Convert.ToInt32(data["RecordTypeId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("FileDiskName", (object)FileDiskName ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("PageNo", (object)Convert.ToInt32(data["PageNo"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("CreatedBy", (object)CreatedByGUID ?? (object)DBNull.Value) };

                        var result = _repository.ExecuteSQL <int>("InsertFile", param).FirstOrDefault();
                        FileversionID = result;
                        if (result > 0)
                        {
                            FileDiskName            = fDiskName;
                            FileExtension           = fileType;
                            response.lng_InsertedId = result;
                            response.Success        = true;

                            #region SaveFileTypeRecordBillFirm
                            SqlParameter[] paramBillFirm  = { new SqlParameter("OrderId", (object)Convert.ToInt32(data["OrderId"]) ?? (object)DBNull.Value) };
                            var            resultbillFirm = _repository.ExecuteSQL <FileTypeRecordBillFirm>("GetDetailforFileTypeRecordBillFirm", paramBillFirm).FirstOrDefault();
                            if (resultbillFirm != null)//(Convert.ToInt32(data["RecordTypeId"]) != 0)
                            {
                                string AttyName = resultbillFirm.AttorneyName;
                                string BillFirm = resultbillFirm.OrderingFirmID;
                                string ClaimNo  = resultbillFirm.BillingClaimNo;
                                if (BillFirm == null || BillFirm == "")
                                {
                                    // continue;
                                }
                                System.IO.MemoryStream ms = new System.IO.MemoryStream();


                                Aspose.Pdf.License license = new Aspose.Pdf.License();
                                license.SetLicense("Aspose.Pdf.lic");

                                Aspose.Words.License license1 = new Aspose.Words.License();
                                license1.SetLicense("Aspose.Words.lic");
                                string tmpFullPath = tempPath + "/" + subFolder + "/" + FileDiskName;

                                if (!string.IsNullOrEmpty(FileExtension) && FileExtension.ToUpper() == ".DOC" || FileExtension.ToUpper() == ".DOCX")
                                {
                                    Aspose.Words.Document doc = new Aspose.Words.Document((tmpFullPath));
                                    doc.Save(Path.Combine(serverPath, fileGuid + ".pdf"));
                                    File.Delete((tmpFullPath));
                                }
                                else if (!string.IsNullOrEmpty(FileExtension) && FileExtension.ToUpper() == ".PDF")
                                {
                                    Aspose.Pdf.Document doc = new Aspose.Pdf.Document((tmpFullPath));
                                    doc.Save(Path.Combine(serverPath, fileGuid + ".pdf"));
                                    File.Delete((tmpFullPath));
                                }
                                else
                                {
                                    File.Copy((tmpFullPath), Path.Combine(serverPath, FileDiskName));
                                    File.Delete((tmpFullPath));
                                }

                                string TStamp       = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                                string _storageRoot = string.Empty;
                                string FilePath     = string.Empty;

                                if (ClaimNo == "")
                                {
                                    ClaimNo = "0";
                                }
                                if (FileExtension == "doc" || FileExtension == "DOC" || FileExtension == "docx" || FileExtension == "DOCX")
                                {
                                    FileExtension = "pdf";
                                }

                                if (BillFirm == "GRANCO01")
                                {
                                    _storageRoot = ConfigurationManager.AppSettings["GrangeRoot"].ToString();
                                    FilePath     = _storageRoot + string.Format("{0}-{1}-{2}-{3}", ClaimNo, TStamp, data["OrderId"].ToString(), data["PartNo"].ToString() + "." + FileExtension);
                                }
                                if (BillFirm == "HANOAA01")
                                {
                                    _storageRoot = ConfigurationManager.AppSettings["HanoverRoot"].ToString();
                                    FilePath     = _storageRoot + string.Format("{0}_{1}_{2}_{3}-{4}", ClaimNo, AttyName, TStamp, data["OrderId"].ToString(), data["PartNo"].ToString() + "." + FileExtension);
                                }
                                if (BillFirm == "GRANCO01" || BillFirm == "HANOAA01")
                                {
                                    System.IO.DirectoryInfo dis = new System.IO.DirectoryInfo(_storageRoot);
                                    if (!dis.Exists)
                                    {
                                        dis.Create();
                                    }
                                    int    count        = 1;
                                    string fileNameOnly = Path.GetFileNameWithoutExtension(FilePath);
                                    string extension    = Path.GetExtension(FilePath);
                                    string path         = Path.GetDirectoryName(FilePath);
                                    string newFullPath  = FilePath;

                                    while (System.IO.File.Exists(newFullPath))
                                    {
                                        string tempFileName = string.Format("{0}({1})", fileNameOnly, count++);
                                        newFullPath = Path.Combine(path, tempFileName + extension);
                                    }

                                    FileStream fs = new FileStream(newFullPath, FileMode.Create, FileAccess.Write);
                                    ms.WriteTo(fs);
                                    fs.Close();
                                }
                            }
                            #endregion
                        }
                    }
                    Directory.Delete((tempPath + "/" + data["OrderId"].ToString()), true);



                    //TODO:Send Email
                    //http://localhost:51617/Secured/Data/GetMRBillingData.aspx/SendMailOnUploadDocument
                    try
                    {
                        BillingApiController bc = new BillingApiController();
                        int OrderID             = Convert.ToInt32(data["OrderId"]);
                        int PartNo = Convert.ToInt32(data["PartNo"]);
                        ApiResponse <BillToAttorneyDetailsEntity> objBillToDetails = bc.GetBillToAttorneyDetailsByOrderId(OrderID.ToString(), PartNo.ToString());
                        ApiResponse <SoldToAttorneyDetailsEntity> objSoldToDetails = bc.GetSoldToAttorneyDetailsByOrderId(OrderID.ToString(), PartNo.ToString());

                        ApiResponse <BillToAttorneyEntity> objBillToAttorney = new ApiResponse <BillToAttorneyEntity>();
                        ApiResponse <BillToAttorneyEntity> objSoldtoAttorney = new ApiResponse <BillToAttorneyEntity>();

                        if (objSoldToDetails.Data.Count > 0)
                        {
                            objSoldtoAttorney = bc.GetSoldToAttorneyByOrderNo(OrderID.ToString(), PartNo.ToString());
                        }

                        if (objBillToDetails.Data.Count > 0)
                        {
                            objBillToAttorney = bc.GetBillToAttorneyByFirmId(objBillToDetails.Data[0].BillingFirmID);
                        }
                        string strBilltoAttorney = objBillToAttorney.Data.Count > 0 ? objBillToAttorney.Data[0].AttyId : "";

                        List <SoldAttorneyEntity> soldAttorneyList = new List <SoldAttorneyEntity>();


                        foreach (var item in objSoldtoAttorney.Data)
                        {
                            soldAttorneyList.Add(new SoldAttorneyEntity {
                                AttyId = item.AttyId, AttyType = "Ordering"
                            });
                        }

                        bc.GenerateInvoice(OrderID, PartNo, strBilltoAttorney, CompanyNo, soldAttorneyList, RecordTypeID, FileversionID);
                    }
                    catch (Exception ex)
                    {
                        Log.ServicLog("========== GENERATE BILL AFTER UPLOADING DOCUMENT ==================");
                        Log.ServicLog(ex.ToString());
                    }
                }

                // GENERATE BILL FOR THESE RECORD TYPE EVEN IF NO FILE IS UPLOADED
                // RecordTypeID = 50(Cd Of Films)
                // RecordTypeID = 41(Cancelled)
                // RecordTypeID = 168(Custodian Fee)
                else if (isFileUploaded || RecordTypeID == 50 || RecordTypeID == 41 || RecordTypeID == 168)
                {
                    #region --- GENERATE BILL ---
                    try
                    {
                        BillingApiController bc = new BillingApiController();
                        int OrderID             = Convert.ToInt32(data["OrderId"]);
                        int PartNo = Convert.ToInt32(data["PartNo"]);
                        ApiResponse <BillToAttorneyDetailsEntity> objBillToDetails = bc.GetBillToAttorneyDetailsByOrderId(OrderID.ToString(), PartNo.ToString());
                        ApiResponse <SoldToAttorneyDetailsEntity> objSoldToDetails = bc.GetSoldToAttorneyDetailsByOrderId(OrderID.ToString(), PartNo.ToString());

                        ApiResponse <BillToAttorneyEntity> objBillToAttorney = new ApiResponse <BillToAttorneyEntity>();
                        ApiResponse <BillToAttorneyEntity> objSoldtoAttorney = new ApiResponse <BillToAttorneyEntity>();

                        if (objSoldToDetails.Data.Count > 0)
                        {
                            objSoldtoAttorney = bc.GetSoldToAttorneyByOrderNo(OrderID.ToString(), PartNo.ToString());
                        }

                        if (objBillToDetails.Data.Count > 0)
                        {
                            objBillToAttorney = bc.GetBillToAttorneyByFirmId(objBillToDetails.Data[0].BillingFirmID);
                        }
                        string strBilltoAttorney = objBillToAttorney.Data.Count > 0 ? objBillToAttorney.Data[0].AttyId : "";

                        List <SoldAttorneyEntity> soldAttorneyList = new List <SoldAttorneyEntity>();


                        foreach (var item in objSoldtoAttorney.Data)
                        {
                            soldAttorneyList.Add(new SoldAttorneyEntity {
                                AttyId = item.AttyId, AttyType = "Ordering"
                            });
                        }

                        bc.GenerateInvoice(OrderID, PartNo, strBilltoAttorney, CompanyNo, soldAttorneyList, RecordTypeID, FileversionID);
                    }
                    catch (Exception ex)
                    {
                        Log.ServicLog("========== GENERATE BILL AFTER UPLOADING DOCUMENT ==================");
                        Log.ServicLog(ex.ToString());
                    }

                    #endregion

                    response.Success = true;
                }


                #region Send Mail
                if (Convert.ToInt32(data["FileTypeId"]) == 11 && isFileUploaded)
                {
                    try
                    {
                        SqlParameter[] param = { new SqlParameter("OrderId", (object)Convert.ToInt64(data["OrderId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("PartNo", (object)Convert.ToInt32(data["PartNo"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("FileTypeId", (object)Convert.ToInt32(data["FileTypeId"]) ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("RecordTypeId", (object)Convert.ToInt32(data["RecordTypeId"]) ?? (object)DBNull.Value) };
                        var            result = _repository.ExecuteSQL <AssistContactEmail>("GetAssistContactEmailList", param).ToList();
                        if (result != null && result.Any(x => x.NewRecordAvailable))
                        {
                            CompanyDetailForEmailEntity objCompany = CommonFunction.CompanyDetailForEmail(CompanyNo);
                            string subject     = "Your Records Are Available " + Convert.ToString(data["OrderId"]) + "-" + Convert.ToString(data["PartNo"]);
                            string LiveSiteURL = ConfigurationManager.AppSettings["LiveSiteURL"].ToString();

                            foreach (AssistContactEmail item in result.Where(x => x.NewRecordAvailable && !string.IsNullOrEmpty(x.AssistantEmail)))
                            {
                                System.Text.StringBuilder body = new System.Text.StringBuilder();
                                using (System.IO.StreamReader reader = new System.IO.StreamReader(HttpContext.Current.Server.MapPath("~/MailTemplate/BillingRecords.html")))
                                {
                                    body.Append(reader.ReadToEnd());
                                }

                                body = body.Replace("{UserName}", "Hello " + item.AssistantName + ",");
                                body = body.Replace("{LOCATION}", item.LocationName + " (" + item.LocID + ")");
                                body = body.Replace("{PATIENT}", item.PatientName);
                                body = body.Replace("{CLAIMNO}", item.BillingClaimNo);
                                body = body.Replace("{ORDERNO}", data["OrderId"] + "-" + data["PartNo"]);
                                body = body.Replace("{InvHdr}", item.InvHdr);
                                body = body.Replace("{Pages}", Convert.ToString(data["PageNo"]));
                                body = body.Replace("{LINK}", Convert.ToString(objCompany.SiteURL) + "/PartDetail?OrderId=" + data["OrderId"] + "&PartNo=" + data["PartNo"]);
                                body = body.Replace("{LogoURL}", objCompany.Logopath);
                                body = body.Replace("{ThankYou}", objCompany.ThankYouMessage);
                                body = body.Replace("{CompanyName}", objCompany.CompName);
                                body = body.Replace("{Link}", objCompany.SiteURL);

                                EmailHelper.Email.Send(CompanyNo: objCompany.CompNo
                                                       , mailTo: item.AssistantEmail
                                                       , body: body.ToString()
                                                       , subject: subject
                                                       , ccMail: ""
                                                       , bccMail: "[email protected],[email protected]");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.ServicLog("========== Email for UPLOADING DOCUMENT ==================");
                        Log.ServicLog(ex.ToString());
                    }
                }
                #endregion
                #region Send Mail To Client Of Employee
                bool IsAttorneyLogin;

                try
                {
                    if (bool.TryParse(Convert.ToString(data["IsAttorneyLogin"]), out IsAttorneyLogin) && IsAttorneyLogin)
                    {
                        SqlParameter[] param        = { new SqlParameter("OrderId", (object)Convert.ToInt64(data["OrderId"]) ?? (object)DBNull.Value) };
                        var            clientOfUser = _repository.ExecuteSQL <AccntRepDetails>("GetClientOfEmailByOrderId", param).FirstOrDefault();
                        if (clientOfUser != null && !string.IsNullOrEmpty(clientOfUser.Email))
                        {
                            CompanyDetailForEmailEntity objCompany = CommonFunction.CompanyDetailForEmail(CompanyNo);

                            string subject     = "Document uploaded by client " + Convert.ToString(data["OrderId"]) + "-" + Convert.ToString(data["PartNo"]);
                            string LiveSiteURL = ConfigurationManager.AppSettings["LiveSiteURL"].ToString();

                            System.Text.StringBuilder body = new System.Text.StringBuilder();
                            using (System.IO.StreamReader reader = new System.IO.StreamReader(HttpContext.Current.Server.MapPath("~/MailTemplate/DocumentUploadedByClient.html")))
                            {
                                body.Append(reader.ReadToEnd());
                            }

                            body = body.Replace("{UserName}", clientOfUser.Name);
                            body = body.Replace("{ORDERNO}", data["OrderId"] + "-" + data["PartNo"]);
                            body = body.Replace("{LINK}", Convert.ToString(objCompany.SiteURL) + "/PartDetail?OrderId=" + data["OrderId"] + "&PartNo=" + data["PartNo"]);
                            body = body.Replace("{LogoURL}", objCompany.Logopath);
                            body = body.Replace("{ThankYou}", objCompany.ThankYouMessage);
                            body = body.Replace("{CompanyName}", objCompany.CompName);
                            body = body.Replace("{Link}", objCompany.SiteURL);

                            EmailHelper.Email.Send(CompanyNo: objCompany.CompNo
                                                   , mailTo: clientOfUser.Email
                                                   , body: body.ToString()
                                                   , subject: subject
                                                   , ccMail: ""
                                                   , bccMail: "[email protected],[email protected]");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.ServicLog("========== Email for UPLOADING DOCUMENT ==================");
                    Log.ServicLog(ex.ToString());
                }
                #endregion
                if (!isFileUploaded)
                {
                    response.Success = true;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }

            return(response);
        }