Beispiel #1
0
        private StaffEventSchedulingListModel GetStaffEventScheduleCsvModel(IEnumerable <EventStaffAssignmentViewModel> collection, IEnumerable <OrderedPair <long, string> > eventIdSponsorPairs)
        {
            var listModel  = new StaffEventSchedulingListModel();
            var exportList = new List <StaffEventSchedulingModel>();

            foreach (var eventStaffAssignmentViewModel in collection)
            {
                var esavm = eventStaffAssignmentViewModel;
                foreach (var staff in esavm.AssignedStaff)
                {
                    var staffDetails       = staff;
                    var eventIdSponsorPair = eventIdSponsorPairs.FirstOrDefault(x => x.FirstValue == esavm.Event.Id);
                    var sponsor            = eventIdSponsorPair == null ? "N/A" : eventIdSponsorPair.SecondValue;

                    var staffEventSchedulingModel = new StaffEventSchedulingModel
                    {
                        EventAddressStreet12 = esavm.Event.HostAddress.StreetAddressLine1 + " " + eventStaffAssignmentViewModel.Event.HostAddress.StreetAddressLine2,
                        EventCity            = esavm.Event.HostAddress.City,
                        EventDate            = esavm.Event.EventDate,
                        EventId        = esavm.Event.Id,
                        EventStateName = esavm.Event.HostAddress.State,
                        EventZipCode   = esavm.Event.HostAddress.ZipCode,
                        Pod            = esavm.Event.PodNames(),
                        StaffEventRole = staffDetails.EventRole,
                        StaffFullName  = staffDetails.FullName,
                        Sponsor        = sponsor,
                        EmployeeId     = string.IsNullOrEmpty(staffDetails.EmployeeId) ? "N/A" : staffDetails.EmployeeId
                    };
                    exportList.Add(staffEventSchedulingModel);
                }
            }
            listModel.Collection = exportList;
            return(listModel);
        }
Beispiel #2
0
        public ActionResult StaffEventScheduleCompleted(string id, StaffEventSchedulingListModel model)
        {
            if (id == null)
            {
                return(Content("Model can't be null."));
            }

            if (model == null || model.Collection == null || !model.Collection.Any())
            {
                return(Content("Model can't be null."));
            }

            RemoveProcess(id);
            var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <StaffEventSchedulingModel>();

            var message = WriteCsv("StaffEventSchedule.csv", exporter, model.Collection, RequestSubcriberChannelNames.StaffEventAssignmentExportQueue, RequestSubcriberChannelNames.StaffEventAssignmentExportChannel);

            return(Content(message));
        }