示例#1
0
        private void RemoveWorkpackAssignment(WORKPACK_ASSIGNMENT removeWORKPACK_ASSIGNMENT)
        {
            decimal            removingWORKPACK_ASSIGNMENTLowValue = removeWORKPACK_ASSIGNMENT.LOW_VALUE;
            WORKPACK_Dashboard activeWORKPACK = WORKPACKSItemSource.FirstOrDefault(x => x.WORKPACK.GUID == removeWORKPACK_ASSIGNMENT.GUID_WORKPACK);

            if (activeWORKPACK == null)
            {
                return;
            }

            activeWORKPACK.WORKPACK.WORKPACK_ASSIGNMENT.Remove(removeWORKPACK_ASSIGNMENT);
            WORKPACK_ASSIGNMENTSViewModel.Delete(removeWORKPACK_ASSIGNMENT);

            List <WORKPACK_ASSIGNMENT> workpackAssignmentsInOrder = activeWORKPACK.ObservableWORKPACK_ASSIGNMENTS.Where(x => x.LOW_VALUE > removingWORKPACK_ASSIGNMENTLowValue).OrderBy(x => x.PRIORITY).ToList();

            for (int i = 0; i < workpackAssignmentsInOrder.Count; i++)
            {
                decimal currentWORKPACK_ASSIGNMENTAmount = (workpackAssignmentsInOrder[i].HIGH_VALUE - workpackAssignmentsInOrder[i].LOW_VALUE) + 1;
                workpackAssignmentsInOrder[i].LOW_VALUE  = removingWORKPACK_ASSIGNMENTLowValue;
                workpackAssignmentsInOrder[i].HIGH_VALUE = (removingWORKPACK_ASSIGNMENTLowValue + currentWORKPACK_ASSIGNMENTAmount) - 1;
                removingWORKPACK_ASSIGNMENTLowValue      = workpackAssignmentsInOrder[i].HIGH_VALUE + 1;
                workpackAssignmentsInOrder[i].PRIORITY   = workpackAssignmentsInOrder[i].PRIORITY - 1;
            }

            WORKPACK_ASSIGNMENTSViewModel.BulkSave(new ObservableCollection <WORKPACK_ASSIGNMENT>(workpackAssignmentsInOrder));
        }
示例#2
0
        public void AddAssignment()
        {
            WORKPACK_ASSIGNMENT newWORKPACK_ASSIGNMENT = new WORKPACK_ASSIGNMENT()
            {
                GUID               = Guid.Empty,
                HIGH_VALUE         = this.AssignmentHighValue,
                LOW_VALUE          = this.AssignmentLowValue,
                P6_ACTIVITYID      = this.SelectedTASK.Subject,
                PRIORITY           = this.SelectedWORKPACK.ObservableWORKPACK_ASSIGNMENTS.Count + 1,
                GUID_WORKPACK      = this.SelectedWORKPACK.GUID,
                ISMODIFIEDBASELINE = this.IsModified
            };

            WORKPACK_ASSIGNMENTSViewModel.Save(newWORKPACK_ASSIGNMENT);
            this.SelectedWORKPACK.WORKPACK.WORKPACK_ASSIGNMENT.Add(newWORKPACK_ASSIGNMENT);
            this.SelectedWORKPACK_ASSIGNMENT = newWORKPACK_ASSIGNMENT;

            if (this.AssignmentMinValue == 0)
            {
                this.AssignmentHighValue = 0;
            }
            else if (this.AssignmentMinValue > AssignmentMaxValue)
            {
                this.AssignmentHighValue = AssignmentMaxValue;
            }
            else
            {
                this.AssignmentHighValue = this.AssignmentMinValue;
            }

            Refresh();
        }
示例#3
0
        private void MovePriority(bool isUp)
        {
            List <WORKPACK_ASSIGNMENT> WORKPACK_ASSIGNMENTSInOrder = this.SelectedWORKPACK.ObservableWORKPACK_ASSIGNMENTS.OrderBy(x => x.PRIORITY).ToList();
            int selectionIndex = WORKPACK_ASSIGNMENTSInOrder.IndexOf(SelectedWORKPACK_ASSIGNMENT);
            WORKPACK_ASSIGNMENT swapWORKPACK_ASSIGNMENT = WORKPACK_ASSIGNMENTSInOrder[selectionIndex + (isUp == true ? -1 : 1)];
            string swapWORKPACK_ASSIGNMENTId            = swapWORKPACK_ASSIGNMENT.P6_ACTIVITYID;

            swapWORKPACK_ASSIGNMENT.P6_ACTIVITYID     = SelectedWORKPACK_ASSIGNMENT.P6_ACTIVITYID;
            SelectedWORKPACK_ASSIGNMENT.P6_ACTIVITYID = swapWORKPACK_ASSIGNMENTId;
            WORKPACK_ASSIGNMENTSViewModel.BulkSave(new ObservableCollection <WORKPACK_ASSIGNMENT>(WORKPACK_ASSIGNMENTSInOrder));

            this.SelectedWORKPACK_ASSIGNMENT = swapWORKPACK_ASSIGNMENT;
            Refresh();
        }