Esempio n. 1
0
 public dtoCPMactivity(PmActivity activity)
 {
     Id                  = activity.Id;
     IdParent            = (activity.Parent != null) ? activity.Parent.Id : 0;
     Parent              = (activity.Parent != null) ? new dtoCPMactivity(activity.Parent) : null;
     Name                = activity.Name;
     Completeness        = activity.Completeness;
     IsDurationEstimated = activity.IsDurationEstimated;
     DisplayOrder        = activity.DisplayOrder;
     EarlyStart          = activity.EarlyStart;
     EarlyFinish         = activity.EarlyFinish;
     LatestStart         = activity.LatestStart;
     LatestFinish        = activity.LatestFinish;
     EarlyStartDate      = activity.EarlyStartDate;
     EarlyFinishDate     = activity.EarlyFinishDate;
     LatestStartDate     = activity.LatestStartDate;
     LatestFinishDate    = activity.LatestFinishDate;
     Deadline            = activity.Deadline;
     IsSummary           = activity.IsSummary;
     IsVirtual           = false;
     Duration            = activity.Duration;
     Predecessors        = activity.Predecessors.Where(p => p.Target != null && p.Source != null).Select(p => new dtoCPMlink()
     {
         IdSource = p.Source.Id, IdTarget = p.Target.Id, LeadLag = p.LeadLag, Type = p.Type
     }).ToList();
     Successors = activity.Successors.Where(p => p.Target != null && p.Source != null).Select(p => new dtoCPMlink()
     {
         IdSource = p.Source.Id, IdTarget = p.Target.Id, LeadLag = p.LeadLag, Type = p.Type
     }).ToList();
     IdChildren = (activity.Children == null) ? new List <long>() : activity.Children.Where(c => c.Deleted == BaseStatusDeleted.None).Select(c => c.Id).ToList();
 }
Esempio n. 2
0
 public dtoMapActivity(PmActivity activity, long rowNumber, Boolean onlyview = false)
 {
     IdActivity       = activity.Id;
     IdParent         = (activity.Parent != null) ? activity.Parent.Id : 0;
     RowNumber        = rowNumber;
     Name             = new dtoField <string>(activity.Name);
     DisplayOrder     = new dtoField <long>(activity.DisplayOrder);
     WBSindex         = activity.WBSindex;
     WBSstring        = activity.WBSstring;
     Depth            = activity.Depth;
     Deadline         = new dtoField <DateTime?>(activity.Deadline);
     IsCompleted      = activity.IsCompleted;
     IsSummary        = activity.IsSummary;
     EarlyStartDate   = new dtoField <DateTime?>(activity.EarlyStartDate);
     EarlyFinishDate  = new dtoField <DateTime?>(activity.EarlyFinishDate);
     LatestStartDate  = activity.LatestStartDate;
     LatestFinishDate = activity.LatestFinishDate;
     isAfterDeadline  = activity.isAfterDeadline;
     isCritical       = activity.isCritical;
     Duration         = new dtoField <dtoDuration>(new dtoDuration(activity.Duration, activity.IsDurationEstimated));
     Links            = new dtoField <List <ParsedActivityLink> >(activity.Predecessors.Where(p => p.Target != null).Select(p => new ParsedActivityLink()
     {
         Id = p.Target.Id, LeadLag = p.LeadLag, LinkType = p.Type
     }).ToList());
     IdLinkedActivities = activity.Predecessors.Where(p => p.Target != null).Select(p => p.Target.Id).ToList();
     Predecessors       = new dtoField <String>();
     IdResources        = new dtoField <List <long> >(activity.CurrentAssignments.Select(a => a.Resource.Id).ToList());
     Resources          = new dtoField <List <dtoResource> >();
     Status             = FieldStatus.none;
     Completeness       = activity.Completeness;
     Permission         = new dtoActivityPermission();
 }
Esempio n. 3
0
        public virtual long GetMaxChildrenDisplayOrder()
        {
            long displayOrder = DisplayOrder;

            if (Children != null && Children.Where(c => c.Deleted == Core.DomainModel.BaseStatusDeleted.None).Any())
            {
                PmActivity child = Children.Where(c => c.Deleted == Core.DomainModel.BaseStatusDeleted.None).OrderByDescending(c => c.DisplayOrder).FirstOrDefault();
                displayOrder = (child.Children == null || !Children.Where(c => c.Deleted == Core.DomainModel.BaseStatusDeleted.None).Any()) ? child.DisplayOrder : child.GetMaxChildrenDisplayOrder();
            }
            return(displayOrder);
        }
Esempio n. 4
0
 public dtoGraphActivity(PmActivity activity, long rowNumber, Boolean onlyview = false)
 {
     IdActivity   = activity.Id;
     IdParent     = (activity.Parent != null) ? activity.Parent.Id : 0;
     RowNumber    = rowNumber;
     DisplayOrder = activity.DisplayOrder;
     Depth        = activity.Depth;
     IsSummary    = activity.IsSummary;
     Links        = (activity.Predecessors.Where(p => p.Target != null && !p.Target.IsSummary).Select(p => new dtoGraphActivityLink()
     {
         IdPredecessor = p.Target.Id, LeadLag = p.LeadLag, Type = p.Type
     }).ToList());
     //IdLinkedActivities = activity.Predecessors.Where(p => p.Target != null).Select(p => p.Target.Id).ToList();
 }
Esempio n. 5
0
        private void setDtoSettings(PmActivity task, PmActivityPermission permissions, ProjectResource resource = null)
        {
            Id          = task.Id;
            ProjectInfo = new dtoProjectGroupInfo(task.Project, permissions, resource);

            Name                = task.Name;
            Description         = task.Description;
            Notes               = task.Notes;
            Completeness        = task.Completeness;
            IsCompleted         = task.IsCompleted;
            Deleted             = task.Deleted;
            Status              = task.Status;
            StartDate           = task.EarlyStartDate;
            EndDate             = task.EarlyFinishDate;
            Deadline            = task.Deadline;
            Duration            = task.Duration;
            IsDurationEstimated = task.IsDurationEstimated;
            IdResources         = task.CurrentAssignments.Select(a => a.Resource.Id).ToList();
            Assignments         = task.CurrentAssignments.Select(a => new dtoActivityCompletion()
            {
                Id = a.Id, IdResource = a.Resource.Id, Completeness = a.Completeness, IsApproved = a.IsApproved
            }).ToList();
        }
Esempio n. 6
0
        public ActivityForGantt(ProjectResource resource, PmActivity activity, ProjectVisibility visibility, String formatDatePattern, Dictionary <GanttCssClass, String> cssClass, String defaultActivityName, String urlBase = "")
        {
            pID = activity.Id.ToString();

            if (activity.Depth == 0)
            {
                pName   = (visibility == ProjectVisibility.Full) ? activity.Name : activity.WBSindex + " - " + defaultActivityName;
                pParent = "0";
            }
            else
            {
                //string FinalWBS = "";
                //string s = oTask.WBS;
                //string[] words = s.Split('.');
                ////foreach (string w in words)
                //for (int i = 0; i < words.Length; i++)
                //{
                //    if (words[i].Length == 1)
                //    {
                //        FinalWBS += "0" + words[i];
                //    }
                //    else
                //    {
                //        FinalWBS += words[i];
                //    }

                //    if (i != words.Length - 1)
                //    {
                //        FinalWBS += ".";
                //    }

                //}
                //pName = FinalWBS + " " + oTask.Name;
                pName   = activity.Name;
                pParent = (activity.Parent != null) ? activity.Parent.Id.ToString() : "0";
            }

            if (activity.isMilestone && !activity.IsSummary)
            {
                pClass = cssClass[GanttCssClass.Milestone];
            }
            else if (activity.IsSummary)
            {
                pClass = cssClass[GanttCssClass.Summary];
            }
            else if (activity.isCritical)
            {
                pClass = cssClass[GanttCssClass.Critical];
            }
            else
            {
                pClass = cssClass[GanttCssClass.None];
            }
            if (activity.Predecessors != null && activity.Predecessors.Any())
            {
                if (activity.Predecessors.Where(p => p.Type != PmActivityLinkType.FinishStart).Any())
                {
                    pDepend = String.Join(",", activity.Predecessors.Where(p => p.Target != null).Select(p => GetDependency(p)).ToList());
                }
                else
                {
                    pDepend = String.Join(",", activity.Predecessors.Where(p => p.Target != null).Select(p => p.Target.Id).ToList());
                }
            }
            else
            {
                pDepend = "";
            }
            if (activity.CurrentAssignments.Where(a => a.Resource != null).Any())
            {
                pRes = String.Join(",", activity.CurrentAssignments.Where(a => a.Resource != null).Select(a => a.Resource.GetLongName()).ToList());
            }
            else
            {
                pRes = "";
            }
            pStart = activity.EarlyStartDate.Value.ToString(formatDatePattern);
            if (activity.EarlyFinishDate.HasValue)
            {
                pEnd = activity.EarlyFinishDate.Value.ToString(formatDatePattern);
            }
            else
            {
                pEnd = "";
            }
            pMile    = (activity.isMilestone) ? "1" : "0";
            pComp    = activity.Completeness.ToString();
            pGroup   = (activity.IsSummary) ? "1" : "0";
            pNote    = activity.Description;
            pCaption = activity.Name;
            pLink    = "";
            if (activity.IsSummary && activity.IsCompleted)
            {
                pOpen = "0";
            }
            else if (activity.IsSummary && activity.Depth > 4)
            {
                pOpen = "0";
            }
            // pLink = BaseUrl + "TaskList/TaskDetail.aspx?CurrentTaskID=" + oTask.ID + "&CurrentViewType=Read";
        }
Esempio n. 7
0
 public dtoPlainTask(PmActivity task, PmActivityPermission permissions = PmActivityPermission.None)
 {
     ProjectResources = new List <dtoResource>();
     setDtoSettings(task, permissions);
 }