public ActionResult OrganizationAccessRequestConfirmation(OrganizationViewModel viewModel, FormCollection collection, string phoneNumber, string jobTitle) { viewModel = SystemViewModelData.BuildUpOrganizationViewModel(viewModel.Entity.ID); //Get the contact for the current user Contact contact = Repository.OrganizationContacts.GetByAccount(CurrentAccountID); //Figures out who to send the "Request" to and delivers the emails too. var evnt = Services.Events.CreateOrganizationAccessRequest(viewModel.Entity, contact, phoneNumber, jobTitle); if (evnt != null) { //There can be 3 possibilities. They are: //1. the ball is in the organizations regulator contacts (OrgUserARNotificiation) court to approve/deny request. //2. the ball is in the Organization Contact's (lead users) court to approve/deny request. //3. the ball is in the CERS Help Center's court to approve/deny request. viewModel.EvtTicketCode = evnt.TicketCode; viewModel.EvtTypeCode = evnt.GetEventTypeCode(); viewModel.Regulator = evnt.Regulator; if (evnt.Notifications.Count > 0) { List <Contact> contacts = new List <Contact>(); evnt.Notifications.ToList().ForEach(n => contacts.Add(n.Contact)); viewModel.NotificationContacts = contacts; } } return(View(viewModel)); }
public ActionResult CreateNewOrganization() { OrganizationViewModel viewModel = SystemViewModelData.BuildUpOrganizationViewModel(); viewModel.CheckDuplicates = true; return(View(viewModel)); }
public ActionResult ExistingOrganizations(string organizationName) { OrganizationViewModel viewModel = SystemViewModelData.BuildUpOrganizationViewModel(); viewModel.Entity.OriginID = 6; viewModel.Entity.Name = organizationName; return(View(viewModel)); }
public ActionResult AddBusiness() { OrganizationViewModel viewModel = SystemViewModelData.BuildUpOrganizationViewModel(); viewModel.Origins = viewModel.Origins.Where(p => p.ID == 6); viewModel.Entity.OriginID = 6; viewModel.RegulatorsApprovingFacilityTransfer = Repository.Regulators.Search(applySecurityFilter: true, matrices: CurrentUserRoles); return(View(viewModel)); }
public ActionResult OrganizationAccessRequest(int id) { OrganizationViewModel viewModel = SystemViewModelData.BuildUpOrganizationViewModel(id); var oarTarget = Services.Events.GetOrganizationAccessRequestTarget(viewModel.Entity); viewModel.EvtTypeCode = oarTarget.Type; viewModel.Regulator = oarTarget.Regulator; viewModel.NotificationContacts = oarTarget.Contacts; return(View(viewModel)); }
public ActionResult AddBusiness(FormCollection collection) { var orgVM = SystemViewModelData.BuildUpOrganizationViewModel(); string orgName = collection["Entity.Name"].ToString(); string headquarters = collection["Entity.Headquarters"].ToString(); int? regulatorID = null; //Not setting the LeadRegulatorID, this is just the name of the Regulator Drop Down - using this regulatorID to create the event. if (!String.IsNullOrEmpty(collection["Entity.LeadRegulatorID"].ToString())) { regulatorID = Convert.ToInt32(collection["Entity.LeadRegulatorID"].ToString()); } if (ModelState.IsValid) { //Look for dupes List <Model.Organization> matches = (from organization in Repository.DataModel.Organizations where organization.Name == orgName select organization).ToList(); if (matches != null) { if (matches.Count == 0) { if (TryUpdateModel(orgVM.Entity, "Entity")) { try { int orgID = CreateNewBusiness(orgVM.Entity.Name, orgVM.Entity.Headquarters, (OrganizationOrigin)orgVM.Entity.OriginID); Messages.Clear(); Messages.Add("Organization created successfully!", MessageType.Success, "Organizations"); return(RedirectToAction("Index", "MyOrganization", new { organizationId = orgID })); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } } else { return(RedirectToAction("ExistingOrganizations", new { organizationName = orgName, headquarters = headquarters, regulatorID = regulatorID })); } } } return(View(orgVM)); }
public ActionResult AddBusinessAnyway(string organizationName, string headquarters, string regulatorID) { var orgVM = SystemViewModelData.BuildUpOrganizationViewModel(); try { int orgID = CreateNewBusiness(organizationName, headquarters, OrganizationOrigin.CUPA); Messages.Clear(); Messages.Add("Organization created successfully!", MessageType.Success, "Organizations"); return(RedirectToAction("Index", "MyOrganization", new { organizationId = orgID })); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } return(View(orgVM)); }