Пример #1
0
        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--")}");
        }
Пример #2
0
 public static string PrintTableDoesNotExistRollback(string tableName)
 {
     return($"{SqlQueryBuilder.Print($"ERROR: Table: {tableName} does NOT exist.")}");
 }
Пример #3
0
 public static string PrintTransDetailUpdateError(TransDetail transDetail)
 {
     return(SqlQueryBuilder.Print($"\tWARNING: Record was NOT UPDATED. --- FIELDNAME: {transDetail.FieldName} --- NAME: {transDetail.Name} --- TYPE: {transDetail.Type} "));
 }