//Delete PseudoCityOrOfficeDefinedRegion public void Delete(PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeletePseudoCityOrOfficeDefinedRegion_v1( pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion.PseudoCityOrOfficeDefinedRegionId, adminUserGuid, pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion.VersionNumber ); }
//Add PseudoCityOrOfficeDefinedRegion public void Add(PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_InsertPseudoCityOrOfficeDefinedRegion_v1( pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion.PseudoCityOrOfficeDefinedRegionName, pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion.GlobalRegionCode, adminUserGuid ); }
public ActionResult Create(PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM) { //Set Access Rights ViewData["Access"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Update Model from Form try { TryUpdateModel <PseudoCityOrOfficeDefinedRegionVM>(pseudoCityOrOfficeDefinedRegionVM, "GDSPseudoCityOrOfficeDefinedRegionVM"); } catch { string n = ""; foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { n += error.ErrorMessage; } } ViewData["Message"] = "ValidationError : " + n; return(View("Error")); } try { pseudoCityOrOfficeDefinedRegionRepository.Add(pseudoCityOrOfficeDefinedRegionVM); } catch (SqlException ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List")); }
public ActionResult Delete(PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM, FormCollection collection) { //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get Item From Database PseudoCityOrOfficeDefinedRegion pseudoCityOrOfficeDefinedRegion = new PseudoCityOrOfficeDefinedRegion(); pseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegionRepository.GetPseudoCityOrOfficeDefinedRegion(pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion.PseudoCityOrOfficeDefinedRegionId); //Check Exists if (pseudoCityOrOfficeDefinedRegion == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Delete Item try { pseudoCityOrOfficeDefinedRegionRepository.Delete(pseudoCityOrOfficeDefinedRegionVM); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/PseudoCityOrOfficeDefinedRegion.mvc/Delete/" + pseudoCityOrOfficeDefinedRegion.PseudoCityOrOfficeDefinedRegionId; return(View("VersionError")); } LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List")); }
public ActionResult Create() { //Set Access Rights ViewData["Access"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM = new PseudoCityOrOfficeDefinedRegionVM(); PseudoCityOrOfficeDefinedRegion pseudoCityOrOfficeDefinedRegion = new PseudoCityOrOfficeDefinedRegion(); pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegion; //GlobalRegions pseudoCityOrOfficeDefinedRegionVM.GlobalRegions = new SelectList(hierarchyRepository.GetAllGlobalRegions().ToList(), "GlobalRegionCode", "GlobalRegionName"); return(View(pseudoCityOrOfficeDefinedRegionVM)); }
public ActionResult Delete(int id) { PseudoCityOrOfficeDefinedRegion pseudoCityOrOfficeDefinedRegion = new PseudoCityOrOfficeDefinedRegion(); pseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegionRepository.GetPseudoCityOrOfficeDefinedRegion(id); //Check Exists if (pseudoCityOrOfficeDefinedRegion == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //Check AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM = new PseudoCityOrOfficeDefinedRegionVM(); pseudoCityOrOfficeDefinedRegionVM.AllowDelete = true; //Attached Items List <PseudoCityOrOfficeDefinedRegionReference> pseudoCityOrOfficeDefinedRegionReferences = pseudoCityOrOfficeDefinedRegionRepository.GetPseudoCityOrOfficeDefinedRegionReferences(pseudoCityOrOfficeDefinedRegion.PseudoCityOrOfficeDefinedRegionId); if (pseudoCityOrOfficeDefinedRegionReferences.Count > 0) { pseudoCityOrOfficeDefinedRegionVM.AllowDelete = false; pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegionReferences = pseudoCityOrOfficeDefinedRegionReferences; } pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegion; return(View(pseudoCityOrOfficeDefinedRegionVM)); }
// GET: /Edit public ActionResult Edit(int id) { //Set Access Rights ViewData["Access"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } PseudoCityOrOfficeDefinedRegion pseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegionRepository.GetPseudoCityOrOfficeDefinedRegion(id); //Check Exists if (pseudoCityOrOfficeDefinedRegion == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PseudoCityOrOfficeDefinedRegionVM pseudoCityOrOfficeDefinedRegionVM = new PseudoCityOrOfficeDefinedRegionVM(); pseudoCityOrOfficeDefinedRegionVM.PseudoCityOrOfficeDefinedRegion = pseudoCityOrOfficeDefinedRegion; //GlobalRegions pseudoCityOrOfficeDefinedRegionVM.GlobalRegions = new SelectList(hierarchyRepository.GetAllGlobalRegions().ToList(), "GlobalRegionCode", "GlobalRegionName", pseudoCityOrOfficeDefinedRegion.GlobalRegionCode); return(View(pseudoCityOrOfficeDefinedRegionVM)); }