private ActionResult SendToCityRoute(RouteValueDictionary values) { //get the city name if (values.ContainsKey("city")) { var userCity = values["city"].ToString(); //if its admin, then just send them to the admin route if (userCity.Equals("admin", StringComparison.CurrentCultureIgnoreCase)) { return(RedirectToRoute(Constants.Routing.AdminRouteName, values)); } //if it isnt admin, then we need to check to see if this city is a maintenance group. //if it is NOT (they are logging in to the customer, not the maintenance group, then we need to check to see if this user is a technician and either send them to the maint route or the city route if (!MaintenanceGroupFactory.IsCustomerMaintenanceGroup(userCity)) { ////its not a maint group, it can be a maint customer, check here to see if we need to send them to the admin or maint version of hte site var cityCookie = GetCityCookie(); if (cityCookie != null) { //now lets check to see if they are logging in for maintenance or customer if (cityCookie.Value.Split('|')[2] == CustomerLoginType.MaintenanceGroupCustomer.ToString()) { return(RedirectToRoute(Constants.Routing.MaintRouteName, values)); } } } } //if it is a maintenance group, just send the user to the city homepage return(RedirectToRoute(Constants.Routing.CityRouteName, values)); }
public ActionResult EditMaintenanceGroup(string submitButton, MaintenanceGroupIdentificationModel model) { // Was action RETURN? var mainFactory = new MaintenanceGroupFactory(); var auditFactory = new AuditFactory(); if (submitButton.Equals("RETURN")) { return(RedirectToAction("Index", new { rtn = "true" })); } if (submitButton.Equals("ACTIVATE")) { mainFactory.Activate(model.CustomerId); auditFactory.ModifiedBy("CustomerProfile", model.CustomerId, WebSecurity.CurrentUserId); return(RedirectToAction("EditMaintenanceGroup", new { customerId = model.CustomerId })); } if (submitButton.Equals("INACTIVATE")) { mainFactory.Inactivate(model.CustomerId); auditFactory.ModifiedBy("CustomerProfile", model.CustomerId, WebSecurity.CurrentUserId); return(RedirectToAction("EditMaintenanceGroup", new { customerId = model.CustomerId })); } // Save values if (!ModelState.IsValid) { model = mainFactory.GetIdentificationModel(model.CustomerId, model); return(View(model)); } mainFactory.SetIdentificationModel(model.CustomerId, model); auditFactory.ModifiedBy("CustomerProfile", model.CustomerId, WebSecurity.CurrentUserId); model = mainFactory.GetIdentificationModel(model.CustomerId, model); if (submitButton.Equals("SAVE")) { // Saved and stay on same page. return(View(model)); } // Saved but move to next page. return(RedirectToAction("EditMaintenanceGroupCustomers", new { customerId = model.CustomerId })); }