Example #1
0
        protected Katrin.Domain.Impl.ProjectTask GetSelectedEntity()
        {
            Guid   projectTaskId = this._objectSpace.GetObjectId(this.ObjectName, this.SelectedObject);
            object projectTask   = this._objectSpace.GetOrNew(this.ObjectName, projectTaskId, null);

            Katrin.Domain.Impl.ProjectTask task = projectTask as Katrin.Domain.Impl.ProjectTask;
            return(task);
        }
Example #2
0
        public Guid?GetSelectedProjectId()
        {
            Guid?projectId = ParseBinaryRightValue(_projectTaskFilterView.Context.GetFilter("ProjectId"));

            if (projectId == Guid.Empty)
            {
                Guid   projectTaskId = this._objectSpace.GetObjectId(this.ObjectName, this.SelectedObject);
                object projectTask   = this._objectSpace.GetOrNew(this.ObjectName, projectTaskId, null);
                Katrin.Domain.Impl.ProjectTask task = projectTask as Katrin.Domain.Impl.ProjectTask;
                return(task.ProjectId);
            }
            else
            {
                return(projectId);
            }
        }
Example #3
0
        public IEnumerable <LookupListItem <Guid?> > GetProjectIterationsForMenu(Guid?projectId)
        {
            List <LookupListItem <Guid?> > result = new List <LookupListItem <Guid?> >();

            if (projectId == null)
            {
                return(result);
            }


            Dictionary <string, string> additonProperty = new Dictionary <string, string>();

            additonProperty["IterationNameAndTime"] = "null";
            CriteriaOperator filter = new BinaryOperator("ProjectId", projectId);
            var iterationList       = _objectSpace.GetObjects("ProjectIteration", filter, additonProperty)
                                      .AsQueryable().OrderBy("StartDate desc");

            Katrin.Domain.Impl.ProjectTask task = this.GetSelectedEntity();
            Guid?defaultIterationId             = task.ProjectIterationId;
            var  displayNameFormat = "{0} ({1:yy/MM/dd} - {2:yy/MM/dd})";

            string unassignCaption = ResourceService.GetString("Unassigned");
            LookupListItem <Guid?> itemUnassign = new LookupListItem <Guid?>();

            itemUnassign.DisplayName = unassignCaption;
            itemUnassign.Value       = null;
            itemUnassign.IsDeafult   = task.ProjectIterationId == null;
            result.Add(itemUnassign);

            foreach (var iterationObj in iterationList)
            {
                var  iteration              = ConvertData.Convert <Katrin.Domain.Impl.ProjectIteration>(iterationObj);
                Guid projectIterationId     = iteration.ProjectIterationId;
                bool isDefault              = projectIterationId == defaultIterationId;
                LookupListItem <Guid?> item = new LookupListItem <Guid?>();
                item.Value       = projectIterationId;
                item.IsDeafult   = isDefault;
                item.DisplayName = string.Format(displayNameFormat, iteration.Name, iteration.StartDate, iteration.Deadline);
                result.Add(item);
            }
            return(result);
        }
        public void GiveTaskToMember(Guid?toMemberId)
        {
            Guid   projectTaskId = this._objectSpace.GetObjectId(this.ObjectName, this.SelectedObject);
            object projectTask   = this._objectSpace.GetOrNew(this.ObjectName, projectTaskId, null);

            Katrin.Domain.Impl.ProjectTask task = projectTask as Katrin.Domain.Impl.ProjectTask;
            task.OwnerId = toMemberId;
            this._objectSpace.SaveChanges();
            this.BindListData();

            //update detail
            IList <ProjectTaskDetailController> controllers =
                this.Context.AppContext.ControllerFinder.FinController <ProjectTaskDetailController>("ProjectTaskDetail");
            var detailControllers = controllers.Where(p => p.ObjectId == task.TaskId);

            foreach (var controller in detailControllers)
            {
                controller.UpdateOwerId(toMemberId);
            }
        }
        public void MoveTaskToIteration(Guid?iterationId)
        {
            IObjectSpace iobjectSpace  = new ODataObjectSpace();
            Guid         projectTaskId = this._objectSpace.GetObjectId(this.ObjectName, this.SelectedObject);
            object       projectTask   = iobjectSpace.GetOrNew(this.ObjectName, projectTaskId, null);

            Katrin.Domain.Impl.ProjectTask task = projectTask as Katrin.Domain.Impl.ProjectTask;
            task.ProjectIterationId = iterationId;
            iobjectSpace.SaveChanges();
            this.BindListData();

            //update detail
            IList <ProjectTaskDetailController> controllers =
                this.Context.AppContext.ControllerFinder.FinController <ProjectTaskDetailController>("ProjectTaskDetail");
            var detailControllers = controllers.Where(p => p.ObjectId == task.TaskId);

            foreach (var controller in detailControllers)
            {
                controller.UpdateIteration(iterationId);
            }
        }
        private bool UpdateTask(TaskTimeHistory task)
        {
            var projectTask = new Katrin.Domain.Impl.ProjectTask();

            if (taskList.Select(c => c.TaskId).Contains(task.TaskId))
            {
                projectTask = taskList.Where(c => c.TaskId == task.TaskId).First();
            }
            else
            {
                projectTask = (Katrin.Domain.Impl.ProjectTask)_objectSpace.GetOrNew("ProjectTask", task.TaskId, null);
                taskList.Add(projectTask);
            }
            projectTask.ActualInput = Convert.ToDouble(projectTask.ActualInput ?? 0) + task.ActualInput;
            projectTask.Effort      = Convert.ToDouble(projectTask.Effort ?? 0) + task.Effort;
            if (task.TaskTimeHistoryId != Guid.Empty)
            {
                projectTask.Effort -= task.SourceEffort;
            }
            task.SourceEffort    = task.Effort;
            projectTask.Overtime = Convert.ToDouble(projectTask.Overtime ?? 0) + task.Overtime;
            if (task.TaskTimeHistoryId == Guid.Empty)
            {
                projectTask.Description = projectTask.Description ?? " " + task.Description;
            }

            TaskOperator.UpdateTaskStatus(projectTask);

            if (projectTask.Effort > projectTask.ActualWorkHours)
            {
                _newEffortView.ValidateResult = false;
                XtraMessageBox.Show(StringParser.Parse("OverEffortMessage"),
                                    StringParser.Parse("Katrin"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Example #7
0
        private bool UpdateTask(Katrin.Domain.Impl.ProjectTask taskEntity, TaskTimeHistory task)
        {
            if (taskEntity == null)
            {
                return(true);
            }
            taskEntity.ActualInput = Convert.ToDouble(taskEntity.ActualInput ?? 0) + task.ActualInput;
            taskEntity.Effort      = Convert.ToDouble(taskEntity.Effort ?? 0) + task.Effort;
            taskEntity.Overtime    = Convert.ToDouble(taskEntity.Overtime ?? 0) + task.Overtime;

            TaskOperator.UpdateTaskStatus(taskEntity);

            if (taskEntity.Effort > taskEntity.ActualWorkHours)
            {
                _taskEffortView.ValidateResult = false;
                XtraMessageBox.Show(StringParser.Parse("OverEffortMessage"),
                                    StringParser.Parse("Katrin"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Example #8
0
        public IEnumerable <LookupListItem <Guid?> > GetProjectMembersForMemu(Guid?projectId)
        {
            List <LookupListItem <Guid?> > result = new List <LookupListItem <Guid?> >();

            if (projectId == null)
            {
                return(result);
            }
            Dictionary <string, string> additonProperty = new Dictionary <string, string>();

            additonProperty["Member"] = "Member";

            CriteriaOperator filter = new BinaryOperator("ProjectId", projectId);
            var memberList          = _objectSpace.GetObjects("ProjectMember", filter, additonProperty);

            Katrin.Domain.Impl.ProjectTask task = this.GetSelectedEntity();
            //add unassign
            string unassignCaption = ResourceService.GetString("Unassigned");
            LookupListItem <Guid?> itemUnassign = new LookupListItem <Guid?>();

            itemUnassign.DisplayName = unassignCaption;
            itemUnassign.Value       = null;
            itemUnassign.IsDeafult   = task.OwnerId == null;
            result.Add(itemUnassign);

            foreach (var member in memberList)
            {
                var projectMemeber          = ConvertData.Convert <Katrin.Domain.Impl.ProjectMember>(member);
                LookupListItem <Guid?> item = new LookupListItem <Guid?>();
                item.Value       = projectMemeber.Member.UserId;
                item.IsDeafult   = task.OwnerId == item.Value;
                item.DisplayName = projectMemeber.Member.FullName;
                result.Add(item);
            }
            return(result);
        }