Beispiel #1
0
 public static OrderDetailsModel GetOrderDetails(this IEmployerOrdersQuery employerOrdersQuery, ICreditsQuery creditsQuery, Order order, IEnumerable <Product> products)
 {
     return(new OrderDetailsModel
     {
         Order = order,
         Products = products.ToList(),
         OrderProducts = GetOrderProducts(order, products),
         Credits = creditsQuery.GetCredits().ToDictionary(c => c.Id, c => c),
     });
 }
Beispiel #2
0
        public ActionResult Index(Guid id)
        {
            var organisation = _organisationsQuery.GetOrganisation(id);

            if (organisation == null)
            {
                return(NotFound("organisation", "id", id));
            }

            var credits = _creditsQuery.GetCredits();

            return(View(new OrganisationCreditsModel
            {
                Organisation = organisation,
                Allocations = new Dictionary <Guid, IList <Allocation> > {
                    { organisation.Id, GetAllocations(organisation.Id) }
                },
                Credits = credits,
                CreditId = credits[0].Id,
                Orders = _ordersQuery.GetOrders(organisation.Id)
            }));
        }
Beispiel #3
0
        public ActionResult Index(Guid id)
        {
            var employer = _employersQuery.GetEmployer(id);

            if (employer == null)
            {
                return(NotFound("employer", "id", id));
            }

            var credits = _creditsQuery.GetCredits();

            return(View(new EmployerCreditsModel
            {
                Employer = employer,
                Allocations = new Dictionary <Guid, IList <Allocation> > {
                    { employer.Id, GetAllocations(employer.Id) }
                },
                Credits = credits,
                CreditId = _creditsQuery.GetCredit <ContactCredit>().Id,
                Orders = _ordersQuery.GetOrders(employer.Id)
            }));
        }
Beispiel #4
0
        public ActionResult Credits()
        {
            var employerId = User.Id().Value;

            var credits = _creditsQuery.GetCredits();

            var hierarchy   = _recruitersQuery.GetOrganisationHierarchyPath(employerId);
            var allocations = _allocationsQuery.GetAllocationsByOwnerId(hierarchy);

            var orders = _ordersQuery.GetOrders(from a in allocations.SelectMany(b => b.Value) where a.ReferenceId != null select a.ReferenceId.Value);

            return(View(new EmployerCreditsModel
            {
                Employer = CurrentEmployer,
                OrganisationHierarchy = _organisationsQuery.GetOrganisations(hierarchy.Skip(1)),
                Credits = credits,
                Allocations = allocations.ToDictionary(a => a.Key, a => (IList <Allocation>)a.Value),
                Orders = orders
            }));
        }
Beispiel #5
0
 private Credit GetCredit(string text)
 {
     return((from c in _creditsQuery.GetCredits() where c.ShortDescription == text select c).Single());
 }