12345678910111213141516171819202122232425262728 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web;
- namespace MySystem
- {
- public static class StringBuilderExtension
- {
- public static void Condition(this StringBuilder input, string field, object val)
- {
- if(typeof(int) == val.GetType() || typeof(decimal) == val.GetType())
- {
- input.Append(" and " + field + "=" + val);
- }
- else
- {
- input.Append(" and " + field + "='" + val + "'");
- }
- }
- public static void ConditionLike(this StringBuilder input, string field, object val)
- {
- input.Append(" and " + field + " like '%" + val + "%'");
- }
- }
- }
|