// GET: Projects
        public ActionResult Projects()
        {
            // get the agency for which the logged in user is associated
            T_OE_USERS u = db_Accounts.GetT_OE_USERSByIDX(db_Accounts.GetUserIDX());

            if (u != null && u.ORG_IDX != null)
            {
                var model = new vmDashboardProjects();
                model.projects = db_EECIP.GetT_OE_PROJECTS_ByOrgIDX(u.ORG_IDX.ConvertOrDefault <Guid>());

                return(View(model));
            }

            TempData["Error"] = "You are not associated with an agency.";
            return(RedirectToAction("AccessDenied", "Home"));
        }
        // GET: /Dashboard/Projects
        public ActionResult Projects(Guid?selAgency)
        {
            int UserIDX = db_Accounts.GetUserIDX();

            if (selAgency == null || selAgency == Guid.Empty)
            {
                // get agency for which the logged in user is associated
                T_OE_USERS u = db_Accounts.GetT_OE_USERSByIDX(UserIDX);
                if (u != null && u.ORG_IDX != null)
                {
                    selAgency = u.ORG_IDX.ConvertOrDefault <Guid>();
                }
            }

            //if still no agency (and not an Admin, then return error)
            if (!User.IsInRole("Admins") && (selAgency == null || selAgency == Guid.Empty || !db_Accounts.UserCanEditOrgIDX(UserIDX, selAgency.ConvertOrDefault <Guid>())))
            {
                TempData["Error"] = "You are not associated with an agency.";
                return(RedirectToAction("AccessDenied", "Home"));
            }


            var model           = new vmDashboardProjects();
            T_OE_ORGANIZATION o = db_Ref.GetT_OE_ORGANIZATION_ByID(selAgency.ConvertOrDefault <Guid>());

            if (o != null)
            {
                model.selAgencyName = o.ORG_NAME;
            }

            model.projects  = db_EECIP.GetT_OE_PROJECTS_ByOrgIDX(selAgency.ConvertOrDefault <Guid>());
            model.selAgency = selAgency;

            if (User.IsInRole("Admins"))
            {
                model.ddl_Agencies = ddlHelpers.get_ddl_organizations(true, true);
            }

            return(View(model));
        }