//
        // GET: /Dashboard/

        public ActionResult Index()
        {
            PackageRepository.Package = new Package(PackageState.Complete);
            IList <PackageState> states = new List <PackageState>
            {
                PackageState.Received, PackageState.Processing, PackageState.Complete
            };

            int selectedStateId = 2; // hard code for demo

            IEnumerable <SelectListItem> selectList =
                from s in states
                select new SelectListItem
            {
                Selected = (s.Id == selectedStateId),
                Text     = s.Name,
                Value    = s.Id.ToString()
            };

            // Do this if you don't care about selection
            //            List<SelectListItem> selectList = states.Select(state => new SelectListItem {Value = state.Id.ToString(), Text = state.Name}).ToList();

            var model = new DashboardIndexModel {
                Package = PackageRepository.Package, PackageStates = selectList
            };

            return(View(model));
        }
Esempio n. 2
0
        public async Task <ActionResult> Index()
        {
            if (User.IsInRole(RoleNames.LocalContentOfficer))
            {
                return(RedirectToAction("Index", "LocalContentSettings"));
            }

            if (User.IsInRole(RoleNames.MandatoryListOfficer) || User.IsInRole(RoleNames.MandatoryListApprover))
            {
                return(RedirectToAction("Index", "MandatoryList"));
            }

            if (User.IsInRole(RoleNames.ProductManager) || User.IsInRole(RoleNames.ProductManagerDisplay))
            {
                return(RedirectToAction("EditAddedValue", "Tender"));
            }

            if (User.IsInRole(RoleNames.UnitSpecialistLevel1) || User.IsInRole(RoleNames.UnitSpecialistLevel2) || User.IsInRole(RoleNames.UnitSecretaryUser) || User.IsInRole(RoleNames.UnitManagerUser))
            {
                return(RedirectToAction(nameof(UnitUsersDashboardIndexAsync)));
            }
            var roles = ((ClaimsIdentity)User.Identity).Claims
                        .Where(c => c.Type == ClaimTypes.Role)
                        .Select(c => c.Value);

            if (roles.Count() == 0)
            {
                return(RedirectToAction("AllTendersForVisitor", "Tender"));
            }

            if (User.IsInRole(RoleNames.MonafasatAccountManager) || User.IsInRole(RoleNames.CustomerService) || User.IsInRole(RoleNames.FinancialSupervisor) || roles.Count() == 0)
            {
                return(RedirectToAction("Index", "Tender"));
            }
            if (User.IsInRole(RoleNames.UnAssingedUser))
            {
                return(RedirectToAction("UnAssingedUser", "Home"));
            }
            DashboardIndexModel model = new DashboardIndexModel();

            return(View(model));
        }
Esempio n. 3
0
        public async Task <ActionResult> UnitUsersDashboardIndexAsync()
        {
            DashboardIndexModel model = new DashboardIndexModel();

            return(View("/Views/Dashboard/Unit/UnitUsersDashboardIndexAsync.cshtml", model));
        }