public List <SqlStatement> UpdateStatements( Context context, SiteSettings ss, string dataTableName = null, SqlParamCollection param = null, bool otherInitValue = false, List <SqlStatement> additionalStatements = null) { var timestamp = Timestamp.ToDateTime(); var statements = new List <SqlStatement>(); var where = Rds.DemosWhereDefault(this) .UpdatedTime(timestamp, _using: timestamp.InRange()); if (VerUp) { statements.Add(CopyToStatement( where : where, tableType: Sqls.TableTypes.History)); Ver++; } statements.AddRange(UpdateStatements( context: context, dataTableName: dataTableName, where : where, param: param, otherInitValue: otherInitValue)); statements.AddRange(UpdateAttachmentsStatements(context: context)); if (additionalStatements?.Any() == true) { statements.AddRange(additionalStatements); } return(statements); }
private List <SqlStatement> UpdateStatements( List <SqlStatement> statements, DateTime timestamp, SqlParamCollection param, bool otherInitValue = false, List <SqlStatement> additionalStatements = null) { var where = Rds.DemosWhereDefault(this) .UpdatedTime(timestamp, _using: timestamp.InRange()); if (VerUp) { statements.Add(CopyToStatement(where, Sqls.TableTypes.History)); Ver++; } statements.AddRange(new List <SqlStatement> { Rds.UpdateDemos( where : where, param: param ?? Rds.DemosParamDefault(this, otherInitValue: otherInitValue), countRecord: true) }); if (additionalStatements?.Any() == true) { statements.AddRange(additionalStatements); } return(statements); }
public DemoModel( Context context, int demoId, bool clearSessions = false, MethodTypes methodType = MethodTypes.NotSet) { OnConstructing(context: context); Context = context; TenantId = context.TenantId; DemoId = demoId; if (context.QueryStrings.ContainsKey("ver")) { Get(context: context, tableType: Sqls.TableTypes.NormalAndHistory, where : Rds.DemosWhereDefault(this) .Demos_Ver(context.QueryStrings.Int("ver"))); } else { Get(context: context); } if (clearSessions) { ClearSessions(context: context); } MethodType = methodType; OnConstructed(context: context); }
public DemoModel Get( Context context, Sqls.TableTypes tableType = Sqls.TableTypes.Normal, SqlColumnCollection column = null, SqlJoinCollection join = null, SqlWhereCollection where = null, SqlOrderByCollection orderBy = null, SqlParamCollection param = null, bool distinct = false, int top = 0) { where = where ?? Rds.DemosWhereDefault(this); Set(context, Repository.ExecuteTable( context: context, statements: Rds.SelectDemos( tableType: tableType, column: column ?? Rds.DemosDefaultColumns(), join: join ?? Rds.DemosJoinDefault(), where : where, orderBy: orderBy, param: param, distinct: distinct, top: top))); return(this); }
public ErrorData UpdateOrCreate( Context context, SiteSettings ss, SqlWhereCollection where = null, SqlParamCollection param = null) { SetBySession(context: context); var statements = new List <SqlStatement> { Rds.UpdateOrInsertDemos( where : where ?? Rds.DemosWhereDefault( context: context, demoModel: this), param: param ?? Rds.DemosParamDefault( context: context, ss: ss, demoModel: this, setDefault: true)) }; var response = Repository.ExecuteScalar_response( context: context, transactional: true, selectIdentity: true, statements: statements.ToArray()); DemoId = (response.Id ?? DemoId).ToInt(); Get(context: context); return(new ErrorData(type: Error.Types.None)); }
public List <SqlStatement> UpdateStatements( SqlParamCollection param, bool paramAll = false) { var timestamp = Timestamp.ToDateTime(); return(new List <SqlStatement> { Rds.UpdateDemos( verUp: VerUp, where : Rds.DemosWhereDefault(this) .UpdatedTime(timestamp, _using: timestamp.InRange()), param: param ?? Rds.DemosParamDefault(this, paramAll: paramAll), countRecord: true) }); }
public Error.Types UpdateOrCreate( RdsUser rdsUser = null, SqlWhereCollection where = null, SqlParamCollection param = null) { SetBySession(); var statements = new List <SqlStatement> { Rds.UpdateOrInsertDemos( where : where ?? Rds.DemosWhereDefault(this), param: param ?? Rds.DemosParamDefault(this, setDefault: true)) }; var response = Rds.ExecuteScalar_response( rdsUser: rdsUser, transactional: true, selectIdentity: true, statements: statements.ToArray()); DemoId = (response.Identity ?? DemoId).ToInt(); Get(); return(Error.Types.None); }
private List <SqlStatement> UpdateStatements( List <SqlStatement> statements, DateTime timestamp, SqlParamCollection param, bool paramAll = false, List <SqlStatement> additionalStatements = null) { statements.AddRange(new List <SqlStatement> { Rds.UpdateDemos( verUp: VerUp, where : Rds.DemosWhereDefault(this) .UpdatedTime(timestamp, _using: timestamp.InRange()), param: param ?? Rds.DemosParamDefault(this, paramAll: paramAll), countRecord: true) }); if (additionalStatements?.Any() == true) { statements.AddRange(additionalStatements); } return(statements); }