private string BuildSqlQuery(List <TransDetail> transDetails) { var transDetailUpdates = transDetails.Select(t => { return(SqbTransDetail.SqlIfElseUpdateTransDet(t)); }); var ifTableExistsUpdateElseRollback = SqlQueryBuilder.IfElse( SqlQueryBuilder.TableExistsCondition("dbo", "TRANS_DET"), // condition $"{string.Join("\n", transDetailUpdates)}\n", // if SqbTransDetail.PrintTableDoesNotExistRollback("TRANS_DET")); // else return($"{SqlQueryBuilder.Print("\t--SCRIPT START--")}\n\n{SqlQueryBuilder.Use("CODETABLES")}{ifTableExistsUpdateElseRollback}\n{SqlQueryBuilder.Print("\t--SCRIPT END--")}"); }
public static string PrintTableDoesNotExistRollback(string tableName) { return($"{SqlQueryBuilder.Print($"ERROR: Table: {tableName} does NOT exist.")}"); }
public static string PrintTransDetailUpdateError(TransDetail transDetail) { return(SqlQueryBuilder.Print($"\tWARNING: Record was NOT UPDATED. --- FIELDNAME: {transDetail.FieldName} --- NAME: {transDetail.Name} --- TYPE: {transDetail.Type} ")); }