private void AddItems(IList taskTimeHistoryList, dynamic taskDyanmic)
 {
     taskTimeHistoryList = taskTimeHistoryList.AsQueryable().Where("IsDeleted=false").OrderBy("RecordOn desc").ToArrayList();
     foreach (var historyItemObject in taskTimeHistoryList)
     {
         _isManager = true;
         var             historyItem = historyItemObject.AsDyanmic();
         TaskTimeHistory item        = new TaskTimeHistory();
         item.ProjectName       = taskDyanmic.ProjectName;
         item.IterationName     = taskDyanmic.IterationName;
         item.TaskId            = taskDyanmic.TaskId;
         item.Name              = taskDyanmic.Name;
         item.ActualWorkHours   = taskDyanmic.ActualWorkHours;
         item.RecordOn          = historyItem.RecordOn;
         item.ActualInput       = historyItem.ActualInput;
         item.Description       = historyItem.Description;
         item.Effort            = historyItem.Effort;
         item.SourceEffort      = item.Effort;
         item.Overtime          = historyItem.Overtime;
         item.RemainderTime     = taskDyanmic.ActualWorkHours - taskDyanmic.Effort;
         item.TaskTimeHistoryId = historyItem.TaskTimeHistoryId;
         item.RecordPerson      = GetUserName(historyItem.CreatedById);
         _projectTaskList.Add(item);
     }
 }
 private bool UpdateTask(dynamic entity, TaskTimeHistory task)
 {
     if (entity == null)
     {
         return(true);
     }
     entity.ActualInput = Convert.ToDouble(entity.ActualInput ?? 0) + task.ActualInput;
     entity.Effort      = Convert.ToDouble(entity.Effort ?? 0) + task.Effort;
     entity.Overtime    = Convert.ToDouble(entity.Overtime ?? 0) + task.Overtime;
     if (entity.ActualWorkHours - entity.Effort <= 0)
     {
         entity.StatusCode = 3;
     }
     else if (entity.StatusCode == 1 || entity.ActualWorkHours - entity.Effort > 0)
     {
         entity.StatusCode = 2;
     }
     if (entity.Effort > entity.ActualWorkHours)
     {
         View.ValidateResult = false;
         XtraMessageBox.Show(Properties.Resources.OverEffortMessage,
                             Properties.Resources.Katrin,
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Information,
                             MessageBoxDefaultButton.Button1);
         return(false);
     }
     return(true);
 }
示例#3
0
        private bool UpdateTask(TaskTimeHistory task)
        {
            var entityOjbect = DynamicDataServiceContext.GetOrNew("ProjectTask", task.TaskId);
            var entity       = entityOjbect.AsDyanmic();

            entity.ActualInput = Convert.ToDouble(entity.ActualInput ?? 0) + task.ActualInput;
            entity.Effort      = Convert.ToDouble(entity.Effort ?? 0) + task.Effort;
            entity.Overtime    = Convert.ToDouble(entity.Overtime ?? 0) + task.Overtime;
            if (task.TaskTimeHistoryId == Guid.Empty)
            {
                entity.Description = entity.Description ?? " " + task.Description;
            }
            if (entity.ActualWorkHours - entity.Effort <= 0)
            {
                entity.StatusCode = 3;
            }
            else if (entity.StatusCode == 1 || entity.ActualWorkHours - entity.Effort > 0)
            {
                entity.StatusCode = 2;
            }
            if (entity.Effort > entity.ActualWorkHours)
            {
                View.ValidateResult = false;
                XtraMessageBox.Show(Properties.Resources.OverEffortMessage,
                                    Properties.Resources.Katrin,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
        private void SetHistory(TaskTimeHistory task)
        {
            var taskTimeHistory = DynamicDataServiceContext.GetOrNew("TaskTimeHistory", task.TaskTimeHistoryId).AsDyanmic();

            task.TaskTimeHistoryId      = taskTimeHistory.TaskTimeHistoryId;
            taskTimeHistory.TaskId      = task.TaskId;
            taskTimeHistory.ActualInput = task.ActualInput;
            taskTimeHistory.Effort      = task.Effort;
            taskTimeHistory.Overtime    = task.Overtime;
            taskTimeHistory.Description = task.Description;
            taskTimeHistory.RecordOn    = task.RecordOn;
        }
 protected override void OnViewSet()
 {
     View.OnCreateData            += OnCreateData;
     View.OnDeleteData            += OnDeleteData;
     _users                        = DynamicDataServiceContext.GetObjects("User");
     _editTaskTimeHistory          = new TaskTimeHistory();
     _editTaskTimeHistory.RecordOn = DateTime.Today;
     InitData();
     View.Bind(new List <TaskTimeHistory>()
     {
         _editTaskTimeHistory
     });
 }
        private void OnDeleteData(object sender, EventArgs <int> e)
        {
            if (_projectTaskList.Count <= e.Data)
            {
                return;
            }
            TaskTimeHistory task = _projectTaskList[e.Data];

            if (task == null)
            {
                return;
            }
            if (task.TaskTimeHistoryId != Guid.Empty)
            {
                _deleteTaskList.Add(task);
            }
            _projectTaskList.Remove(task);
            View.Bind(_projectTaskList);
        }
示例#7
0
        private void SinglePersonData()
        {
            var extraColumns = new Dictionary <string, string>
            {
                { "Project", "Project" }
            };
            CriteriaOperator filter = new BinaryOperator("OwnerId", AuthorizationManager.CurrentUserId, BinaryOperatorType.Equal);

            filter &= new BinaryOperator("StartDate", DateTime.Today, BinaryOperatorType.LessOrEqual);
            filter &= new BinaryOperator(new OperandProperty("ActualWorkHours"), new OperandProperty("Effort"), BinaryOperatorType.Greater);
            if (EntityId != Guid.Empty)
            {
                filter &= new BinaryOperator("TaskId", EntityId, BinaryOperatorType.Equal);
            }
            var ownerProjectTasks = DynamicDataServiceContext.GetObjects("ProjectTask", filter, extraColumns);

            if (ownerProjectTasks != null && ownerProjectTasks.ToArrayList().Count > 0)
            {
                foreach (var task in ownerProjectTasks)
                {
                    TaskTimeHistory item    = new TaskTimeHistory();
                    var             dyanmic = task.AsDyanmic();

                    item.TaskId            = dyanmic.TaskId;
                    item.Name              = dyanmic.Name;
                    item.ActualWorkHours   = dyanmic.ActualWorkHours;
                    item.RecordOn          = DateTime.Today;
                    item.RemainderTime     = dyanmic.ActualWorkHours - dyanmic.Effort;
                    item.TaskTimeHistoryId = Guid.Empty;
                    item.RecordPerson      = GetUserName(AuthorizationManager.CurrentUserId);
                    if (dyanmic.Project != null)
                    {
                        item.ProjectName = dyanmic.Project.Name;
                    }
                    _projectTaskList.Insert(0, item);
                }
            }
        }