예제 #1
0
        public void ProcessBookingAllocations(IList <BookingAllocationResortTeamRequest> bookingAllocationResortTeamRequests)
        {
            if (bookingAllocationResortTeamRequests == null || bookingAllocationResortTeamRequests.Count == 0)
            {
                return;
            }

            var assignRequests = new Collection <AssignInformation>();

            for (int i = 0; i < bookingAllocationResortTeamRequests.Count; i++)
            {
                if (bookingAllocationResortTeamRequests[i] == null)
                {
                    continue;
                }

                var bookingTeamRequest = bookingAllocationResortTeamRequests[i];
                if (bookingTeamRequest.BookingResortTeamRequest != null)
                {
                    var assignBookingRequest = new AssignInformation
                    {
                        EntityName  = EntityName.Booking,
                        RecordId    = bookingTeamRequest.BookingResortTeamRequest.Id,
                        RecordName  = bookingTeamRequest.BookingResortTeamRequest.Name,
                        RecordOwner = bookingTeamRequest.BookingResortTeamRequest.Owner
                    };
                    assignRequests.Add(assignBookingRequest);
                }
                if (bookingTeamRequest.CustomerResortTeamRequest != null)
                {
                    var assignCustomerRequest = new AssignInformation
                    {
                        EntityName  = bookingTeamRequest.CustomerResortTeamRequest.Customer.CustomerType.ToString(),
                        RecordId    = bookingTeamRequest.CustomerResortTeamRequest.Customer.Id,
                        RecordName  = bookingTeamRequest.CustomerResortTeamRequest.Customer.Name,
                        RecordOwner = bookingTeamRequest.CustomerResortTeamRequest.Owner
                    };
                    assignRequests.Add(assignCustomerRequest);
                }
            }

            if (assignRequests != null && assignRequests.Count > 0)
            {
                crmService.BulkAssign(assignRequests);
            }
        }