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); } }
public IHttpActionResult PalletsIndexPrinterFriendly() { try { // create report object, Url is the public location where it can be viewed with a browser Report report = new Report(); report.Name = "PalletsIndexPrinterFriendly"; report.Filename = "PalletsIndexPrinterFriendly"; 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.PalletsIndexPrinterFriendly = " + e.Message, e); AppCommon.Log(message, EventLogEntryType.Error); throw new Exception(message); } } // PalletsIndexPrinterFriendly()
// 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); } }