// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var conn = Configuration.GetConnectionString("conn"); services.AddDbContext <MyDBContext>( op => op.UseSqlServer(conn)); var authconn = Configuration.GetConnectionString("authconn"); services.AddDbContext <ApplicationAuthContext>( op => op.UseSqlServer(authconn)); services.AddIdentity <security.User, security.Role>() .AddEntityFrameworkStores <ApplicationAuthContext>() .AddDefaultTokenProviders(); ApplicationSetup.RegisterServices(services); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddLogging(); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Flight_Booking", Version = "v1" }); }); }
/// <summary> /// Clears all settings, and makes the setting object reflect the schedule /// </summary> /// <param name="schedule">The schedule to reflect</param> public void ReflectSchedule(Datamodel.Schedule schedule) { MainAction action = this.PrimayAction; System.Data.LightDatamodel.IDataFetcherWithRelations connection = this.DataConnection; m_settings.Clear(); this.ScheduleID = schedule.ID; this.ScheduleName = schedule.Name; this.SchedulePath = schedule.Path; this.SourcePath = schedule.Task.SourcePath; this.EncodedFilterXml = schedule.Task.FilterXml; this.BackupPassword = schedule.Task.Encryptionkey; this.Backend = schedule.Task.Service; this.BackendSettings = new Dictionary <string, string>(schedule.Task.BackendSettingsLookup); this.BackupTimeOffset = schedule.When; this.RepeatInterval = schedule.Repeat; this.AllowedWeekdays = schedule.AllowedWeekdays; this.FullBackupInterval = schedule.Task.FullAfter; this.MaxFullBackups = (int)schedule.Task.KeepFull; this.BackupExpireInterval = schedule.Task.KeepTime; this.UploadSpeedLimit = schedule.Task.Extensions.UploadBandwidth; this.DownloadSpeedLimit = schedule.Task.Extensions.DownloadBandwidth; this.BackupSizeLimit = schedule.Task.Extensions.MaxUploadSize; this.VolumeSize = schedule.Task.Extensions.VolumeSize; this.ThreadPriority = schedule.Task.Extensions.ThreadPriority; this.AsyncTransfer = schedule.Task.Extensions.AsyncTransfer; this.EncryptionModule = schedule.Task.EncryptionModule; this.IncludeSetup = schedule.Task.IncludeSetup; this.IgnoreFileTimestamps = schedule.Task.Extensions.IgnoreTimestamps; this.FileSizeLimit = schedule.Task.Extensions.FileSizeLimit; this.DisableAESFallbackEncryption = schedule.Task.Extensions.DisableAESFallbackDecryption; //Handle the "Select Files" portion this.SelectFilesUI.Version = schedule.Task.Extensions.SelectFiles_Version; this.SelectFilesUI.UseSimpleMode = schedule.Task.Extensions.SelectFiles_UseSimpleMode; this.SelectFilesUI.IncludeDocuments = schedule.Task.Extensions.SelectFiles_IncludeDocuments; this.SelectFilesUI.IncludeDesktop = schedule.Task.Extensions.SelectFiles_IncludeDesktop; this.SelectFilesUI.IncludeMusic = schedule.Task.Extensions.SelectFiles_IncludeMusic; this.SelectFilesUI.IncludeImages = schedule.Task.Extensions.SelectFiles_IncludeImages; this.SelectFilesUI.IncludeSettings = schedule.Task.Extensions.SelectFiles_IncludeAppData; this.SelectWhenUI.HasWarnedNoSchedule = schedule.Task.Extensions.SelectWhen_WarnedNoSchedule; this.SelectWhenUI.HasWarnedTooManyIncremental = schedule.Task.Extensions.SelectWhen_WarnedTooManyIncrementals; this.SelectWhenUI.HasWarnedNoIncrementals = schedule.Task.Extensions.SelectWhen_WarnedNoIncrementals; this.PasswordSettingsUI.WarnedNoPassword = schedule.Task.Extensions.PasswordSettings_WarnedNoPassword; this.CleanupSettingsUI.HasWarnedClean = schedule.Task.Extensions.CleanupSettings_WarnedNoCleanup; this.Overrides = new Dictionary <string, string>(schedule.Task.TaskOverridesLookup); this.EncryptionSettings = new Dictionary <string, string>(schedule.Task.EncryptionSettingsLookup); this.CompressionSettings = new Dictionary <string, string>(schedule.Task.CompressionSettingsLookup); this.ApplicationSettings = ApplicationSetup.GetApplicationSettings(schedule.DataParent); this.PrimayAction = action; this.DataConnection = connection; }
/// <summary> /// Writes all values from the session object back into a schedule object /// </summary> /// <param name="schedule"></param> public void UpdateSchedule(Datamodel.Schedule schedule) { schedule.Name = this.ScheduleName; schedule.Path = this.SchedulePath; if (schedule.Task == null) { schedule.Task = schedule.DataParent.Add <Datamodel.Task>(); } schedule.Task.SourcePath = this.SourcePath; schedule.Task.FilterXml = this.EncodedFilterXml; schedule.Task.Encryptionkey = this.BackupPassword; schedule.Task.Service = this.Backend; SyncLookupTables(this.BackendSettings, schedule.Task.BackendSettingsLookup); schedule.When = this.BackupTimeOffset; schedule.Repeat = this.RepeatInterval; schedule.AllowedWeekdays = this.AllowedWeekdays; schedule.Task.FullAfter = this.FullBackupInterval; schedule.Task.KeepFull = this.MaxFullBackups; schedule.Task.KeepTime = this.BackupExpireInterval; schedule.Task.Extensions.UploadBandwidth = this.UploadSpeedLimit; schedule.Task.Extensions.DownloadBandwidth = this.DownloadSpeedLimit; schedule.Task.Extensions.MaxUploadSize = this.BackupSizeLimit; schedule.Task.Extensions.VolumeSize = this.VolumeSize; schedule.Task.Extensions.ThreadPriority = this.ThreadPriority; schedule.Task.Extensions.AsyncTransfer = this.AsyncTransfer; schedule.Task.EncryptionModule = this.EncryptionModule; schedule.Task.IncludeSetup = this.IncludeSetup; schedule.Task.Extensions.IgnoreTimestamps = this.IgnoreFileTimestamps; schedule.Task.Extensions.FileSizeLimit = this.FileSizeLimit; schedule.Task.Extensions.DisableAESFallbackDecryption = this.DisableAESFallbackEncryption; schedule.Task.Extensions.SelectFiles_Version = this.SelectFilesUI.Version; schedule.Task.Extensions.SelectFiles_UseSimpleMode = this.SelectFilesUI.UseSimpleMode; schedule.Task.Extensions.SelectFiles_IncludeDocuments = this.SelectFilesUI.IncludeDocuments; schedule.Task.Extensions.SelectFiles_IncludeDesktop = this.SelectFilesUI.IncludeDesktop; schedule.Task.Extensions.SelectFiles_IncludeMusic = this.SelectFilesUI.IncludeMusic; schedule.Task.Extensions.SelectFiles_IncludeImages = this.SelectFilesUI.IncludeImages; schedule.Task.Extensions.SelectFiles_IncludeAppData = this.SelectFilesUI.IncludeSettings; schedule.Task.Extensions.SelectWhen_WarnedNoSchedule = this.SelectWhenUI.HasWarnedNoSchedule; schedule.Task.Extensions.SelectWhen_WarnedTooManyIncrementals = this.SelectWhenUI.HasWarnedTooManyIncremental; schedule.Task.Extensions.SelectWhen_WarnedNoIncrementals = this.SelectWhenUI.HasWarnedNoIncrementals; schedule.Task.Extensions.PasswordSettings_WarnedNoPassword = this.PasswordSettingsUI.WarnedNoPassword; schedule.Task.Extensions.CleanupSettings_WarnedNoCleanup = this.CleanupSettingsUI.HasWarnedClean; SyncLookupTables(this.Overrides, schedule.Task.TaskOverridesLookup); SyncLookupTables(this.EncryptionSettings, schedule.Task.EncryptionSettingsLookup); SyncLookupTables(this.CompressionSettings, schedule.Task.CompressionSettingsLookup); ApplicationSetup.SaveExtensionSettings(schedule.DataParent, this.ApplicationSettings); }
public ActionResult CreateAPIKey() { if (ApplicationSetup.IsAPIKeyCreated()) { return(RedirectToAction("Step1")); } return(View(Commands.CreateAPIKey.NewRandom())); }
public ActionResult CreateAdmin() { if (ApplicationSetup.HasAdminUser()) { return(RedirectToAction("Step1")); } return(View(new CreateAdminAccount())); }
public static int Main(string[] args) { var container = ApplicationSetup.GetDefaultApplicationContainer(); using (var scope = container.BeginLifetimeScope()) { var application = scope.Resolve <IApplication>(); return(application.Start(args)); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); var conn = Configuration.GetConnectionString("conn"); services.AddDbContext <MyDatabaseContext>( op => op.UseSqlServer(conn)); var authconn = Configuration.GetConnectionString("conn"); services.AddDbContext <ApplicationAuthContext>( op => op.UseSqlServer(authconn)); //For Identity services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationAuthContext>() .AddDefaultTokenProviders(); //Adding Authentication services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; }) //Adding Jwt Bearer .AddJwtBearer(options => { options.SaveToken = true; options.RequireHttpsMetadata = false; options.TokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = true, ValidateAudience = true, //ValidateLifetime = true, //ValidateIssuerSigningKey = true, ValidAudience = Configuration["Jwt:ValidAudience"], ValidIssuer = Configuration["Jwt:ValidIssuer"], IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) }; }); ApplicationSetup.RegisterServices(services); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "FlightBooking", Version = "v1" }); }); }
private void RegisterAccount(CreateAdminAccount command) { ApplicationSetup.UpdateDatabaseToLatestSchema(); var createUserResult = Users.Handle(command); if (!createUserResult.Succeeded) { throw new Exception(string.Join("\n", createUserResult.Errors)); } }
private void DefAppSetup() { try { ApplicationSetup _appSetup = ObjectSpace.FindObject<ApplicationSetup> (CriteriaOperator.Parse("Name = 'Setup App 1'")); if (_appSetup == null) { _appSetup = ObjectSpace.CreateObject<ApplicationSetup>(); _appSetup.Name = "Setup App 1"; _appSetup.Code = "APS0001"; _appSetup.Active = true; _appSetup.DefaultSystem = true; //Numbering Header NumberingHeader _objNumberingHeader = new NumberingHeader(_appSetup.Session) { Code = "GN-0001", Name = "Group Numbering Object", NumberingType = NumberingType.Objects, Active = true, ApplicationSetup = _appSetup }; _objNumberingHeader = new NumberingHeader(_appSetup.Session) { Code = "GN-0002", Name = "Group Numbering Document", NumberingType = NumberingType.Documents, Active = true, ApplicationSetup = _appSetup }; //List Import ListImport _objListImport = new ListImport(_appSetup.Session) { No = 1, ObjectList = ObjectList.NumberingLine }; _objListImport = new ListImport(_appSetup.Session) { No = 2, ObjectList = ObjectList.ListImport }; ObjectSpace.CommitChanges(); } } catch (Exception ex) { Tracing.Tracer.LogError(ex); } }
static void Main() { ApplicationSetup.SetStartMenuItemAtTopLevel(); ApplicationSetup.CreateApplicationResourcesPath(); ApplicationSetup.CreateApplicationRegistry(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var form = new Form1(); TimeLicence.URL = "www.quantiseal.com"; TimeLicence.Protect(form); Application.Run(form); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var conn = Configuration.GetConnectionString("conn"); services.AddDbContext <BookingDatabaseContext>( op => op.UseSqlServer(conn)); ApplicationSetup.RegisterServices(services); services.AddControllers() .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "FlightBooking", Version = "v1" }); }); }
public ActionResult CreateAdmin(CreateAdminAccount command) { if (ApplicationSetup.HasAdminUser()) { ModelState.AddModelError("admin-already-exists", "Admin already exists"); } if (!ModelState.IsValid) { return(View(command)); } try { RegisterAccount(command); } catch (Exception e) { ModelState.AddModelError("exception", e); return(View(command)); } return(RedirectToRoute("setup")); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { ApplicationSetup.MigrateDatabase(app.ApplicationServices); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(); }
public ActionResult Step1() { if (!ApplicationSetup.IsDatabaseCreated()) { return(View()); } if (!ApplicationSetup.IsSchemaUpToDate()) { return(RedirectToAction("UpdateSchema")); } if (!ApplicationSetup.HasAdminUser()) { return(View()); } if (!ApplicationSetup.IsAPIKeyCreated()) { return(RedirectToAction("CreateAPIKey")); } return(RedirectToAction("ThankYou")); }
/// <summary> /// The purpose of this function is to set the default /// settings on the new backup. /// </summary> public void SetupDefaults() { m_settings.Clear(); ApplicationSettings appset = new ApplicationSettings(Program.DataConnection); if (appset.UseCommonPassword) { this.BackupPassword = appset.CommonPassword; this.EncryptionModule = appset.CommonPasswordEncryptionModule; } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Program), "Backup defaults.xml")); System.Xml.XmlNode root = doc.SelectSingleNode("settings"); List <System.Xml.XmlNode> nodes = new List <System.Xml.XmlNode>(); if (root != null) { foreach (System.Xml.XmlNode n in root.ChildNodes) { nodes.Add(n); } } //Load user supplied settings, if any string filename = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "Backup defaults.xml"); if (System.IO.File.Exists(filename)) { doc.Load(filename); root = doc.SelectSingleNode("settings"); if (root != null) { foreach (System.Xml.XmlNode n in root.ChildNodes) { nodes.Add(n); } } } foreach (System.Xml.XmlNode n in nodes) { if (n.NodeType == System.Xml.XmlNodeType.Element) { System.Reflection.PropertyInfo pi = this.GetType().GetProperty(n.Name); if (pi != null && pi.CanWrite) { if (pi.PropertyType == typeof(DateTime)) { pi.SetValue(this, Library.Utility.Timeparser.ParseTimeInterval(n.InnerText, DateTime.Now.Date), null); } else { pi.SetValue(this, Convert.ChangeType(n.InnerText, pi.PropertyType), null); } } } } this.ApplicationSettings = ApplicationSetup.GetApplicationSettings(Program.DataConnection); }
public void menu() { //setup application ApplicationSetup setup = new ApplicationSetup(); String source = "console"; //source value to pass to setup setup.Setup(source); //console app main menu Console.Out.Write("Welcome to the Calorie Counter \n" + "If it is your first time, you will need to set up goals before use \n" + "Please Make A Selection: \n" + "1: Get a Suggesstion \n" + "2: Set Goals \n" + "3: Use Calculator \n" + "4: View History \n\n"); //get user input, if input is invalid, restate the menu try { input = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.Out.Write("You Must Enter A Number\n\n"); menu(); } //directs user to dialogue based on input if (input > 0 && input < 5) { switch (input) { case 1: suggesstion = new SuggestionDialogue(); Console.Clear(); suggesstion.suggesstionMenu(); break; case 2: goals = new GoalEntryDialogue(); Console.Clear(); goals.enterGoals(); break; case 3: calculator = new CalculatorDialogue(); Console.Clear(); calculator.start(); break; case 4: history = new DisplayHistory(); Console.Clear(); history.display(); break; } } else //invalid input, restates menu { Console.Out.Write($"{input} is not a valid selection.\n\n"); menu(); } }
public void Application() { string dummyString; bool dummyBool; int dummyInt; Service service = Connect(); EntityCollection <Application> apps = service.GetApplications(); foreach (Application app in apps.Values) { try { ApplicationSetup applicationSetup = app.Setup(); string setupXml = applicationSetup.SetupXml; } catch (Exception) { // silent exception, if setup doesn't exist, exception occurs } ApplicationArchive applicationArchive = app.Archive(); dummyString = app.Author; dummyBool = app.CheckForUpdates; dummyString = app.Description; dummyString = app.Label; dummyBool = app.Refreshes; dummyString = app.Version; dummyBool = app.IsConfigured; if (service.VersionCompare("5.0") < 0) { dummyBool = app.IsManageable; } dummyBool = app.IsVisible; dummyBool = app.StateChangeRequiresRestart; ApplicationUpdate applicationUpdate = app.AppUpdate(); dummyString = applicationUpdate.Checksum; dummyString = applicationUpdate.ChecksumType; dummyString = applicationUpdate.Homepage; dummyInt = applicationUpdate.UpdateSize; dummyString = applicationUpdate.UpdateName; dummyString = applicationUpdate.AppUrl; dummyString = applicationUpdate.Version; dummyBool = applicationUpdate.IsImplicitIdRequired; } if (apps.ContainsKey("sdk-tests")) { service = this.CleanApp("sdk-tests", service); } apps = service.GetApplications(); Assert.IsFalse(apps.ContainsKey("sdk-tests"), assertRoot + "#1"); Args createArgs = new Args(); createArgs.Add("author", "me"); if (service.VersionCompare("4.2.4") >= 0) { createArgs.Add("configured", false); } createArgs.Add("description", "this is a description"); createArgs.Add("label", "SDKTEST"); if (service.VersionCompare("5.0") < 0) { createArgs.Add("manageable", false); } createArgs.Add("template", "barebones"); createArgs.Add("visible", false); apps.Create("sdk-tests", createArgs); Assert.IsTrue(apps.ContainsKey("sdk-tests"), assertRoot + "#2"); Application app2 = apps.Get("sdk-tests"); dummyBool = app2.CheckForUpdates; Assert.AreEqual("SDKTEST", app2.Label, assertRoot + "#3"); Assert.AreEqual("me", app2.Author, assertRoot + "#4"); Assert.IsFalse(app2.IsConfigured, assertRoot + "#5"); if (service.VersionCompare("5.0") < 0) { Assert.IsFalse(app2.IsManageable, assertRoot + "#6"); } Assert.IsFalse(app2.IsVisible, assertRoot + "#7"); // update the app app2.Author = "not me"; app2.Description = "new description"; app2.Label = "new label"; app2.IsVisible = false; if (service.VersionCompare("5.0") < 0) { app2.IsManageable = false; } app2.Version = "5.0.0"; app2.Update(); // check to see if args took. Assert.AreEqual("not me", app2.Author, assertRoot + "#8"); Assert.AreEqual("new description", app2.Description, assertRoot + "#9"); Assert.AreEqual("new label", app2.Label, assertRoot + "#10"); Assert.IsFalse(app2.IsVisible, assertRoot + "#11"); Assert.AreEqual("5.0.0", app2.Version, assertRoot + "#12"); // archive (package) the application ApplicationArchive appArchive = app2.Archive(); Assert.IsTrue(appArchive.AppName.Length > 0, assertRoot + "#13"); Assert.IsTrue(appArchive.FilePath.Length > 0, assertRoot + "#14"); Assert.IsTrue(appArchive.Url.Length > 0, assertRoot + "#15"); ApplicationUpdate appUpdate = app2.AppUpdate(); Assert.IsTrue(appUpdate.ContainsKey("eai:acl"), assertRoot + "#16"); service = this.CleanApp("sdk-tests", service); apps = service.GetApplications(); Assert.IsFalse(apps.ContainsKey("sdk-tests"), assertRoot + "#17"); }
protected ApplicationSetup GetObject(DataRow dr) { ApplicationSetup objApplicationSetup = new ApplicationSetup(); objApplicationSetup.Id = (dr["Id"] == DBNull.Value) ? 0 : (Int32)dr["Id"]; objApplicationSetup.IsMultilanguage = (dr["IsMultilanguage"] == DBNull.Value) ? false : (Boolean)dr["IsMultilanguage"]; objApplicationSetup.UseSingleSerailForEmplyoeeCode = (dr["UseSingleSerailForEmplyoeeCode"] == DBNull.Value) ? false : (Boolean)dr["UseSingleSerailForEmplyoeeCode"]; return objApplicationSetup; }
public ActionResult UpdateSchema(bool?overload) { ApplicationSetup.UpdateDatabaseToLatestSchema(); return(RedirectToAction("Step1")); }
public ActionResult UpdateSchema() { var pendingMigrations = ApplicationSetup.GetPendingMigrations(); return(View(pendingMigrations)); }