Exemplo n.º 1
0
        public static DashboardView GetDashboardViewLogin(ApplicationDbContext db, IPrincipal user)
        {
            AppUser appUser = AppUserHelpers.GetAppUser(db, user);

            //initialise the view
            DashboardView dashboardView = new DashboardView();

            //get the campaigns and listings for this user
            List <Campaign> campaignsForUser = CampaignHelpers.GetAllCampaignsForUser(db, appUser.AppUserId, false);

            dashboardView.CampaignList = campaignsForUser;

            List <Campaign> campaignsDashboardList = CampaignHelpers.GetAllDashboardFilteredCampaigns(db, appUser.AppUserId);

            dashboardView.CampaignDashboardList = campaignsDashboardList;

            List <RequirementListing> requirementListingsForUser = RequirementListingHelpers.GetAllRequirementListingsForUser(db, appUser.AppUserId, false);

            dashboardView.RequirementListingList = requirementListingsForUser;

            List <RequirementListing> requirementListingDashboardList = RequirementListingHelpers.GetAllDashboardFilteredRequirementListings(db, appUser.AppUserId);

            dashboardView.RequirementListingDashboardList = requirementListingDashboardList;

            List <AvailableListing> availableListingsForUser = AvailableListingHelpers.GetAllAvailableListingsForUser(db, appUser.AppUserId, false);

            dashboardView.AvailableListingList = availableListingsForUser;

            List <AvailableListing> availableListingDashboardList = AvailableListingHelpers.GetAllDashboardFilteredAvailableListings(db, appUser.AppUserId);

            dashboardView.AvailableListingDashboardList = availableListingDashboardList;

            List <Offer> offersForUser = OfferHelpers.GetAllOffersForUser(db, appUser.AppUserId, false);

            dashboardView.OfferList = offersForUser;

            List <Order> ordersForUser = OrderHelpers.GetAllOrdersForUser(db, appUser.AppUserId, false);

            dashboardView.OrderList = ordersForUser;

            //get listings for admin areas if this user is not a 'User' - i.e. is Manager, Admin etc.
            if (user.Identity.GetCurrentUserRole() != "User")
            {
                List <UserTask> tasksForUser = UserTaskHelpers.GetUserTasksForUser(db, appUser.AppUserId);
                //LSLSLS get list of 'actions' once written

                dashboardView.UserTaskList = tasksForUser;
            }

            return(dashboardView);
        }
Exemplo n.º 2
0
        public static List <OrderManageView> GetAllOrdersManageViewForUser(ApplicationDbContext db, IPrincipal user)
        {
            List <OrderManageView> allOrdersManageView = new List <OrderManageView>();

            AppUser      appUser          = AppUserHelpers.GetAppUser(db, user);
            List <Order> allOrdersForUser = OrderHelpers.GetAllOrdersForUser(db, appUser.AppUserId, false);

            foreach (Order orderForUser in allOrdersForUser)
            {
                OrderManageView orderManageView = new OrderManageView()
                {
                    OrderDetails = orderForUser
                };

                allOrdersManageView.Add(orderManageView);
            }

            return(allOrdersManageView);
        }