Ejemplo n.º 1
0
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         EventLogManager.CreateEventLog();
         EventLogManager.WriteEventLog(@"App Engine " + Process.GetCurrentProcess().ProcessName + @" starting - " + DateTime.Now.ToString(), EventLogEntryType.Information, 1);
         Application.Run(new Form1(Process.GetCurrentProcess().ProcessName));
         EventLogManager.WriteEventLog(@"App Engine " + Process.GetCurrentProcess().ProcessName + @" exiting - " + DateTime.Now.ToString(), EventLogEntryType.Information, 3);
         ReportManager.app.Quit();
     }
     catch (Exception e)
     {
         string message = AppCommon.AppendInnerExceptionMessages("ERROR: Could not start AppEngine - " + e.Message, e);
         if (message.ToUpper().Contains("NOT ALLOWED"))
         {
             message += " - Make sure the AppEngine is running with Administrator privledges.";
         }
         MessageBox.Show(message, "App Engine Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
 public IHttpActionResult AdsIndexPrinterFriendly()
 {
     try
     {
         // create report object, Url is the public location where it can be viewed with a browser
         Report report = new Report();
         report.Name       = "AdsIndexPrinterFriendly";
         report.Filename   = "AdsIndexPrinterFriendly";
         report.SaveFormat = WdSaveFormat.wdFormatPDF;
         report.Extension  = AppCommon.GetExtensionFromWdSaveFormat(report.SaveFormat);
         report.Url        = AppCommon.BuildUrl(AppCommon.GetAppEngineUrl(), report.Filename + "." + AppCommon.GetExtensionFromWdSaveFormat(report.SaveFormat), AppCommon.GetAppEnginePort());
         // generate the report
         ReportManager.GenerateReport(report);
         // return the report properties
         return(Ok(report));
     }
     catch (Exception e)
     {
         string message = AppCommon.AppendInnerExceptionMessages("ReportsController.AdsIndexPrinterFriendly = " + e.Message, e);
         AppCommon.Log(message, EventLogEntryType.Error);
         throw new Exception(message);
     }
 } // AdsIndexPrinterFriendly()
Ejemplo n.º 3
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        public void Configuration(IAppBuilder app)
        {
            try
            {
                // configure webapi
                HttpConfiguration config = new HttpConfiguration();
                config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
                config.MapHttpAttributeRoutes();
                config.Routes.MapHttpRoute(
                    name: "DefaultApi",
                    routeTemplate: "api/{controller}/{id}",
                    defaults: new { id = RouteParameter.Optional }
                    );
                app.UseWebApi(config);

                // setup fileserver
                string fileSaveDirectory = AppCommon.GetFileSaveDirectory();
                Directory.CreateDirectory(fileSaveDirectory);
                if (!Directory.Exists(fileSaveDirectory))
                {
                    throw new Exception("Invalid FileSaveDirectory specified <" + fileSaveDirectory + ">.");
                }
                else
                {
                    FileServerOptions fsOptions = new FileServerOptions();
                    fsOptions.RequestPath = PathString.Empty;
                    fsOptions.FileSystem  = new PhysicalFileSystem(fileSaveDirectory);
                    app.UseFileServer(fsOptions);
                }
            }
            catch (Exception e)
            {
                string message = AppCommon.AppendInnerExceptionMessages("Configuration: " + e.Message, e);
                throw new Exception(message);
            }
        }