Пример #1
0
 void redirectToUnauthorize(ActionExecutingContext filterContext, string actionName, string controllerName)
 {
     System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
     route.Add("action", actionName);
     route.Add("controller", controllerName);
     filterContext.Result = new RedirectToRouteResult(route);
 }
Пример #2
0
        private IEnumerable <RouteDataItemModel> ProcessRouteData(MvcRouteValueDictionary dataDefaults,
                                                                  RouteDataMessage routeMessage)
        {
            if (dataDefaults == null || dataDefaults.Count == 0)
            {
                return(null);
            }

            List <RouteDataItemModel> routeData = new List <RouteDataItemModel>();

            foreach (KeyValuePair <string, object> dataDefault in dataDefaults)
            {
                RouteDataItemModel routeDataItemModel = new RouteDataItemModel();
                routeDataItemModel.PlaceHolder  = dataDefault.Key;
                routeDataItemModel.DefaultValue = dataDefault.Value;

                if (routeMessage != null && routeMessage.Values != null)
                {
                    routeDataItemModel.ActualValue = routeMessage.Values[dataDefault.Key];
                }

                routeData.Add(routeDataItemModel);
            }

            return(routeData);
        }
Пример #3
0
        public virtual async Task <ActionResult> IndexEH(long ml)
        {
            // Berechtigungen ermitteln
            PPrincipal principal = System.Web.HttpContext.Current.GetPrincipal();

            if ((null != principal) && !String.IsNullOrWhiteSpace(principal.AuthenticationType))
            {
                ViewBag.AuthenticationToken = principal.AuthenticationToken;
                ViewBag.AuthenticationType  = principal.AuthenticationType;
            }

            // Gateway Verbindung
            PGatewayConnection gatewayConnection = DependencyResolver.Current.GetService(typeof(PGatewayConnection)) as PGatewayConnection;

            if (gatewayConnection == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Conflict, "Gateway information not found"));
            }


            Models.Database.MenuItem menuItem = this.configurationProvider.GetCurrentMenuItem(ml);
            System.Web.Routing.RouteValueDictionary routeValues = menuItem.GetRouteValues(true);
            String select_usage = "*[Template Type].2*";

            ViewBag.GatewayPath  = gatewayConnection.BaseUri;
            ViewBag.select_usage = select_usage;
            return(View("Index"));
        }
Пример #4
0
        public static MvcHtmlString SortableLinkFor <TModelItem, TValue>(this HtmlHelper <PagedData <TModelItem> > htmlHelper, System.Linq.Expressions.Expression <System.Func <TModelItem, TValue> > expression, string linkText = null)
        {
            ModelMetadata metadata     = ModelMetadata.FromLambdaExpression <TModelItem, TValue>(expression, new ViewDataDictionary <TModelItem>());
            string        propertyName = ExpressionHelper.GetExpressionText(expression);

            if (string.IsNullOrEmpty(linkText))
            {
                linkText = metadata.DisplayName;
            }
            if (string.IsNullOrEmpty(linkText))
            {
                linkText = propertyName;
            }
            PagedData <TModelItem> pagedData = htmlHelper.ViewData.Model;

            System.Web.Routing.RouteValueDictionary htmlAttributes = new System.Web.Routing.RouteValueDictionary();
            string sort = string.IsNullOrEmpty(metadata.RealSort()) ? propertyName : metadata.RealSort();

            htmlAttributes.Add("orderBy", sort);
            if (sort == pagedData.Pager.OrderBy)
            {
                htmlAttributes.Add("isDesc", !pagedData.Pager.IsDesc);
                htmlAttributes.Add("class", (pagedData.Pager.IsDesc ? "desc" : "asc") + " sortableLink");
            }
            else
            {
                htmlAttributes.Add("isDesc", false);
                htmlAttributes.Add("class", "sortableLink");
            }
            return(htmlHelper.ActionLink(linkText, "", null, htmlAttributes));
        }
            /// <summary>
            /// Invokes the specified action methods and use the result as items
            /// </summary>
            /// <param name="actionName"></param>
            /// <param name="routeValues"></param>
            /// <returns></returns>
            public virtual TBuilder ItemsFromAction(string actionName, System.Web.Routing.RouteValueDictionary routeValues)
            {
                BaseControl.SectionsStack.Push(new List <string>());
                var result = Ext.Net.X.Builder.HtmlHelper.Action(actionName, routeValues);

                this.HandleResult(result);
                return(this as TBuilder);
            }
 public static void AddRange(this IDictionary <string, object> dict, object values, bool replace)
 {
     if (values != null)
     {
         System.Web.Routing.RouteValueDictionary d = new System.Web.Routing.RouteValueDictionary(values);
         dict.AddRange(d, replace);
     }
 }
Пример #7
0
 public static MvcHtmlString ValueBox(this HtmlHelper htmlHelper, System.Type type, string name, object model, System.Collections.Generic.IDictionary <string, object> htmlAttributes = null)
 {
     if (htmlAttributes == null)
     {
         htmlAttributes = new System.Web.Routing.RouteValueDictionary();
     }
     htmlAttributes.AddRange(type.ValueBoxHtmlAttributes(), false);
     return(htmlHelper.ValueBox(name, model, htmlAttributes));
 }
Пример #8
0
 private void EnsureLayoutFlags(System.Web.Routing.RouteValueDictionary routeValues)
 {
     //this method should also ensures Puremode and Simplemode too
     EnsureFlag(routeValues, IsCurrentRequestRunInWindow, "iswindow");
     EnsureFlag(routeValues, Request.QueryString.AllKeys.Contains("istab"), "istab");
     EnsureFlag(routeValues, Request.QueryString.AllKeys.Contains("puremode"), "puremode");
     EnsureFlag(routeValues, Request.QueryString.AllKeys.Contains("simplemode"), "simplemode");
     EnsureFlag(routeValues, Request.QueryString.AllKeys.Contains("includeUrlInContent"), "includeUrlInContent");
 }
 public void GetConfigurationRoute(out string actionName, out string controllerName,
                                   out System.Web.Routing.RouteValueDictionary routeValues)
 {
     actionName     = "Configure";
     controllerName = "BPostShippingManager";
     routeValues    = new RouteValueDictionary {
         { "Namespaces", "MakeIT.Nop.Plugin.Shipping.Bpost.ShippingManager.Controllers" }, { "area", null }
     };
 }
Пример #10
0
        public static MvcHtmlString ValueBoxFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, string name, System.Linq.Expressions.Expression <System.Func <TModel, TProperty> > expression, object htmlAttributes = null)
        {
            System.Web.Routing.RouteValueDictionary htmlAttributesDict = new System.Web.Routing.RouteValueDictionary(htmlAttributes ?? new
            {
            });
            ModelMetadata metadata     = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData);
            string        propertyName = ExpressionHelper.GetExpressionText(expression);
            string        icon         = metadata.Icon();

            if (icon.IsNotNullAndEmpty())
            {
                htmlHelper.ViewData[ValueBoxHelper.ValueBox_Image_Icon] = icon;
            }
            if (metadata.DataTypeName == DataType.Password.ToString())
            {
                if (htmlAttributesDict == null)
                {
                    htmlAttributesDict = new System.Web.Routing.RouteValueDictionary();
                }
                if (htmlAttributesDict.ContainsKey("type"))
                {
                    htmlAttributesDict["type"] = "password";
                }
                else
                {
                    htmlAttributesDict.Add("type", "password");
                }
            }
            TModel model         = htmlHelper.ViewData.Model;
            object propertyValue = metadata.Model;

            if (string.IsNullOrEmpty(name))
            {
                name = propertyName;
            }
            MvcHtmlString result;

            if ((htmlHelper.ViewMode() == ViewMode.Create && !metadata.EditableWhenCreate()) || (htmlHelper.ViewMode() == ViewMode.Edit && !metadata.EditableWhenEdit()))
            {
                string text = string.Format(metadata.EditFormatString ?? "{0}", propertyValue);
                result = MvcHtmlString.Create(htmlHelper.Encode(text));
            }
            else
            {
                if (typeof(TProperty).FullName.StartsWith("System"))
                {
                    string text = string.Format(metadata.EditFormatString ?? "{0}", propertyValue);
                    result = htmlHelper.ValueBox(typeof(TProperty), name, text, htmlAttributesDict);
                }
                else
                {
                    result = htmlHelper.ValueBox(typeof(TProperty), name, propertyValue, htmlAttributesDict);
                }
            }
            return(result);
        }
Пример #11
0
 protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
 {
     System.Web.Routing.RouteValueDictionary dict = new System.Web.Routing.RouteValueDictionary(new
     {
         controller = "Error",
         action     = "NeedBuyHighVersion",
         area       = ""
     });
     filterContext.Result = new RedirectToRouteResult(dict);
 }
        public ActionResult SignOn(SignOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                bool       allowMultipleSessions = false;
                AppSession appSession            = Global.GetAppSession(this.HttpContext);
                UserEnvironmentStructure ues     = new UserEnvironmentStructure();
                ues.AppCode    = appSession.AppCode;
                ues.AppId      = appSession.AppId;
                ues.AppVersion = appSession.AppVersion;
                SignonResultsStructure results = UserSignon.Signon(Global.GetDataAccessMgr(this.HttpContext)
                                                                   , appSession.SignonControl
                                                                   , model.UserName
                                                                   , model.Password
                                                                   , ues
                                                                   , allowMultipleSessions);

                if (results.ResultEnum == SignonResultsEnum.Success)
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);
                    Session[SessionManagement.Constants.UserSessionMgr] = results.UserSessionMgr;
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        string[] urlParts    = returnUrl.Split(new string[] { Constants.UIControlCodeTag }, StringSplitOptions.None);
                        int      controlCode = urlParts.Length > 1 ? Convert.ToInt32(urlParts[1]) : 0;
                        if (!results.UserSessionMgr.IsAccessAllowed(controlCode) || true)
                        {
                            string msg = string.Format("Sorry, you are not authorized to access this page: {0}."
                                                       , urlParts[0]);
                            System.Web.Routing.RouteValueDictionary dictionary = new System.Web.Routing.RouteValueDictionary();
                            dictionary.Add(Constants.Message, msg);
                            dictionary.Add(Constants.UrlReferrer, model.GoBackUri);
                            return(RedirectToAction(Constants.AccessDenied, Constants.Home, dictionary));
                        }
                    }
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction(Constants.Index, Constants.Home));
                    }
                }
                else
                {
#warning "Add other case conditions"
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
    public static IHtmlString MyActionLink(
        this AjaxHelper ajaxHelper,
        Func <dynamic, HelperResult> linkHtml,
        [AspMvcAction] string actionName,
        object routeValues,
        AjaxOptions ajaxOptions
        )
    {
        System.Web.Routing.RouteValueDictionary routeVals = new System.Web.Routing.RouteValueDictionary(routeValues);
        var targetUrl = UrlHelper.GenerateUrl(null, actionName, null, routeVals, ajaxHelper.RouteCollection, ajaxHelper.ViewContext.RequestContext, true);

        return(MvcHtmlString.Create(ajaxHelper.GenerateLink(linkHtml, targetUrl, ajaxOptions ?? new AjaxOptions(), null)));
    }
Пример #14
0
        public static IHtmlString ActionLinkInnerHtml(
            this AjaxHelper ajaxHelper,
            string linkText,
            string actionName,
            string controllerName,
            object routeValues,
            AjaxOptions ajaxOptions,
            IDictionary <string, object> htmlAttributes = null)
        {
            System.Web.Routing.RouteValueDictionary routeVals = new System.Web.Routing.RouteValueDictionary(routeValues);
            var targetUrl = UrlHelper.GenerateUrl(null, actionName, controllerName, routeVals, ajaxHelper.RouteCollection, ajaxHelper.ViewContext.RequestContext, true);

            return(MvcHtmlString.Create(ajaxHelper.GenerateLink(linkText, targetUrl, ajaxOptions ?? new AjaxOptions(), htmlAttributes)));
        }
Пример #15
0
        public static MvcHtmlString PagerDropdownForThumbnail(this HtmlHelper htmlHelper, int pagesize, string actionName, string controllerName = "", AjaxOptions ajaxOptions = null, object routeValues = null, object htmlAttributes = null, int staticPageSize = 0)
        {
            var    builder   = new TagBuilder("select");
            var    urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);
            string value     = pagesize.ToString();

            string url = actionName;

            if (routeValues != null)
            {
                var rValues = new System.Web.Routing.RouteValueDictionary(routeValues);
                if (controllerName == "")
                {
                    url = urlHelper.Action(actionName, rValues);
                }
                else
                {
                    url = urlHelper.Action(actionName, controllerName, rValues);
                }
            }
            else
            {
                if (controllerName != "")
                {
                    url = urlHelper.Action(actionName, controllerName);
                }
            }
            if (htmlAttributes != null)
            {
                builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
            }
            if (ajaxOptions != null)
            {
                builder.MergeAttributes(ajaxOptions.ToUnobtrusiveHtmlAttributes());
            }
            StringBuilder options = new StringBuilder();


            options           = options.Append("<option value='10' " + ((!string.IsNullOrEmpty(value) && value == "10") ? "selected=selected" : "") + ">10</option>");
            options           = options.Append("<option value='20' " + ((!string.IsNullOrEmpty(value) && value == "20") ? "selected=selected" : "") + ">20</option>");
            options           = options.Append("<option value='30' " + ((!string.IsNullOrEmpty(value) && value == "30") ? "selected=selected" : "") + ">30</option>");
            options           = options.Append("<option value='50' " + ((!string.IsNullOrEmpty(value) && value == "50") ? "selected=selected" : "") + ">50</option>");
            options           = options.Append("<option value='100' " + ((!string.IsNullOrEmpty(value) && value == "100") ? "selected=selected" : "") + ">100</option>");
            builder.InnerHtml = options.ToString();
            //builder.Attributes["onchange"] = "pagerDropdownChange(this,'" + url + "')";
            builder.Attributes["onchange"] = "pagerThumbViewDropdownChange(this,'" + url + "' , " + value + ")";//pass old page value on drop down change
            builder.Attributes["class"]    = "pagerDropdown form-control input-sm input-xsmall input-inline";
            return(MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal)));
        }
Пример #16
0
        public static MvcHtmlString InclineLink(this HtmlHelper htmlHelper, string linkText, MvcHtmlString s, object htmlAttributes)
        {
            TagBuilder builder = new TagBuilder("a");

            byte[] data = System.Text.Encoding.UTF8.GetBytes(s.ToHtmlString());
            string href = string.Format(InclineImageExtension.hrefFormat, System.Convert.ToBase64String(data));

            builder.MergeAttribute("href", href);
            builder.InnerHtml = htmlHelper.Encode(linkText);
            if (htmlAttributes != null)
            {
                System.Web.Routing.RouteValueDictionary dict = new System.Web.Routing.RouteValueDictionary(htmlAttributes);
                builder.MergeAttributes <string, object>(dict, false);
            }
            return(MvcHtmlString.Create(builder.ToString()));
        }
Пример #17
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

            try
            {
                int         RedirectionType;
                object      path             = null;
                string      sController      = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
                string      sAction          = filterContext.ActionDescriptor.ActionName;
                string      ControllerAction = sController + sAction;
                int         ValidationType   = ConstEnum.ValidateTo[ControllerAction];
                int         LoggenInUserId   = objLoginUserDetails.LoggedInUserID;
                CommonDAL   objCommonDAL     = new CommonDAL();
                CommonModel objCommonModel   = new CommonModel();
                CommonDTO   objCommonDTO     = new CommonDTO();
                objCommonDTO = objCommonDAL.InitialChecks(objLoginUserDetails.CompanyDBConnectionString, ValidationType, LoggenInUserId, out RedirectionType);
                if (RedirectionType != 0)
                {
                    path = ConstEnum.Redirect[RedirectionType];
                    var sType  = path.GetType();
                    var values = new System.Web.Routing.RouteValueDictionary();
                    foreach (var prop in sType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    {
                        values.Add(prop.Name, Convert.ToString(prop.GetValue(path, null)));
                    }
                    if (objCommonDTO != null)
                    {
                        var sourceType = objCommonDTO.GetType();
                        foreach (var property in sourceType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            if (Convert.ToString(property.GetValue(objCommonDTO, null)) != null && Convert.ToString(property.GetValue(objCommonDTO, null)) != "")
                            {
                                values.Add(property.Name, Convert.ToString(property.GetValue(objCommonDTO, null)));
                            }
                        }
                    }
                    filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(values));
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Пример #18
0
 public override void OnAuthorization(AuthorizationContext filterContext)
 {
     if (this.Roles.Split(',').Any(filterContext.HttpContext.User.IsInRole))
     {
         base.OnAuthorization(filterContext);
     }
     else
     {
         string ReturnURL = filterContext.RequestContext.HttpContext.Request.Path.ToString();
         filterContext.Controller.TempData.Add("Message",
                                               $"you must be in at least one of the following roles to access this resource:  {Roles}");
         filterContext.Controller.TempData.Add("ReturnURL", ReturnURL);
         System.Web.Routing.RouteValueDictionary dict = new System.Web.Routing.RouteValueDictionary();
         dict.Add("Controller", "Home");
         dict.Add("Action", "Login");
         filterContext.Result = new RedirectToRouteResult(dict);
     }
 }
Пример #19
0
        public System.Web.Routing.RouteValueDictionary GetValues(object dataItem, System.Web.Routing.RouteValueDictionary routeValueDictionary, System.Web.Mvc.ViewContext viewContext)
        {
            var folder = ((Folder)dataItem).AsActual();

            //if (folder is ContainerFolder)
            //{
            //    routeValueDictionary["folderType"] = "Container";
            //}
            if (folder is TextFolder)
            {
                routeValueDictionary["folderType"] = "Text";
            }
            else if (folder is MediaFolder)
            {
                routeValueDictionary["folderType"] = "Binary";
            }
            return(routeValueDictionary);
        }
Пример #20
0
        public static MvcHtmlString InclineImage(this HtmlHelper helper, Image image, ImageFormat format, object htmlAttributes)
        {
            byte[] data;
            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
            {
                image.Save(stream, format);
                data = stream.ToArray();
            }
            string     src     = string.Format(InclineImageExtension.srcFormat, format, System.Convert.ToBase64String(data));
            TagBuilder builder = new TagBuilder("img");

            builder.MergeAttribute("src", src);
            if (htmlAttributes != null)
            {
                System.Web.Routing.RouteValueDictionary dict = new System.Web.Routing.RouteValueDictionary(htmlAttributes);
                builder.MergeAttributes <string, object>(dict, false);
            }
            return(MvcHtmlString.Create(builder.ToString()));
        }
Пример #21
0
 public override void OnAuthorization(AuthorizationContext filterContext)
 {
     if (filterContext.HttpContext.User.Identity.IsAuthenticated)
     {
         //Call base class to allow user into the action method
         base.OnAuthorization(filterContext);
     }
     else
     {
         string ReturnURL = filterContext.RequestContext.HttpContext.Request.Path.ToString();
         filterContext.Controller.TempData.Add("Message",
                                               $"you must be logged into any account to access this resource, you are not currently logged in at all");
         filterContext.Controller.TempData.Add("ReturnURL", ReturnURL);
         System.Web.Routing.RouteValueDictionary dict = new System.Web.Routing.RouteValueDictionary();
         dict.Add("Controller", "Home");
         dict.Add("Action", "Login");
         filterContext.Result = new RedirectToRouteResult(dict);
     }
 }
        public ActionResult EditProfile()
        {
            UserSession userSessionMgr = (UserSession)Session[SessionManagement.Constants.UserSessionMgr];

            if (userSessionMgr == null) // we were not signed on yet
            {
                return(RedirectToAction(Constants.SignOn, Constants.Account, Constants.Admin));
            }
            if (userSessionMgr.IsAccessAllowed(Constants.UIControlCode_AdminEditProfile_Code))
            {
                DataAccessMgr daMgr = Global.GetDataAccessMgr(this.HttpContext);
                DbCommand     dbCmd = UserMaster.GetUserMasterCmd(daMgr);
                dbCmd.Parameters[daMgr.BuildParamName(DataManagement.Constants.UserId)].Value = this.HttpContext.User.Identity.Name;
                EditProfileModel profileData = daMgr.ExecuteCollection <EditProfileModel>(dbCmd, null).First();
                return(View(Constants._Page_EditProfile, profileData));
            }
            ViewBag.Status = "Insufficient privileges for the action." + Request.Url;
            string referUrl = Request.QueryString[Constants.UrlReferrer];

            System.Web.Routing.RouteValueDictionary dictionary = new System.Web.Routing.RouteValueDictionary();
            dictionary.Add(Constants.UrlReferrer, referUrl);
            return(RedirectToAction(Constants.AccessDenied, Constants.Home, dictionary));
        }
        public static MvcHtmlString AuthorizedActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary <string, object> htmlAttributes)
        {
            if (routeValues == null)
            {
                routeValues = new System.Web.Routing.RouteValueDictionary();
            }
            if (!routeValues.ContainsKey("area"))
            {
                routeValues.Add("area", "");
            }
            if (string.IsNullOrEmpty(controllerName))
            {
                controllerName = (routeValues.TryGetValue("controller") as string);
            }
            if (string.IsNullOrEmpty(controllerName))
            {
                controllerName = htmlHelper.ViewContext.RouteData.GetRequiredString("controller");
            }
            string        url = UrlHelper.GenerateUrl(null, actionName, controllerName, routeValues, System.Web.Routing.RouteTable.Routes, htmlHelper.ViewContext.RequestContext, false);
            MvcHtmlString result;

            if (!Authorization.Instance.IsAuthrized(htmlHelper.ViewContext.HttpContext, url))
            {
                result = MvcHtmlString.Empty;
            }
            else
            {
                TagBuilder builder = new TagBuilder("a")
                {
                    InnerHtml = (!string.IsNullOrEmpty(linkText)) ? HttpUtility.HtmlEncode(linkText) : string.Empty
                };
                builder.MergeAttributes <string, object>(htmlAttributes);
                builder.MergeAttribute("href", url);
                result = MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
            }
            return(result);
        }
Пример #24
0
 partial void DeleteAndRedirectOverride(T4MVC_Framework_Mvc_ActionResults_RedirectToRouteWithTempDataResult callInfo, System.Action delete, System.Web.Routing.RouteValueDictionary routeValueDictionary);
Пример #25
0
        public override Framework.Mvc.ActionResults.RedirectToRouteWithTempDataResult RedirectToFailureAction(System.Web.Routing.RouteValueDictionary routeValueDictionary, string message, bool openDialog)
        {
            var callInfo = new T4MVC_Framework_Mvc_ActionResults_RedirectToRouteWithTempDataResult(Area, Name, ActionNames.RedirectToFailureAction);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "routeValueDictionary", routeValueDictionary);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "message", message);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "openDialog", openDialog);
            RedirectToFailureActionOverride(callInfo, routeValueDictionary, message, openDialog);
            return(callInfo);
        }
Пример #26
0
 partial void RedirectToFailureActionOverride(T4MVC_Framework_Mvc_ActionResults_RedirectToRouteWithTempDataResult callInfo, System.Web.Routing.RouteValueDictionary routeValueDictionary, string message, bool openDialog);
        public void GetPaymentInfoRoute(out string actionName, out string controllerName, out System.Web.Routing.RouteValueDictionary routeValues)
        {
            actionName     = "PaymentInfo";
            controllerName = "Tranzilla";

            routeValues = new RouteValueDictionary()
            {
                { "Namespaces", "Nop.Plugin.Payments.Tranzilla.Controllers" },
                { "area", null }
            };
        }
Пример #28
0
        public static MvcHtmlString ActionSortLink(this HtmlHelper helper, string linkText, string actionName,
            object routeValues, object htmlAttributes, NameValueCollection querystring)
        {
            System.Web.Routing.RouteData routeData = helper.ViewContext.RouteData;

            System.Web.Routing.RouteValueDictionary values = new RouteValueDictionary(routeData.Values);

            foreach (string k in querystring.AllKeys)
            {
                values[k] = querystring[k];
            }
            var curRouteValue = new System.Web.Routing.RouteValueDictionary(routeValues);
            foreach (var item in curRouteValue)
            {
                values[item.Key] = item.Value;
            }
            var htmlAttribs = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
            if (querystring["orderby"] == Convert.ToString(values["orderby"]))
            {

                    if (Convert.ToString(values["desc"]) == "true")
                    {
                        values["desc"] = "false";
                    }
                    else
                    {
                        values["desc"] = "true";
                    }
            }
            else
            {
                values["desc"] = "false";
            }
            return helper.ActionLink(linkText, actionName, values, htmlAttribs);
        }
Пример #29
0
        public override Framework.Mvc.ActionResults.RedirectToRouteWithTempDataResult DeleteAndRedirect(System.Action delete, System.Web.Routing.RouteValueDictionary routeValueDictionary)
        {
            var callInfo = new T4MVC_Framework_Mvc_ActionResults_RedirectToRouteWithTempDataResult(Area, Name, ActionNames.DeleteAndRedirect);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "delete", delete);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "routeValueDictionary", routeValueDictionary);
            DeleteAndRedirectOverride(callInfo, delete, routeValueDictionary);
            return(callInfo);
        }
Пример #30
0
        public static MvcHtmlString AuthorizedMenuItem(this HtmlHelper helper, string linkText, string action, string controller, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary <string, object> htmlAttributes = null)
        {
            MvcHtmlString link = helper.AuthorizedActionLink(linkText, action, controller, routeValues, htmlAttributes);
            MvcHtmlString result;

            if (link == MvcHtmlString.Empty)
            {
                result = MvcHtmlString.Empty;
            }
            else
            {
                TagBuilder builer = new TagBuilder("li")
                {
                    InnerHtml = link.ToHtmlString()
                };
                result = MvcHtmlString.Create(builer.ToString());
            }
            return(result);
        }
 public void GetConfigurationRoute(out string actionName, out string controllerName, out System.Web.Routing.RouteValueDictionary routeValues)
 {
     actionName     = "Configure";
     controllerName = "ExtendedVendor";
     routeValues    = new RouteValueDictionary()
     {
         { "Namespaces", "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }, { "area", null }
     };
 }
Пример #32
0
 /**/
 /// < summary>    
 /// 分页Pager显示    
 /// < /summary>     
 /// < param name="html">< /param>    
 /// < param name="currentPageStr">标识当前页码的QueryStringKey< /param>     
 /// < param name="pageSize">每页显示< /param>    
 /// < param name="totalCount">总数据量< /param>    
 /// < returns>< /returns>   
 public static string Pager(this HtmlHelper html, string currentPageStr, int pageSize, int totalCount)
 {
     var queryString = html.ViewContext.HttpContext.Request.QueryString;
     int currentPage = 1; //当前页
     var totalPages = Math.Max((totalCount + pageSize - 1) / pageSize, 1); //总页数
     var dict = new System.Web.Routing.RouteValueDictionary(html.ViewContext.RouteData.Values);
     var output = new System.Text.StringBuilder();
     if (!string.IsNullOrEmpty(queryString[currentPageStr]))
     {
         //与相应的QueryString绑定
         foreach (string key in queryString.Keys)
             if (queryString[key] != null && !string.IsNullOrEmpty(key))
                 dict[key] = queryString[key];
         int.TryParse(queryString[currentPageStr], out currentPage);
     }
     else
     {
         //获取 ~/Page/{page number} 的页号参数
         int.TryParse(dict[currentPageStr].ToString(), out currentPage);
     }
     if (currentPage <= 0) currentPage = 1;
     if (totalPages > 1)
     {
         if (currentPage != 1)
         {
             //处理首页连接
             dict[currentPageStr] = 1;
             output.AppendFormat("{0} ", html.RouteLink("首页", dict));
         }
         if (currentPage > 1)
         {
             //处理上一页的连接
             dict[currentPageStr] = currentPage - 1;
             output.Append(html.RouteLink("上一页", dict));
         }
         else
         {
             output.Append("上一页");
         }
         output.Append(" ");
         int currint = 5;
         for (int i = 0; i <= 10; i++)
         {
             //一共最多显示10个页码,前面5个,后面5个
             if ((currentPage + i - currint) >= 1 && (currentPage + i - currint) <= totalPages)
                 if (currint == i)
                 {
                     //当前页处理
                     output.Append(string.Format("[{0}]", currentPage));
                 }
                 else
                 {
                     //一般页处理
                     dict[currentPageStr] = currentPage + i - currint;
                     output.Append(html.RouteLink((currentPage + i - currint).ToString(), dict));
                 }
             output.Append(" ");
         }
         if (currentPage < totalPages)
         {
             //处理下一页的链接
             dict[currentPageStr] = currentPage + 1;
             output.Append(html.RouteLink("下一页", dict));
         }
         else
         {
             output.Append("下一页");
         }
         output.Append(" ");
         if (currentPage != totalPages)
         {
             dict[currentPageStr] = totalPages;
             output.Append(html.RouteLink("末页", dict));
         }
         output.Append(" ");
     }
     output.AppendFormat("{0} / {1}", currentPage, totalPages);//这个统计加不加都行
     return output.ToString();
 }