예제 #1
0
        private void BindIterationGrid(IList projectTasks, IList projectIterations)
        {
            IList taskIterationList = projectTasks.AsQueryable().Where("ProjectIterationId != null").Select("ProjectIterationId").Cast <Guid>().Distinct().ToArrayList();
            List <ProjectSummary> IterationSummaryList = new List <ProjectSummary>();
            var displayNameFormat = "{0} ({1:yy/MM/dd} - {2:yy/MM/dd})";

            foreach (var iterationId in taskIterationList)
            {
                IList iterationList     = projectIterations.AsQueryable().Where("ProjectIterationId=@0", iterationId).ToArrayList();
                IList iterationNameList = iterationList.AsQueryable().Select("Name").Cast <string>().ToArrayList();
                if (iterationNameList.Count <= 0)
                {
                    continue;
                }
                ProjectSummary iterationItem = new ProjectSummary();
                iterationItem.Name = iterationNameList[0].ToString();
                IList taskList = projectTasks.AsQueryable().Where("ProjectIterationId=@0", iterationId).ToArrayList();
                SumEntity(iterationItem, taskList);
                iterationItem.Id          = (Guid)iterationId;
                iterationItem.NameAndDate = string.Format(displayNameFormat, iterationItem.Name, iterationList._First().AsDyanmic().StartDate, iterationList._First().AsDyanmic().Deadline);
                iterationItem.StartDate   = iterationList._First().AsDyanmic().StartDate;
                IterationSummaryList.Add(iterationItem);
            }
            IterationSummaryList = IterationSummaryList.AsQueryable().OrderBy("StartDate desc ").ToList();
            View.BindIterationGrid(IterationSummaryList);
        }
예제 #2
0
        private void BindSummaryData()
        {
            var prjectId = Guid.Empty;

            if (View.Context.CurrentObject != null)
            {
                prjectId = View.Context.CurrentObject.AsDyanmic().ProjectId;
            }
            var            entity = DynamicDataServiceContext.GetOrNew("Project", prjectId, "Manager,SaleService,ProjectTasks,ProjectIterations");
            ProjectSummary projectSummaryEntity = new ProjectSummary();
            IList          projectTasks         = entity.AsDyanmic().ProjectTasks;

            projectTasks = projectTasks.AsQueryable().Where("IsDeleted=@0", false).ToArrayList();
            SumEntity(projectSummaryEntity, projectTasks);

            //
            Type entityType      = entity.GetType();
            Type listGenericType = typeof(List <>);
            Type listType        = listGenericType.MakeGenericType(entityType);
            var  list            = (IList)Activator.CreateInstance(listType);

            list.Add(entity);
            View.BindSummaryData(list, new List <ProjectSummary>()
            {
                projectSummaryEntity
            });

            BindMemberGrid(projectTasks);

            IList projectIterations = entity.AsDyanmic().ProjectIterations;

            BindIterationGrid(projectTasks, projectIterations);

            BindIterationScheduler(projectTasks, projectIterations);
        }
예제 #3
0
 private void SumEntity(ProjectSummary item, IList projectTasks)
 {
     item.SumQuoteWorkHours  = projectTasks.AsQueryable().Select("QuoteWorkHours").Cast <double?>().Sum();
     item.SumActualWorkHours = projectTasks.AsQueryable().Select("ActualWorkHours").Cast <double?>().Sum();
     item.SumActualInput     = projectTasks.AsQueryable().Select("ActualInput").Cast <double?>().Sum();
     item.SumEffort          = projectTasks.AsQueryable().Select("Effort").Cast <double?>().Sum();
     item.SumOvertime        = projectTasks.AsQueryable().Select("Overtime").Cast <double?>().Sum();
     item.SumRemainderTime   = item.SumActualWorkHours - item.SumEffort;
     if (item.SumActualInput > 0)
     {
         item.SumInputEffortRate = item.SumEffort / item.SumActualInput ?? 0d;
     }
     else
     {
         item.SumActualInput = 0d;
     }
     if (item.SumActualWorkHours > 0)
     {
         item.SumEvaluateExactlyRate = item.SumQuoteWorkHours / item.SumActualWorkHours ?? 0d;
     }
     else
     {
         item.SumActualWorkHours = 0d;
     }
 }
예제 #4
0
        private void BindMemberGrid(IList projectTasks)
        {
            IList taskOwnerList = projectTasks.AsQueryable().Where("OwnerId !=null").Select("OwnerId").Cast <Guid>().Distinct().ToArrayList();
            List <ProjectSummary> memberSummaryList = new List <ProjectSummary>();

            foreach (var ownerId in taskOwnerList)
            {
                ProjectSummary memberItem = new ProjectSummary();
                memberItem.Name = _users.AsQueryable().Where("userid=@0", ownerId).Select("FullName").Cast <string>().First();
                IList taskList = projectTasks.AsQueryable().Where("OwnerId=@0", ownerId).ToArrayList();
                SumEntity(memberItem, taskList);
                memberSummaryList.Add(memberItem);
            }
            View.BindMemberGrid(memberSummaryList);
        }
예제 #5
0
        protected override object GetEntity()
        {
            Dictionary <string, string> extraColumns = new Dictionary <string, string>();
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "CreatedBy,ModifiedBy,ProjectTasks,ProjectMembers");

            _projectSummaryEntity = new ProjectSummary();
            IList projectTasks = entity.AsDyanmic().ProjectTasks;

            _projectSummaryEntity.SumQuoteWorkHours  = projectTasks.AsQueryable().Select("QuoteWorkHours").Cast <double?>().Sum();
            _projectSummaryEntity.SumActualWorkHours = projectTasks.AsQueryable().Select("ActualWorkHours").Cast <double?>().Sum();
            _projectSummaryEntity.SumActualInput     = projectTasks.AsQueryable().Select("ActualInput").Cast <double?>().Sum();
            _projectSummaryEntity.SumEffort          = projectTasks.AsQueryable().Select("Effort").Cast <double?>().Sum();
            _projectSummaryEntity.SumOvertime        = projectTasks.AsQueryable().Select("Overtime").Cast <double?>().Sum();
            _projectSummaryEntity.SumRemainderTime   = _projectSummaryEntity.SumActualWorkHours - _projectSummaryEntity.SumEffort;
            View.BindStatisticNumber(new List <ProjectSummary>()
            {
                _projectSummaryEntity
            });
            ConvertEntity(entity);
            return(entity);
        }