Beispiel #1
0
        public virtual Boolean isEqualTo(dtoLiteMapActivity activity)
        {
            return(Id == activity.IdActivity && ((activity.IdParent == 0 && Parent == null) || (Parent != null && activity.IdParent > 0 && Parent.Id == activity.IdParent)) &&
                   (DisplayOrder == activity.RowNumber) && (IsSummary == activity.IsSummary) && (activity.Previous.Name == Name) &&
                   (activity.Previous.EarlyStartDate == EarlyStartDate) && (activity.Previous.Duration.Value == Duration && activity.Previous.Duration.IsEstimated == IsDurationEstimated) &&
                   (
                       (
                           String.IsNullOrEmpty(activity.Previous.Predecessors) && (PredecessorLinks == null || (PredecessorLinks != null && PredecessorLinks.Where(p => p.Deleted == Core.DomainModel.BaseStatusDeleted.None).Any())
                                                                                    )
                           ||
                           (PredecessorLinks != null && PredecessorsToIdString() == activity.Previous.PredecessorsIdString)

                       )));
        }
Beispiel #2
0
        public virtual Boolean isModified(dtoLiteMapActivity activity, ModifyPolicy policy)
        {
            switch (policy)
            {
            case ModifyPolicy.FullFields:
                return(isEqualTo(activity));

            case ModifyPolicy.DateCalculationFields:
                return(Id == activity.IdActivity && ((activity.IdParent == 0 && Parent == null) || (Parent != null && activity.IdParent > 0 && Parent.Id == activity.IdParent)) &&
                       (IsSummary == activity.IsSummary) &&
                       (activity.Previous.EarlyStartDate == EarlyStartDate) && (activity.Previous.Duration.Value == Duration && activity.Previous.Duration.IsEstimated == IsDurationEstimated) &&
                       (
                           (
                               String.IsNullOrEmpty(activity.Previous.Predecessors) && (PredecessorLinks == null || (PredecessorLinks != null && PredecessorLinks.Where(p => p.Deleted == Core.DomainModel.BaseStatusDeleted.None).Any())
                                                                                        )
                               ||
                               (PredecessorLinks != null && PredecessorsToIdString() == activity.Previous.PredecessorsIdString)

                           )));
            }
            return(false);
        }
Beispiel #3
0
        public virtual void UpdateIdPredecessors(List <dtoLiteMapActivity> activities)
        {
            List <ParsedActivityLink> links = null;

            if (!String.IsNullOrEmpty(Previous.Predecessors))
            {
                links = lm.Comol.Modules.Standard.ProjectManagement.Business.CPMExtensions.ParseActivityLinks(Previous.Predecessors).ToList().Where(l => l.Id > 0).ToList();
                foreach (ParsedActivityLink l in links)
                {
                    dtoLiteMapActivity a = activities.Where(act => act.RowNumber == l.Id && !act.IsDeleted).FirstOrDefault();

                    if (a != null)
                    {
                        l.Id        = a.IdActivity;
                        l.IsSummary = a.IsSummary;
                    }
                }
                if (links.Where(l => !l.IsSummary).Any())
                {
                    Previous.PredecessorsIdString = String.Join(";", links.Where(l => !l.IsSummary).OrderBy(p => p.Id).Select(p => p.Id.ToString() + p.LinkType.ToString() + p.LeadLag.ToString()).ToList());
                }
                else
                {
                    Previous.PredecessorsIdString = "";
                }
                Previous.IdActivityLinks = links.Where(l => !l.IsSummary).Select(l => l.Id).ToList();
                Previous.Links           = links.Where(l => !l.IsSummary).ToList();
                Previous.IdSummaryLinks  = links.Where(l => l.IsSummary).Select(l => l.Id).ToList();
                Previous.SummaryLinks    = links.Where(l => l.IsSummary).ToList();
            }
            else
            {
                Previous.PredecessorsIdString = "";
            }
            if (!String.IsNullOrEmpty(Current.Predecessors))
            {
                links = lm.Comol.Modules.Standard.ProjectManagement.Business.CPMExtensions.ParseActivityLinks(Current.Predecessors).ToList().Where(l => l.Id > 0).ToList();
                foreach (ParsedActivityLink l in links)
                {
                    dtoLiteMapActivity a = activities.Where(act => act.RowNumber == l.Id && !act.IsDeleted).FirstOrDefault();
                    if (a != null)
                    {
                        l.Id        = a.IdActivity;
                        l.IsSummary = a.IsSummary;
                    }
                }
                if (links.Where(l => !l.IsSummary).Any())
                {
                    Current.PredecessorsIdString = String.Join(";", links.Where(l => !l.IsSummary).OrderBy(p => p.Id).Select(p => p.Id.ToString() + p.LinkType.ToString() + p.LeadLag.ToString()).ToList());
                }
                else
                {
                    Current.PredecessorsIdString = "";
                }
                Current.IdActivityLinks = links.Where(l => !l.IsSummary).Select(l => l.Id).ToList();
                Current.Links           = links.Where(l => !l.IsSummary).ToList();
                Current.IdSummaryLinks  = links.Where(l => l.IsSummary).Select(l => l.Id).ToList();
                Current.SummaryLinks    = links.Where(l => l.IsSummary).ToList();
            }
            else
            {
                Current.PredecessorsIdString = "";
            }
        }