예제 #1
0
        private static IHtmlContent GenerateLabel <TModel, TValue>(IHtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, IHtmlContent label)
        {
            IHtmlContent contents = HtmlHelperDisplayExtensions.DisplayFor(html, expression);
            string       result   = String.Concat("<div class=\"form-group\">",
                                                  GetString(label),
                                                  "<div class=\"col-md-8\"  style=\"padding:6px 12px\" >",
                                                  GetString(contents),
                                                  "</div>",
                                                  GetString(HtmlHelperInputExtensions.HiddenFor(html, expression)),
                                                  "</div>");

            return(new HtmlString(result));
        }
예제 #2
0
        public static IHtmlContent RPCSEditorFor <TModel, TValue>(this IHtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, OperationSet EditorRights, OperationSet displayRights, string toolTip = "", string errorMessage = "")
        {
            var appUserSvc = _serviceProvider.GetRequiredService <IApplicationUserService>();

            IHtmlContent label = HtmlHelperLabelExtensions.LabelFor(html, expression, new { @class = "control-label col-md-4" });

            if (appUserSvc.HasAccess(EditorRights))
            {
                return(GenerateEditor(html, expression, toolTip, errorMessage, label));
            }

            if (appUserSvc.HasAccess(displayRights))
            {
                return(GenerateLabel(html, expression, label));
            }

            return(HtmlHelperInputExtensions.HiddenFor(html, expression));
        }
예제 #3
0
        public static IHtmlContent RPCSDropDownList <TModel, TValue1, TValue2>(this IHtmlHelper <TModel> html, Expression <Func <TModel, TValue1> > labelExpression, Expression <Func <TModel, TValue2> > valueExpression, string name,
                                                                               IEnumerable <SelectListItem> selectList, OperationSet editRights, OperationSet displayRights)
        {
            var appUserSvc = _serviceProvider.GetRequiredService <IApplicationUserService>();

            IHtmlContent label = HtmlHelperLabelExtensions.LabelFor(html, labelExpression, new { @class = "control-label col-md-4" });

            if (appUserSvc.HasAccess(editRights))
            {
                var contents = HtmlHelperSelectExtensions.DropDownList(html, name, selectList, new { @class = "form-control" });

                string result = String.Concat("<div class=\"form-group\">",
                                              GetString(label),
                                              "<div class=\"col-md-8\">",
                                              GetString(contents),
                                              "</div>",
                                              "</div>");
                return(new HtmlString(result));
            }
            if (appUserSvc.HasAccess(displayRights))
            {
                IHtmlContent contents = HtmlHelperDisplayExtensions.DisplayFor(html, valueExpression);
                string       result   = String.Concat("<div class=\"form-group\">",
                                                      GetString(label),
                                                      "<div class=\"col-md-8\">",
                                                      GetString(contents),
                                                      "</div>",
                                                      GetString(HtmlHelperInputExtensions.HiddenFor(html, valueExpression)),
                                                      GetString(HtmlHelperInputExtensions.HiddenFor(html, labelExpression)),
                                                      "</div>");
                return(new HtmlString(result));
            }
            string v = GetString(HtmlHelperInputExtensions.HiddenFor(html, valueExpression));
            string l = GetString(HtmlHelperInputExtensions.HiddenFor(html, labelExpression));

            return(new HtmlString(v + l));
        }