public static string CheckFilter(FilterProperties fp)
        {
            if (Array.IndexOf(IntFields, fp.Field) > -1)
            {
                int val;
                if (!int.TryParse(fp.Value, out val))
                {
                    return("The value should be an integer");
                }
                if (OnlyStringOperator(fp))
                {
                    return("The operator is not correct for this field");
                }
            }
            else if (Array.IndexOf(LongFields, fp.Field) > -1)
            {
                long val;
                if (!long.TryParse(fp.Value, out val))
                {
                    return("The value should be a bigint");
                }
                if (OnlyStringOperator(fp))
                {
                    return("The operator is not correct for this field");
                }
            }

            return(string.Empty);
        }
        public Trace RunProfiler(string serverName, string username, string password, string traceName, string rawConn, TraceEventProperties[] events, FilterProperties[] filters)
        {
            IProfiler profiler = ToolsFactory.Instance.CreateProfiler(serverName, username, password, rawConn);

            InitializeProfiler(profiler);

            foreach(TraceEventProperties p in events)
            {
                profiler.AddTraceEvent(p.Event, p.Fields);
            }

            foreach(FilterProperties f in filters)
            {
                if(f.CheckFilter())
                    profiler.AddTraceFilter(f.Field, LogicalOperator.AND, f.Operator, f.TypedValue);
            }

            profiler.TraceEvent += profiler_TraceEvent;

            profiler.Start();

            Trace trace = new Trace(profiler, new DataTable(), traceName);
            trace.TraceEvents = events;
            trace.TraceFilters = filters;
            _traces.Add(profiler, trace);

            return trace;
        }
 private static bool OnlyStringOperator(FilterProperties fp)
 {
     return(fp.Operator == ComparisonOperator.Like || fp.Operator == ComparisonOperator.NotLike);
 }
 private static bool OnlyStringOperator(FilterProperties fp)
 {
     return fp.Operator == ComparisonOperator.Like || fp.Operator == ComparisonOperator.NotLike;
 }
        public static string CheckFilter(FilterProperties fp)
        {
            if (Array.IndexOf(IntFields, fp.Field) > -1)
            {
                int val;
                if (!int.TryParse(fp.Value, out val))
                    return "The value should be an integer";
                if (OnlyStringOperator(fp))
                    return "The operator is not correct for this field";
            }
            else if (Array.IndexOf(LongFields, fp.Field) > -1)
            {
                long val;
                if (!long.TryParse(fp.Value, out val))
                    return "The value should be a bigint";
                if (OnlyStringOperator(fp))
                    return "The operator is not correct for this field";
            }

            return string.Empty;
        }