Beispiel #1
0
        //public static SelectList AllActiveCampaignsForUserListDropDown(Guid appUserId)
        //{
        //    return new SelectList(CampaignHelpers.GetAllCampaignsForUser(appUserId), "CampaignId", "Name");
        //}

        public static SelectList AllActiveCampaignsForUserListDropDown(Guid appUserId, Guid?selectedCampaignId)
        {
            if (selectedCampaignId == null)
            {
                return(new SelectList(CampaignHelpers.GetAllCampaignsForUser(appUserId, false), "CampaignId", "Name", "Select campaign"));
            }
            else
            {
                return(new SelectList(CampaignHelpers.GetAllCampaignsForUser(appUserId, false), "CampaignId", "Name", selectedCampaignId));
            }
        }
        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);
        }