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 SqlIfElseUpdateTransDet(TransDetail transDetail) { return($"\t{SqlQueryBuilder.IfElse(SelectCountForTransDetRecord(transDetail), UpdateTransDetRecord(transDetail), PrintTransDetailUpdateError(transDetail))}"); }