/// <summary> /// Removes resources from one job and transfer to another, with the CallLogs selected by the user. /// Generates a CallLog of the transfer result on each job. /// </summary> /// <param name="resourceList"></param> public void TransferResources(List<CS_Resource> oldResourceList, List<CS_Resource> newResourceList, Dictionary<int, Globals.TransferResource.TransferType> transferTypeList, List<int> callLogIdList, int fromJobId, int toJobId, string username) { using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { CallLogModel callLogModel = new CallLogModel(); //Removes resources from old job RemoveResources(oldResourceList); List<int> divisionIdList = new List<int>(); DivisionModel divisionModel = new DivisionModel(); //Get resources divisions List<CS_Division> divisionList = divisionModel.ListAllDivisionsByResources(oldResourceList); for (int i = 0; i < divisionList.Count; i++) { if (!divisionIdList.Exists(e => e == divisionList[i].ID)) divisionIdList.Add(divisionList[i].ID); } //Add resources to new job SaveOrUpdateResourceAllocation(toJobId, new List<CS_Reserve>(), newResourceList, username, divisionIdList, string.Empty, false, DateTime.Now, false, string.Empty, string.Empty); //Deletes the selected call logs and re-create on another job callLogModel.TransferExistingResourceCallLogs(oldResourceList, callLogIdList, toJobId, username); //Create parked calllog for equipments on old job //Create transfer calllog for both jobs, with callLogModel.CreateTransferResourceCallLogs(oldResourceList, transferTypeList, fromJobId, toJobId, username); scope.Complete(); } }