public string AddEventActionText()

in DiagManager/DiagClasses/XEvent.cs [128:220]


        public string AddEventActionText()
        {
            string setPrivateFields = string.Empty;
            string setGlobalActions = string.Empty;
            string setLocalActions = string.Empty;
            string setWhereClause = string.Empty;
            //if it's auto included, don't set
            if (EventFieldList != null && EventFieldList.Count() > 0)
            {

                int counter = 0;
                string prefix = "";
                setPrivateFields = "SET ";
                foreach (EventField evtfield in EventFieldList)
                {
                    if (evtfield.AutoInclude == false)
                    {
                        if (counter > 0)
                        {
                            prefix = " , ";
                        }

                        setPrivateFields += prefix + string.Format("{0}=(1)  ", evtfield.Name);
                        counter++;
                    }
                }

            }
            //if event requests specific actions capture them (we will not append to global actions since you can get into situations where you get too many actions error)
            if(this.EventActionList.Count() > 0)
            {
                setLocalActions = " ACTION (";
                for (int a = 0; a < this.EventActionList.Count(); a++)
                {
                    setLocalActions += this.EventActionList[a].FullName;
                    if (a != this.EventActionList.Count() - 1)
                    {
                        setLocalActions += ", ";
                    }
                    else
                    {
                        setLocalActions += ") ";
                    }
                }
                setGlobalActions = String.Copy(setLocalActions);
            }
            //otherwise go with global sction list (we will not append to event specific actions since you can get into situations where you get too many actions error)
            else if (XMgr.GlobalActionList != null && XMgr.GlobalActionList.Count() > 0)
            {
                setGlobalActions = " ACTION (";
                for (int i = 0; i < XMgr.GlobalActionList.Count(); i++)
                {
                    setGlobalActions += XMgr.GlobalActionList[i].FullName;
                    if (i != XMgr.GlobalActionList.Count() - 1)
                    {
                        setGlobalActions += ", ";
                    }
                    else
                    {
                        setGlobalActions += ") ";
                    }
                }
            }

            EventFilterCollection MyUserFilters = new EventFilterCollection();
            foreach (EventFilter evtFilter in XMgr.UserFilterList)
            {
                EventAction act = XMgr.GlobalActionList.FindByNameIgnoreCase(evtFilter.Name);
                EventField field = this.EventFieldList.Find(x => x.Name == evtFilter.Name);
                if (act != null || field != null)
                {
                    MyUserFilters.Add(evtFilter);
                }
            }
            //remove logical operator from last one
            if (MyUserFilters.Count > 0)
            {
                EventFilter evtFilter = MyUserFilters.Last<EventFilter>();
                evtFilter.LogicalOperator = string.Empty;
            }

            if (MyUserFilters != null && MyUserFilters.Count() > 0)
            {
                setWhereClause += " WHERE ( ";
                for (int i = 0; i < MyUserFilters.Count(); i++)
                {
                    EventFilter filt = MyUserFilters[i];
                    setWhereClause += filt.WhereClause + " ";
                }
                setWhereClause += ") ";
            }
            return string.Format(AddEventTextTemplate, this.FullName, setPrivateFields, setGlobalActions, setWhereClause);
        }