public Error.Types Delete() { Rds.ExecuteNonQuery( transactional: true, statements: new SqlStatement[] { Rds.DeleteDemos( where : Rds.DemosWhere().DemoId(DemoId)) }); return(Error.Types.None); }
public Error.Types Restore(int demoId) { DemoId = demoId; Rds.ExecuteNonQuery( connectionString: Parameters.Rds.OwnerConnectionString, transactional: true, statements: new SqlStatement[] { Rds.RestoreDemos( where : Rds.DemosWhere().DemoId(DemoId)) }); return(Error.Types.None); }
public Error.Types Delete() { var statements = new List <SqlStatement>(); statements.AddRange(new List <SqlStatement> { Rds.DeleteDemos( where : Rds.DemosWhere().DemoId(DemoId)) }); Rds.ExecuteNonQuery( transactional: true, statements: statements.ToArray()); return(Error.Types.None); }
/// <summary> /// Fixed: /// </summary> private static void Initialize( this DemoModel demoModel, Context context, Dictionary <string, long> idHash, string password) { demoModel.InitializeTimeLag(); InitializeDepts( context: context, demoModel: demoModel, idHash: idHash); InitializeUsers( context: context, demoModel: demoModel, idHash: idHash, password: password); var userModel = new UserModel( context: context, ss: SiteSettingsUtilities.UsersSiteSettings(context: context), loginId: LoginId(demoModel, "User1")); userModel.SetSession(); context.SetBySession(); SiteInfo.Reflesh(context: context); InitializeSites(context: context, demoModel: demoModel, idHash: idHash); Def.DemoDefinitionCollection .Where(o => o.Type == "Sites") .OrderBy(o => o.Id) .ForEach(o => { InitializeIssues( context: context, demoModel: demoModel, parentId: o.Id, idHash: idHash); InitializeResults( context: context, demoModel: demoModel, parentId: o.Id, idHash: idHash); }); InitializeLinks( context: context, demoModel: demoModel, idHash: idHash); InitializePermissions( context: context, idHash: idHash); Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateDemos( param: Rds.DemosParam().Initialized(true), where : Rds.DemosWhere().Passphrase(demoModel.Passphrase))); Libraries.Migrators.SiteSettingsMigrator.Migrate(context: context); }
public ErrorData Restore(Context context, int demoId) { DemoId = demoId; Repository.ExecuteNonQuery( context: context, connectionString: Parameters.Rds.OwnerConnectionString, transactional: true, statements: new SqlStatement[] { Rds.RestoreDemos( factory: context, where : Rds.DemosWhere().DemoId(DemoId)) }); return(new ErrorData(type: Error.Types.None)); }
public ErrorData Delete(Context context) { var statements = new List <SqlStatement>(); var where = Rds.DemosWhere().DemoId(DemoId); statements.AddRange(new List <SqlStatement> { Rds.DeleteDemos(factory: context, where : where) }); Repository.ExecuteNonQuery( context: context, transactional: true, statements: statements.ToArray()); return(new ErrorData(type: Error.Types.None)); }
public Error.Types Delete() { var statements = new List <SqlStatement>(); var where = Rds.DemosWhere().DemoId(DemoId); statements.AddRange(new List <SqlStatement> { Rds.DeleteDemos(where : where) }); var response = Rds.ExecuteScalar_response( transactional: true, statements: statements.ToArray()); return(Error.Types.None); }
public Error.Types Delete() { var statements = new List <SqlStatement>(); var where = Rds.DemosWhere().DemoId(DemoId); statements.AddRange(new List <SqlStatement> { CopyToStatement(where, Sqls.TableTypes.Deleted), Rds.PhysicalDeleteDemos(where : where) }); Rds.ExecuteNonQuery( transactional: true, statements: statements.ToArray()); return(Error.Types.None); }
/// <summary> /// Fixed: /// </summary> public static bool Login(Context context) { var demoModel = new DemoModel().Get( context: context, where : Rds.DemosWhere() .Passphrase(QueryStrings.Data("passphrase")) .CreatedTime( DateTime.Now.AddDays(Parameters.Service.DemoUsagePeriod * -1), _operator: ">=")); if (demoModel.AccessStatus == Databases.AccessStatuses.Selected) { var loginId = LoginId(demoModel, "User1"); var password = Strings.NewGuid().Sha512Cng(); if (!demoModel.Initialized) { var idHash = new Dictionary <string, long>(); demoModel.Initialize(context: context, idHash: idHash, password: password); } else { Rds.ExecuteNonQuery( context: context, statements: Rds.UpdateUsers( param: Rds.UsersParam().Password(password), where : Rds.UsersWhere().LoginId(loginId))); } new UserModel() { LoginId = loginId, Password = password }.Authenticate( context: context, returnUrl: string.Empty); SiteInfo.Reflesh(context: context, force: true); return(Sessions.LoggedIn()); } else { return(false); } }
/// <summary> /// Fixed: /// </summary> private static void Initialize( this DemoModel demoModel, Dictionary <string, long> idHash, string password) { demoModel.InitializeTimeLag(); InitializeDepts(demoModel, idHash); InitializeUsers(demoModel, idHash, password); SiteInfo.Reflesh(force: true); InitializeSites(demoModel, idHash); Def.DemoDefinitionCollection .Where(o => o.Type == "Sites") .OrderBy(o => o.Id) .ForEach(o => { InitializeIssues(demoModel, o.Id, idHash); InitializeResults(demoModel, o.Id, idHash); }); InitializeLinks(demoModel, idHash); InitializePermissions(idHash); Rds.ExecuteNonQuery(statements: Rds.UpdateDemos( param: Rds.DemosParam().Initialized(true), where : Rds.DemosWhere().Passphrase(demoModel.Passphrase))); Libraries.Migrators.SiteSettingsMigrator.Migrate(); }