Пример #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
        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();
        }