Пример #1
0
        public EventCustomerScheduleModel Create(IEnumerable <EventCustomer> eventCustomers, IEnumerable <Appointment> appointments, IEnumerable <Order> orders, EventVolumeModel eventModel,
                                                 IEnumerable <Customer> customers, IEnumerable <OrderedPair <long, string> > packages, IEnumerable <OrderedPair <long, string> > tests, IEnumerable <OrderedPair <long, string> > products)
        {
            var eventCustomerModel = new EventCustomerScheduleModel
            {
                Address =
                    eventModel.Address,
                EventDate =
                    eventModel.EventDate,
                EventId =
                    eventModel.EventCode,
                Location =
                    eventModel.Location,
                Vehicle =
                    eventModel.Pod,
                CustomerCount = eventModel.AppointmentsBooked,
                Customers     =
                    CreateCustomerScheduleModelforEvent(eventCustomers, appointments, orders, eventModel.EventCode, customers, packages, tests, products)
            };

            if (eventCustomerModel.Customers != null && eventCustomerModel.Customers.Count() > 0)
            {
                eventCustomerModel.Customers = eventCustomerModel.Customers.OrderBy(c => c.AppointmentTime);
            }

            return(eventCustomerModel);
        }
Пример #2
0
        public EventCustomerScheduleListModel Create(IEnumerable <EventCustomer> eventCustomers, IEnumerable <Appointment> appointments, IEnumerable <Order> orders, EventVolumeListModel eventListModel,
                                                     IEnumerable <Customer> customers, IEnumerable <OrderedPair <long, string> > packages, IEnumerable <OrderedPair <long, string> > tests, IEnumerable <OrderedPair <long, string> > products)
        {
            var model = new EventCustomerScheduleListModel();
            var eventCustomerModels = new List <EventCustomerScheduleModel>();

            eventListModel.Collection.ToList().ForEach(e =>
            {
                var eventCustomerModel = new EventCustomerScheduleModel
                {
                    Address   = e.Address,
                    EventDate = e.EventDate,
                    EventId   = e.EventCode,
                    Location  = e.Location,

                    Vehicle       = e.Pod,
                    CustomerCount = e.AppointmentsBooked,
                    Customers     =
                        CreateCustomerScheduleModelforEvent(eventCustomers, appointments, orders, e.EventCode, customers, packages, tests, products)
                };
                eventCustomerModels.Add(eventCustomerModel);
            });
            if (eventCustomerModels != null)
            {
                eventCustomerModels = eventCustomerModels.OrderBy(a => a.EventDate).ToList();
            }
            model.Collection = eventCustomerModels;
            return(model);
        }