public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(LoggingSectionConstants.RouteName, new {
                Controller = LoggingSectionConstants.ControllerName,
                Action     = LoggingSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(LoggingSectionConstants.ActivityTypesController.List.RouteName, new {
                Controller = LoggingSectionConstants.ActivityTypesController.ControllerName,
                Action     = LoggingSectionConstants.ActivityTypesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LoggingSectionConstants.ActivityTypesController.New.RouteName, new {
                Controller = LoggingSectionConstants.ActivityTypesController.ControllerName,
                Action     = LoggingSectionConstants.ActivityTypesController.New.ActionName
            });

            routeCollection.MapStandardRoute(LoggingSectionConstants.ActivityTypesController.Edit.RouteName, new {
                Controller = LoggingSectionConstants.ActivityTypesController.ControllerName,
                Action     = LoggingSectionConstants.ActivityTypesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LoggingSectionConstants.ActivitiesController.List.RouteName, new {
                Controller = LoggingSectionConstants.ActivitiesController.ControllerName,
                Action     = LoggingSectionConstants.ActivitiesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LoggingSectionConstants.LogsController.List.RouteName, new {
                Controller = LoggingSectionConstants.LogsController.ControllerName,
                Action     = LoggingSectionConstants.LogsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));
        }
Beispiel #2
0
        public void SetParameter(RouteParameter parameter)
        {
            switch (parameterMatches)
            {
            case 0:
                p0 = parameter;
                break;

            case 1:
                p1 = parameter;
                break;

            case 2:
                p2 = parameter;
                break;

            case 3:
                p3 = parameter;
                break;

            case 4:
                p4 = parameter;
                break;

            default:
                throw new IndexOutOfRangeException("Routes can only have up to 5 total dynamic parameters");
            }

            parameterMatches++;
        }
Beispiel #3
0
        public void RouteKey()
        {
            var rp = new RouteParameter();

            rp.RouteKey = null;
            Assert.AreEqual(String.Empty, rp.RouteKey, "#A1");
        }
Beispiel #4
0
 public void DeleteBinParameter(RouteParameter routeParameter)
 {
     using (ConfigurationToolContext context = new ConfigurationToolContext())
     {
         var repository = new RouteParameterRepository(context);
         repository.Delete(routeParameter);
         context.SaveChanges();
     }
 }
        public RouteParameter RouteInputFor(Expression <Func <T, object> > expression)
        {
            Accessor accessor = ReflectionHelper.GetAccessor(expression);
            var      input    = new RouteParameter(accessor);

            _modifiers.Add(r => r.Input.AddRouteInput(input, true));

            return(input);
        }
Beispiel #6
0
        public void Constructor_String_DbType_String()
        {
            RouteParameter rp;

            rp = new RouteParameter("name", DbType.Int64, "key");
            Assert.AreEqual("name", rp.Name, "#A1-1");
            Assert.AreEqual("key", rp.RouteKey, "#A1-2");
            Assert.AreEqual(DbType.Int64, rp.DbType, "#A1-3");

            Assert.AreEqual(TypeCode.Empty, rp.Type, "#A2");
        }
        public void AppendParameter(RouteParameter parameter)
        {
            if (!ParamNodeFactories.ContainsKey(parameter.Type))
            {
                return;
            }

            var parameterNode = ParamNodeFactories[parameter.Type](parameter.Name);

            _node = _node == null ? parameterNode : _node.Slash(parameterNode);
        }
Beispiel #8
0
 public RouteMatch(string url)
 {
     this.url              = url;
     this.matchProgress    = 0;
     this.parameterMatches = 0;
     this.p0 = default(RouteParameter);
     this.p1 = default(RouteParameter);
     this.p2 = default(RouteParameter);
     this.p3 = default(RouteParameter);
     this.p4 = default(RouteParameter);
 }
Beispiel #9
0
        public void route_input_should_substitute_method()
        {
            SingleProperty accessor  = SingleProperty.Build <SampleViewModel>(x => x.InPath);
            var            viewModel = new SampleViewModel
            {
                InPath = "5"
            };
            var routeInput = new RouteParameter(accessor);

            routeInput.Substitute(viewModel, "test/edit/{InPath}").ShouldEqual("test/edit/5");
        }
Beispiel #10
0
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(BillingSectionConstants.RouteName, new {
                Controller = BillingSectionConstants.ControllerName,
                Action     = BillingSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(BillingSectionConstants.TransactionDebugsController.List.RouteName, new {
                Controller = BillingSectionConstants.TransactionDebugsController.ControllerName,
                Action     = BillingSectionConstants.TransactionDebugsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));
        }
Beispiel #11
0
        public void Constructor_String_String()
        {
            RouteParameter rp;

            rp = new RouteParameter(null, "key");
            Assert.AreEqual(String.Empty, rp.Name, "#A1-1");
            Assert.AreEqual("key", rp.RouteKey, "#A1-2");

            rp = new RouteParameter("name", null);
            Assert.AreEqual("name", rp.Name, "#A2-1");
            Assert.AreEqual(String.Empty, rp.RouteKey, "#A2-2");
        }
Beispiel #12
0
        protected override void OnEndRequest(HttpContextBase context)
        {
            var request  = context.Request;
            var response = context.Response;

            if (!response.StatusCode.Any((int)HttpStatusCode.InternalServerError, (int)HttpStatusCode.NotFound, (int)HttpStatusCode.Forbidden))
            {
                return;
            }

            if (request.RawUrl.Contains("favicon.ico"))
            {
                return;
            }

            string routeName;

            if (response.StatusCode == (int)HttpStatusCode.InternalServerError)
            {
                return;
            }

            switch (response.StatusCode)
            {
            case (int)HttpStatusCode.InternalServerError:
                routeName = RootSectionConstants.ErrorsController.GenericError.RouteName;
                break;

            case (int)HttpStatusCode.NotFound:
                routeName = RootSectionConstants.ErrorsController.NotFound.RouteName;
                break;

            default:
                routeName = RootSectionConstants.ErrorsController.AccessDenied.RouteName;
                break;
            }

            var url = RouteUrlProvider.GetUrl(routeName);

            if (request.RawUrl.StartsWith(url))
            {
                return;
            }

            response.Clear();

            response.TrySkipIisCustomErrors = true;

            url = RouteUrlProvider.GetUrl(routeName, RouteParameter.Add("url", request.RawUrl));

            response.Redirect(url);
        }
Beispiel #13
0
        protected void btn_apply_Click(object sender, EventArgs e)
        {
            RouteParameter parameter = new RouteParameter();

            parameter.Name         = "name";
            parameter.DefaultValue = textbox1.Text;
            RouteValueDictionary dictionary = new RouteValueDictionary
            {
                { "name", textbox1.Text }, { "desc", textbox2.Text }
            };

            Response.Redirect(GetRouteUrl("Leave", dictionary));
        }
Beispiel #14
0
        public void Constructor()
        {
            var rp = new RouteParameter();

            Assert.AreEqual(String.Empty, rp.RouteKey, "#A1");
            Assert.AreEqual(String.Empty, rp.Name, "#A2");
            Assert.AreEqual(TypeCode.Empty, rp.Type, "#A3");
            Assert.AreEqual(ParameterDirection.Input, rp.Direction, "#A4");
            Assert.IsNull(rp.DefaultValue, "#A5");
            Assert.AreEqual(DbType.Object, rp.DbType, "#A6");
            Assert.AreEqual(true, rp.ConvertEmptyStringToNull, "#A7");
            Assert.AreEqual(0, rp.Size, "#A8");
        }
Beispiel #15
0
        public void Constructor_RouteParameter()
        {
            RouteParameter rp;
            RouteParameter original;

            Assert.Throws <NullReferenceException> (() => {
                rp = new FakeRouteParameter((RouteParameter)null);
            }, "#A1");

            original = new RouteParameter("Name", "Key");
            rp       = new FakeRouteParameter(original);

            Assert.AreEqual(original.Name, rp.Name, "#B1-2");
            Assert.AreEqual(original.RouteKey, rp.RouteKey, "#B1-3");
        }
Beispiel #16
0
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(TracksSectionConstants.RouteName, new {
                Controller = TracksSectionConstants.ControllerName,
                Action     = TracksSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(TracksSectionConstants.FundamentalsController.List.RouteName, new {
                Controller = TracksSectionConstants.FundamentalsController.ControllerName,
                Action     = TracksSectionConstants.FundamentalsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.FundamentalsController.New.RouteName, new {
                Controller = TracksSectionConstants.FundamentalsController.ControllerName,
                Action     = TracksSectionConstants.FundamentalsController.New.ActionName
            });

            routeCollection.MapStandardRoute(TracksSectionConstants.FundamentalsController.Edit.RouteName, new {
                Controller = TracksSectionConstants.FundamentalsController.ControllerName,
                Action     = TracksSectionConstants.FundamentalsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.TrackCommentsController.List.RouteName, new {
                Controller = TracksSectionConstants.TrackCommentsController.ControllerName,
                Action     = TracksSectionConstants.TrackCommentsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.TrackId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.TrackCommentsController.Edit.RouteName, new {
                Controller = TracksSectionConstants.TrackCommentsController.ControllerName,
                Action     = TracksSectionConstants.TrackCommentsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.TrackCommentLikesController.List.RouteName, new {
                Controller = TracksSectionConstants.TrackCommentLikesController.ControllerName,
                Action     = TracksSectionConstants.TrackCommentLikesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.TrackCommentId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.TrackLikesController.List.RouteName, new {
                Controller = TracksSectionConstants.TrackLikesController.ControllerName,
                Action     = TracksSectionConstants.TrackLikesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.TrackId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TracksSectionConstants.TrackSharesController.List.RouteName, new {
                Controller = TracksSectionConstants.TrackSharesController.ControllerName,
                Action     = TracksSectionConstants.TrackSharesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.TrackId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));
        }
        public virtual ActionResult OpenId(OpenIdLoginModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            Identifier id;

            if (Identifier.TryParse(model.OpenIdIdentifier, out id))
            {
                try {
                    var openId = new OpenIdRelyingParty();

                    var returnUrl = new Uri(Url.Action("OpenIdCallback", "Authentication",
                                                       RouteParameter.Add(ThenAttribute.ParameterName,
                                                                          ViewBag.Then[ThenAttribute.ParameterName]),
                                                       Request.Url.Scheme), UriKind.Absolute);

                    var request = openId.CreateRequest(id, Realm.AutoDetect, returnUrl);

                    request.AddExtension(new ClaimsRequest {
                        Email    = DemandLevel.Require,
                        FullName = DemandLevel.Require,
                        Nickname = DemandLevel.Require
                    });

                    var fetchRequest = new FetchRequest();
                    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.FullName);
                    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
                    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
                    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
                    request.AddExtension(fetchRequest);

                    return(request.RedirectingResponse.AsActionResult());
                } catch (ProtocolException) {
                    ErrorNotification(Resources.Messages_OpenIdConnectionFailure, false);

                    return(View("Login", model));
                }
            }

            ErrorNotification(Resources.Messages_InvalidOpenIdIdentifier, false);

            return(View("Login", model));
        }
Beispiel #18
0
        public override ActionResult Edit(TEditableModel editableModel, bool continueEditing)
        {
            if (!IsUserizedRequest)
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                InjectModelDependencies(editableModel);

                return(View(editableModel));
            }

            var entity = GetEntityById(editableModel.Id)();

            if (entity == null)
            {
                return(HandleUnknown(editableModel.Id));
            }

            entity = editableModel.ToEntity(entity);

            var operationResult = UpdateEntityAndReturnOperationResult(entity)();

            if (!operationResult.Success)
            {
                ModelState.InjectMessages(operationResult);
                ResourceErrorNotification(CommonConstants.Systematic.NotUpdated);

                InjectModelDependencies(editableModel);

                return(View(editableModel));
            }

            ResourceSuccessNotification(CommonConstants.Systematic.Updated);

            if (continueEditing)
            {
                return(RedirectToAction(KnownActionNames.Edit, RouteParameter.Add(KnownParameterNames.Id, entity.Id)));
            }

            return(RedirectToAction(KnownActionNames.List, RouteParameter.Add(KnownParameterNames.Page, 1)));
        }
Beispiel #19
0
        public override ActionResult List(int page = 1)
        {
            if (!IsUserizedRequest)
            {
                return(AccessDeniedView());
            }

            var entities = GetAllEntities();

            var entityModels = new PagedList <TModel>(entities.Select(e => e.ToModel <TEntity, TModel>()).ToList(), page, _adminAreaSettings.GridPageSize);

            if (entityModels.TotalItemCount > 0 && entityModels.StartRecordIndex > entityModels.EndRecordIndex)
            {
                ResourceErrorNotification(CrudSharedConstants.Systematic.InvalidParameter);
                return(RedirectToAction(KnownActionNames.List, RouteParameter.Add(KnownParameterNames.Page, 1)));
            }

            return(View(entityModels));
        }
        public static void ExecuteAction(this HttpContextBase httpContext, string controllerName, string actionName, object additionalValues)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }

            if (controllerName == null)
            {
                throw new ArgumentNullException("controllerName");
            }

            if (actionName == null)
            {
                throw new ArgumentNullException("actionName");
            }

            var routeValues = RouteParameter.Add("Controller", controllerName)
                              .Append("Action", actionName);

            var additionalRouteValues = RouteValueDictionaryConvertor.Convert(additionalValues);

            if (additionalRouteValues.Keys.Any())
            {
                foreach (var additionalRouteValue in additionalRouteValues)
                {
                    routeValues.Add(additionalRouteValue.Key, additionalRouteValue.Value);
                }
            }

            var routeData = new RouteData();

            routeData.Values.MergeWith(routeValues);

            var requestContext = new RequestContext(httpContext, routeData);

            var controller = ControllerBuilder.Current.GetControllerFactory()
                             .CreateController(requestContext, controllerName);

            controller.Execute(requestContext);
        }
Beispiel #21
0
        public void CreateNewRoute(Route route, Procescell procescell)
        {
            using (ConfigurationToolContext context = new ConfigurationToolContext())
            {
                var repository = new RouteRepository(context);
                var parameterDefinitionRepository = new ParameterDefinitionRepository(context);

                //Gets required parameters for a new procescell
                IEnumerable <ParameterDefinition> requiredParameters;
                requiredParameters = parameterDefinitionRepository.GetRequiredParameters("rop_RoutePars", procescell.prc_ProcescellTypeId);

                //convert parDef to proccellPars and add them to the procescell
                foreach (ParameterDefinition paf in requiredParameters)
                {
                    RouteParameter rop = new RouteParameter(route, paf, procescell);
                    route.RouteParameters.Add(rop);
                }

                repository.Add(route);
                context.SaveChanges();
            }
        }
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(ConfigurationSectionConstants.RouteName, new {
                Controller = ConfigurationSectionConstants.ControllerName,
                Action     = ConfigurationSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(ConfigurationSectionConstants.ConfigurationController.List.RouteName, new {
                Controller = ConfigurationSectionConstants.ConfigurationController.ControllerName,
                Action     = ConfigurationSectionConstants.ConfigurationController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(ConfigurationSectionConstants.ConfigurationController.New.RouteName, new {
                Controller = ConfigurationSectionConstants.ConfigurationController.ControllerName,
                Action     = ConfigurationSectionConstants.ConfigurationController.New.ActionName
            });

            routeCollection.MapStandardRoute(ConfigurationSectionConstants.ConfigurationController.Edit.RouteName, new {
                Controller = ConfigurationSectionConstants.ConfigurationController.ControllerName,
                Action     = ConfigurationSectionConstants.ConfigurationController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(LocalizationSectionConstants.RouteName, new {
                Controller = LocalizationSectionConstants.ControllerName,
                Action     = LocalizationSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(LocalizationSectionConstants.LanguagesController.List.RouteName, new {
                Controller = LocalizationSectionConstants.LanguagesController.ControllerName,
                Action     = LocalizationSectionConstants.LanguagesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LocalizationSectionConstants.LanguagesController.New.RouteName, new {
                Controller = LocalizationSectionConstants.LanguagesController.ControllerName,
                Action     = LocalizationSectionConstants.LanguagesController.New.ActionName
            });

            routeCollection.MapStandardRoute(LocalizationSectionConstants.LanguagesController.Edit.RouteName, new {
                Controller = LocalizationSectionConstants.LanguagesController.ControllerName,
                Action     = LocalizationSectionConstants.LanguagesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LocalizationSectionConstants.StringResourcesController.List.RouteName, new {
                Controller = LocalizationSectionConstants.StringResourcesController.ControllerName,
                Action     = LocalizationSectionConstants.StringResourcesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(LocalizationSectionConstants.StringResourcesController.New.RouteName, new {
                Controller = LocalizationSectionConstants.StringResourcesController.ControllerName,
                Action     = LocalizationSectionConstants.StringResourcesController.New.ActionName
            });

            routeCollection.MapStandardRoute(LocalizationSectionConstants.StringResourcesController.Edit.RouteName, new {
                Controller = LocalizationSectionConstants.StringResourcesController.ControllerName,
                Action     = LocalizationSectionConstants.StringResourcesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
Beispiel #24
0
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(PagesSectionConstants.RouteName, new {
                Controller = PagesSectionConstants.ControllerName,
                Action     = PagesSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(PagesSectionConstants.GroupsController.List.RouteName, new {
                Controller = PagesSectionConstants.GroupsController.ControllerName,
                Action     = PagesSectionConstants.GroupsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(PagesSectionConstants.GroupsController.New.RouteName, new {
                Controller = PagesSectionConstants.GroupsController.ControllerName,
                Action     = PagesSectionConstants.GroupsController.New.ActionName
            });

            routeCollection.MapStandardRoute(PagesSectionConstants.GroupsController.Edit.RouteName, new {
                Controller = PagesSectionConstants.GroupsController.ControllerName,
                Action     = PagesSectionConstants.GroupsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(PagesSectionConstants.ContentManagementController.List.RouteName, new {
                Controller = PagesSectionConstants.ContentManagementController.ControllerName,
                Action     = PagesSectionConstants.ContentManagementController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(PagesSectionConstants.ContentManagementController.New.RouteName, new {
                Controller = PagesSectionConstants.ContentManagementController.ControllerName,
                Action     = PagesSectionConstants.ContentManagementController.New.ActionName
            });

            routeCollection.MapStandardRoute(PagesSectionConstants.ContentManagementController.Edit.RouteName, new {
                Controller = PagesSectionConstants.ContentManagementController.ControllerName,
                Action     = PagesSectionConstants.ContentManagementController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(TicketingSectionConstants.RouteName, new {
                Controller = TicketingSectionConstants.ControllerName,
                Action     = TicketingSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketsController.List.RouteName, new {
                Controller = TicketingSectionConstants.TicketsController.ControllerName,
                Action     = TicketingSectionConstants.TicketsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketsController.New.RouteName, new {
                Controller = TicketingSectionConstants.TicketsController.ControllerName,
                Action     = TicketingSectionConstants.TicketsController.New.ActionName
            });

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketsController.Edit.RouteName, new {
                Controller = TicketingSectionConstants.TicketsController.ControllerName,
                Action     = TicketingSectionConstants.TicketsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketResponsesController.List.RouteName, new {
                Controller = TicketingSectionConstants.TicketResponsesController.ControllerName,
                Action     = TicketingSectionConstants.TicketResponsesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32).Append(KnownParameterNames.TicketId, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketResponsesController.New.RouteName, new {
                Controller = TicketingSectionConstants.TicketResponsesController.ControllerName,
                Action     = TicketingSectionConstants.TicketResponsesController.New.ActionName
            }, RouteParameter.Add(KnownParameterNames.TicketId, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(TicketingSectionConstants.TicketResponsesController.Edit.RouteName, new {
                Controller = TicketingSectionConstants.TicketResponsesController.ControllerName,
                Action     = TicketingSectionConstants.TicketResponsesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(SecuritySectionConstants.RouteName, new {
                Controller = SecuritySectionConstants.ControllerName,
                Action     = SecuritySectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(SecuritySectionConstants.BannedIpsController.List.RouteName, new {
                Controller = SecuritySectionConstants.BannedIpsController.ControllerName,
                Action     = SecuritySectionConstants.BannedIpsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(SecuritySectionConstants.BannedIpsController.New.RouteName, new {
                Controller = SecuritySectionConstants.BannedIpsController.ControllerName,
                Action     = SecuritySectionConstants.BannedIpsController.New.ActionName
            });

            routeCollection.MapStandardRoute(SecuritySectionConstants.BannedIpsController.Edit.RouteName, new {
                Controller = SecuritySectionConstants.BannedIpsController.ControllerName,
                Action     = SecuritySectionConstants.BannedIpsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(SecuritySectionConstants.PermissionRecordsController.List.RouteName, new {
                Controller = SecuritySectionConstants.PermissionRecordsController.ControllerName,
                Action     = SecuritySectionConstants.PermissionRecordsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(SecuritySectionConstants.PermissionRecordsController.New.RouteName, new {
                Controller = SecuritySectionConstants.PermissionRecordsController.ControllerName,
                Action     = SecuritySectionConstants.PermissionRecordsController.New.ActionName
            });

            routeCollection.MapStandardRoute(SecuritySectionConstants.PermissionRecordsController.Edit.RouteName, new {
                Controller = SecuritySectionConstants.PermissionRecordsController.ControllerName,
                Action     = SecuritySectionConstants.PermissionRecordsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
Beispiel #27
0
        public BlogModelGrid(HtmlHelper htmlHelper, bool isSelected = true, bool edit = true, bool id = true, bool isPublished = true, bool isDeleted = true, bool displayOrder = true, bool createdOn = true, bool lastModifiedOn = true, bool isActive = true, bool name = true, bool author = true, bool tags = true, bool posts = true)
            : base(htmlHelper, isSelected, edit, ContentManagementSectionConstants.BlogsController.Edit.RouteName, id, isPublished, isDeleted, displayOrder, createdOn, lastModifiedOn)
        {
            if (isActive)
            {
                Column.For(bm => bm.IsActive).Named(htmlHelper.T(BlogConstants.Fields.IsActive.Label));
            }

            if (name)
            {
                Column.For(bm => bm.Name).Named(htmlHelper.T(BlogConstants.Fields.Name.Label));
            }

            if (author)
            {
                Column.For(bm => htmlHelper.LocalizedRouteLinkWithId(bm.UserFullName, SecuritySectionConstants.UsersController.Edit.RouteName, bm.UserId, null, new {
                    @class = "btn secondary"
                }, null, null, false, null)).Named(htmlHelper.T(BlogConstants.Fields.User.Label));
            }

            if (tags)
            {
                Column.For(bm => htmlHelper.LocalizedRouteLink(bm.TagsCount.ToString(), ContentManagementSectionConstants.TagsController.ListByBlogId.RouteName, RouteParameter.Add(KnownParameterNames.BlogId, bm.Id), new {
                    @class = "btn secondary"
                }, null, null, false, null)).Named(htmlHelper.T(BlogConstants.Fields.Tags.Label));
            }

            if (posts)
            {
                Column.For(bm => htmlHelper.LocalizedRouteLink(bm.PostsCount.ToString(), ContentManagementSectionConstants.PostsController.ListByBlogId.RouteName, RouteParameter.Add(KnownParameterNames.BlogId, bm.Id), new {
                    @class = "btn secondary"
                }, null, null, false, null)).Named(htmlHelper.T(BlogConstants.Fields.Posts.Label));
            }
        }
Beispiel #28
0
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(NewsSectionConstants.RouteName, new {
                Controller = NewsSectionConstants.ControllerName,
                Action     = NewsSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(NewsSectionConstants.CategoriesController.List.RouteName, new {
                Controller = NewsSectionConstants.CategoriesController.ControllerName,
                Action     = NewsSectionConstants.CategoriesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.CategoriesController.New.RouteName, new {
                Controller = NewsSectionConstants.CategoriesController.ControllerName,
                Action     = NewsSectionConstants.CategoriesController.New.ActionName
            });

            routeCollection.MapStandardRoute(NewsSectionConstants.CategoriesController.Edit.RouteName, new {
                Controller = NewsSectionConstants.CategoriesController.ControllerName,
                Action     = NewsSectionConstants.CategoriesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementController.List.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementController.New.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementController.New.ActionName
            });

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementController.Edit.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementCommentsController.List.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementCommentsController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementCommentsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.ContentManagementId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementCommentsController.Edit.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementCommentsController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementCommentsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementCommentLikesController.List.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementCommentLikesController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementCommentLikesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.ContentManagementCommentId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementLikesController.List.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementLikesController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementLikesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.ContentManagementId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(NewsSectionConstants.ContentManagementSharesController.List.RouteName, new {
                Controller = NewsSectionConstants.ContentManagementSharesController.ControllerName,
                Action     = NewsSectionConstants.ContentManagementSharesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.ContentManagementId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));
        }
        public void RegisterRoutes(RouteCollection routeCollection)
        {
            routeCollection.MapStandardRoute(MediaSectionConstants.RouteName, new {
                Controller = MediaSectionConstants.ControllerName,
                Action     = MediaSectionConstants.ActionName
            });

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadsController.List.RouteName, new {
                Controller = MediaSectionConstants.DownloadsController.ControllerName,
                Action     = MediaSectionConstants.DownloadsController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadsController.New.RouteName, new {
                Controller = MediaSectionConstants.DownloadsController.ControllerName,
                Action     = MediaSectionConstants.DownloadsController.New.ActionName
            });

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadsController.Edit.RouteName, new {
                Controller = MediaSectionConstants.DownloadsController.ControllerName,
                Action     = MediaSectionConstants.DownloadsController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadAttributesController.List.RouteName, new {
                Controller = MediaSectionConstants.DownloadAttributesController.ControllerName,
                Action     = MediaSectionConstants.DownloadAttributesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.DownloadId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadAttributesController.New.RouteName, new {
                Controller = MediaSectionConstants.DownloadAttributesController.ControllerName,
                Action     = MediaSectionConstants.DownloadAttributesController.New.ActionName
            }, RouteParameter.Add(KnownParameterNames.DownloadId, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.DownloadAttributesController.Edit.RouteName, new {
                Controller = MediaSectionConstants.DownloadAttributesController.ControllerName,
                Action     = MediaSectionConstants.DownloadAttributesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.PicturesController.List.RouteName, new {
                Controller = MediaSectionConstants.PicturesController.ControllerName,
                Action     = MediaSectionConstants.PicturesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.PicturesController.New.RouteName, new {
                Controller = MediaSectionConstants.PicturesController.ControllerName,
                Action     = MediaSectionConstants.PicturesController.New.ActionName
            });

            routeCollection.MapStandardRoute(MediaSectionConstants.PicturesController.Edit.RouteName, new {
                Controller = MediaSectionConstants.PicturesController.ControllerName,
                Action     = MediaSectionConstants.PicturesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.PictureAttributesController.List.RouteName, new {
                Controller = MediaSectionConstants.PictureAttributesController.ControllerName,
                Action     = MediaSectionConstants.PictureAttributesController.List.ActionName
            }, RouteParameter.Add(KnownParameterNames.PictureId, KnownConstraints.Int32).Append(KnownParameterNames.Page, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.PictureAttributesController.New.RouteName, new {
                Controller = MediaSectionConstants.PictureAttributesController.ControllerName,
                Action     = MediaSectionConstants.PictureAttributesController.New.ActionName
            }, RouteParameter.Add(KnownParameterNames.PictureId, KnownConstraints.Int32));

            routeCollection.MapStandardRoute(MediaSectionConstants.PictureAttributesController.Edit.RouteName, new {
                Controller = MediaSectionConstants.PictureAttributesController.ControllerName,
                Action     = MediaSectionConstants.PictureAttributesController.Edit.ActionName
            }, RouteParameter.Add(KnownParameterNames.Id, KnownConstraints.Int32));
        }
Beispiel #30
0
 public ParameterUrlPart(RouteParameter parameter)
 {
     _parameter = parameter;
 }
        private async void GetDirections_Click(object sender, RoutedEventArgs e)
        {
            //Reset
            DirectionsStackPanel.Children.Clear();
            var _stops = new List<Graphic>();
            var _locator = new ESRI.ArcGIS.Runtime.Tasks.Locator(new Uri("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer"));
            var routeLayer = MyMap.Layers["MyRouteGraphicsLayer"] as GraphicsLayer;
            routeLayer.Graphics.Clear();
            try
            {
                //Geocode from address
                var fromLocation = await _locator.AddressToLocationsAsync(ParseAddress(FromTextBox.Text));
                if (fromLocation.AddressCandidates != null && fromLocation.AddressCandidates.Count > 0)
                {
                    AddressCandidate address = fromLocation.AddressCandidates.FirstOrDefault();
                    Graphic graphicLocation = new Graphic() { Geometry = address.Location, Symbol = LayoutRoot.Resources["FromSymbol"] as ISymbol };
                    graphicLocation.Attributes["address"] = address.Address;
                    graphicLocation.Attributes["score"] = address.Score;
                    _stops.Add(graphicLocation);
                    routeLayer.Graphics.Add(graphicLocation);
                }
                //Geocode to address
                var toLocation = await _locator.AddressToLocationsAsync(ParseAddress(ToTextBox.Text));
                if (toLocation.AddressCandidates != null && toLocation.AddressCandidates.Count > 0)
                {
                    AddressCandidate address = toLocation.AddressCandidates.FirstOrDefault();
                    Graphic graphicLocation = new Graphic() { Geometry = address.Location, Symbol = LayoutRoot.Resources["ToSymbol"] as ISymbol };
                    graphicLocation.Attributes["address"] = address.Address;
                    graphicLocation.Attributes["score"] = address.Score;
                    _stops.Add(graphicLocation);
                    routeLayer.Graphics.Add(graphicLocation);
                }
                //Get route between from and to
                var _routeParams = new RouteParameter()
                {
                    ReturnRoutes = false,
                    ReturnDirections = true,
                    DirectionsLengthUnits = MapUnit.Miles,
                    Stops = new FeatureStops(_stops),
                    UseTimeWindows = false
                };

                var _routeTask = new RouteTask(new Uri("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"));

                _routeParams.OutSpatialReference = MyMap.SpatialReference;
                var routeTaskResult = await _routeTask.SolveAsync(_routeParams);
                _directionsFeatureSet = routeTaskResult.Directions.FirstOrDefault();

                routeLayer.Graphics.Add(new Graphic() { Geometry = _directionsFeatureSet.MergedGeometry, Symbol = LayoutRoot.Resources["RouteSymbol"] as ISymbol });
                TotalDistanceTextBlock.Text = string.Format("Total Distance: {0}", FormatDistance(_directionsFeatureSet.RouteSummary.TotalLength, "miles"));
                TotalTimeTextBlock.Text = string.Format("Total Time: {0}", FormatTime(_directionsFeatureSet.RouteSummary.TotalTime));
                TitleTextBlock.Text = _directionsFeatureSet.RouteName;

                int i = 1;
                foreach (Graphic graphic in _directionsFeatureSet.Graphics)
                {
                    System.Text.StringBuilder text = new System.Text.StringBuilder();
                    text.AppendFormat("{0}. {1}", i, graphic.Attributes["text"]);
                    if (i > 1 && i < _directionsFeatureSet.Graphics.Count)
                    {
                        string distance = FormatDistance(Convert.ToDouble(graphic.Attributes["length"]), "miles");
                        string time = null;
                        if (graphic.Attributes.ContainsKey("time"))
                        {
                            time = FormatTime(Convert.ToDouble(graphic.Attributes["time"]));
                        }
                        if (!string.IsNullOrEmpty(distance) || !string.IsNullOrEmpty(time))
                            text.Append(" (");
                        text.Append(distance);
                        if (!string.IsNullOrEmpty(distance) && !string.IsNullOrEmpty(time))
                            text.Append(", ");
                        text.Append(time);
                        if (!string.IsNullOrEmpty(distance) || !string.IsNullOrEmpty(time))
                            text.Append(")");
                    }
                    TextBlock textBlock = new TextBlock() { Text = text.ToString(), Tag = graphic, Margin = new Thickness(4) };
                    textBlock.Tapped += TextBlock_Tapped;
                    DirectionsStackPanel.Children.Add(textBlock);
                    i++;
                }
                MyMap.ZoomTo(_directionsFeatureSet.RouteSummary.Extent.Expand(0.6));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }