public ActionResult AgencyEdit(vmDashboardAgency model)
        {
            int UserIDX = db_Accounts.GetUserIDX();

            //CHECK PERMISSIONS
            if (User.IsInRole("Admins") || db_Accounts.UserCanEditOrgIDX(UserIDX, model.agency.ORG_IDX.ConvertOrDefault <Guid>()))
            {
                //update general agency data
                Guid?SuccID = db_Ref.InsertUpdatetT_OE_ORGANIZATION(model.agency.ORG_IDX, null, null, null, null, null, model.agency.CLOUD, model.agency.API, true, UserIDX);


                //update database tags
                db_Ref.DeleteT_OE_ORGANIZATION_TAGS(model.agency.ORG_IDX, "Database");
                foreach (string expertise in model.SelectedDatabase ?? new List <string>())
                {
                    db_Ref.InsertT_OE_ORGANIZATION_TAGS(model.agency.ORG_IDX, "Database", expertise);
                }


                //update app framework tags
                db_Ref.DeleteT_OE_ORGANIZATION_TAGS(model.agency.ORG_IDX, "App Framework");
                foreach (string expertise in model.SelectedAppFramework ?? new List <string>())
                {
                    db_Ref.InsertT_OE_ORGANIZATION_TAGS(model.agency.ORG_IDX, "App Framework", expertise);
                }


                //award agency profile badge
                if (db_Accounts.UserCanEditOrgIDX(UserIDX, model.agency.ORG_IDX.ConvertOrDefault <Guid>()))
                {
                    db_Forum.EarnBadgeController(UserIDX, "AgencyProfile");
                }


                //now update the Azure search
                AzureSearch.PopulateSearchIndexOrganization(SuccID);


                if (SuccID != null)
                {
                    TempData["Success"] = "Update successful.";
                }
                else
                {
                    TempData["Error"] = "Error updating data.";
                }
            }


            return(RedirectToAction("Agency", new { selAgency = model.agency.ORG_IDX }));
        }
Beispiel #2
0
        public ActionResult SearchAdminPopulateIndex()
        {
            try
            {
                //***********PROJECTS **************************
                //first reset all projects to unsynced
                db_EECIP.ResetT_OE_PROJECTS_Unsynced();

                //then send all unsynced projects to Azure
                AzureSearch.PopulateSearchIndexProject(null);


                //***********AGENCIES  **************************
                //reset all agencies to unsynced
                db_Ref.ResetT_OE_ORGANIZATION_Unsynced();

                //then send all unsynced agencies to Azure
                AzureSearch.PopulateSearchIndexOrganization(null);


                //***********ENT SERVICES  **************************
                db_EECIP.ResetT_OE_ORGANIZATION_ENT_SVCS_Unsynced();

                //then send all unsynced agencies to Azure
                AzureSearch.PopulateSearchIndexEntServices(null);


                //***********PEOPLE  **************************
                db_Accounts.ResetT_OE_USERS_Unsynced();

                //then send all unsynced agencies to Azure
                AzureSearch.PopulateSearchIndexUsers(null);


                //***********FORUM TOPICS  **************************
                db_Forum.UpdateTopic_SetAllUnsynced();

                //then send all unsynced agencies to Azure
                AzureSearch.PopulateSearchIndexForumTopic(null);


                TempData["Success"] = "Search index populated.";
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString().SubStringPlus(0, 100);
            }

            return(RedirectToAction("SearchAdmin", "Admin"));
        }
Beispiel #3
0
        public ActionResult RefAgencyEdit(T_OE_ORGANIZATION agency)
        {
            int UserIDX = db_Accounts.GetUserIDX();

            Guid?SuccID = db_Ref.InsertUpdatetT_OE_ORGANIZATION(agency.ORG_IDX, agency.ORG_ABBR, agency.ORG_NAME, agency.STATE_CD, agency.EPA_REGION, agency.ORG_TYPE, null, null, true, UserIDX);

            if (SuccID != null)
            {
                AzureSearch.PopulateSearchIndexOrganization(SuccID);
                TempData["Success"] = "Update successful.";
            }
            else
            {
                TempData["Error"] = "Error updating data.";
            }

            //return View(model);
            return(RedirectToAction("RefAgencyEdit", new { id = SuccID }));
        }