Esempio n. 1
0
        private static List <string> GetUpdateKeyValuePairs(string tableName, Dictionary <string, object> fields)
        {
            List <string> updateKeyValuePairs = new List <string>();

            foreach (var field in fields)
            {
                string fieldName = field.Key;
                updateKeyValuePairs.Add(fieldName + " = " + SqlHelpers.DecorateSqlValue(field.Value.AsSqlString()));
            }

            return(updateKeyValuePairs);
        }
Esempio n. 2
0
        public override string ToString()
        {
            string thisConditionStr;

            if (Value == null && Comparison == SqlComparisonEnum.Equals)
            {
                thisConditionStr = string.Format(CultureInfo.InvariantCulture, "{0}.{1} is null",
                                                 TableName,
                                                 FieldName);
            }
            else if (Value == null && Comparison == SqlComparisonEnum.Different)
            {
                thisConditionStr = string.Format(CultureInfo.InvariantCulture, "{0}.{1} is not null",
                                                 TableName,
                                                 FieldName);
            }
            else
            {
                thisConditionStr = string.Format(CultureInfo.InvariantCulture, "{0}.{1} {2} {3}",
                                                 TableName,
                                                 FieldName,
                                                 SqlHelpers.SqlComparisonEnumToString[Comparison],
                                                 SqlHelpers.DecorateSqlValue(Value.AsSqlString()));
            }

            if (this.And != null)
            {
                thisConditionStr = string.Format(CultureInfo.InvariantCulture, "(({0}) AND ({1}))",
                                                 thisConditionStr,
                                                 this.And.ToString());
            }

            if (this.Or != null)
            {
                thisConditionStr = string.Format(CultureInfo.InvariantCulture, "(({0}) OR ({1}))",
                                                 thisConditionStr,
                                                 this.Or.ToString());
            }

            return(thisConditionStr);
        }