Beispiel #1
0
        /// <summary>
        ///     Adds the action.
        /// </summary>
        /// <param name="contestIdParameter">The contest id parameter.</param>
        /// <param name="action">The action.</param>
        /// <param name="actionType">Type action</param>
        /// <param name="userId">the user Id</param>
        /// <externalUnit/>
        /// <revision revisor="dev01" date="10/9/2009" version="1.1.1.9">
        ///     Member Created
        /// </revision>
        /// <revision revisor="dev01" date="11/11/2009" version="1.1.2.20">
        ///     Changed logic to pull the correct session and then add the
        ///     action to it
        /// </revision>
        /// <revision revisor="dev01" date="11/12/2009" version="1.1.2.21">
        ///     Modified search Paradigm
        /// </revision>
        public void AddAction(
            int contestIdParameter,
            VoterRecordStep action,
            OutstackConditionId actionType,
            Guid userId)
        {
            var actionSession = new ActionSession
            {
                UserId = userId,
                VoterRecordActionSets =
                    new VoterRecordActionSetList()
            };

            if (this.VoterRecordSessions.Exists(d => d.UserId == userId))
            {
                actionSession =
                    this.VoterRecordSessions.Find(d => d.UserId == userId);
            }
            else
            {
                this.VoterRecordSessions.Add(actionSession);
            }

            actionSession.AddAction(contestIdParameter, action, actionType);
        }
Beispiel #2
0
        /// <summary>
        ///     Removes the action.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <externalUnit/>
        /// <revision revisor="dev01" date="11/12/2009" version="1.1.2.21">
        ///     Member Created
        /// </revision>
        public void RemoveAction(VoterRecordStep action)
        {
            bool found = false;

            for (int i = 0; i < this.VoterRecordSessions.Count &&
                 found != true; i++)
            {
                ActionSession session = this.VoterRecordSessions[i];
                for (int j = 0; j < session.VoterRecordActionSets.Count &&
                     found != true; j++)
                {
                    VoterRecordActionSet actionSet =
                        session.VoterRecordActionSets[j];

                    if (actionSet.VoterRecordActions.Remove(action))
                    {
                        found = true;
                    }
                }
            }

            if (found)
            {
                this.Clean();
            }
        }
        /// <summary>
        ///     Adds the action.
        /// </summary>
        /// <param name="contestIdParameter">The contest id parameter.</param>
        /// <param name="action">The action.</param>
        /// <param name="actionType">Type action</param>
        /// <externalUnit/>
        /// <revision revisor="dev01" date="10/9/2009" version="1.1.1.9">
        ///     Member Created
        /// </revision>
        /// <revision revisor="dev01" date="11/12/2009" version="1.1.2.21">
        ///     Modified search Paradigm
        /// </revision>
        public void AddAction(
            int contestIdParameter,
            VoterRecordStep action,
            OutstackConditionId actionType)
        {
            var actionSet = new VoterRecordActionSet
            {
                Type               = actionType,
                ContestId          = contestIdParameter,
                VoterRecordActions =
                    new VoterRecordActionList(),
            };

            if (this.VoterRecordActionSets.Exists(d => d.Type == actionType &&
                                                  d.ContestId == contestIdParameter))
            {
                actionSet =
                    this.VoterRecordActionSets.Find(
                        d =>
                        d.Type == actionType &&
                        d.ContestId == contestIdParameter);
            }
            else
            {
                this.VoterRecordActionSets.Add(actionSet);
            }

            actionSet.VoterRecordActions.Add(action);
        }