Exemplo n.º 1
0
        /// <summary>
        /// Add stage to pipeline
        /// </summary>
        /// <param name="stage"></param>
        /// <param name="modifiedBy"></param>
        /// <returns></returns>
        public Result AddStage(DealStage stage, Guid modifiedBy)
        {
            //Check if Id's match
            if (this.Id != stage.PipelineId || stage.PipelineId == Guid.Empty)
            {
                return(Result.Fail("Cannot process, check organization Id"));
            }

            //Check if the collection contains element or not
            if (this.Stages != null)
            {
                return(Result.Fail("Please load the pipeline stages before execution"));
            }

            _stages.Add(stage);

            return(Result.Ok());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove stage from pipeline
        /// </summary>
        /// <param name="stage"></param>
        /// <param name="modifiedBy"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public Result RemoveStage(DealStage stage, Guid modifiedBy)
        {
            //Check if Id's match
            if (this.Id != stage.PipelineId || stage.PipelineId == Guid.Empty)
            {
                return(Result.Fail("Cannot process, check organization Id"));
            }

            //Check if the collection contains element or not
            if (this.Stages != null && this.Stages.Any(x => x.Name == stage.Name))
            {
                _stages.Remove(stage);
            }
            else
            {
                return(Result.Fail("Please load the pipeline stages before execution"));
            }

            //Remove stage
            stage.Deactivate();

            return(Result.Ok());
        }