public static ModalControl MidSizeModal(this HtmlHelper helper)
        {
            var div = new DivControl().SetId(ConstantHelper.MidModalContentId);
            var obj = helper.Modal(ConstantHelper.MidModalId, "Confirm")
                      .SetBodyHtml(ConstantHelper.MidModalContentId, div.ToHtmlString());

            return(obj);
        }
        public static ModalControl FullSizeModal(this HtmlHelper helper)
        {
            // Body
            var div = new DivControl().SetId(ConstantHelper.FullModalContentId);
            var obj = helper.Modal(ConstantHelper.FullModalId, "Confirm")
                      .SetSize(SizeOptions.Full)
                      .AddCssClass("ctm-modal-full")
                      .SetBodyHtml(ConstantHelper.FullModalContentId, div.ToHtmlString());

            return(obj);
        }
예제 #3
0
        private static MvcHtmlString InputGroupFor <TModel, TValue>(this HtmlHelper <TModel> helper, Expression <Func <TModel, TValue> > expression, object wrapperHtmlAttributes = null, object inputHtmlAttributes = null)
        {
            var htmlAttributes = HtmlHelperExtension.AddCssClass(inputHtmlAttributes, "form-control");

            var label         = helper.LabelFor(expression, htmlAttributes: new { @class = "control-label" });
            var input         = helper.EditorFor(expression, new { htmlAttributes = htmlAttributes });
            var validationMsg = helper.ValidationMessageFor(expression, "", new { @class = "text-danger" });

            var div2 = new DivControl(input + validationMsg.ToHtmlString());
            var div1 = new DivControl(label + div2.ToHtmlString()).AddCssClass("form-group").MergeAttributes(wrapperHtmlAttributes);

            return(MvcHtmlString.Create(div1.ToHtmlString()));
        }
예제 #4
0
        private static MvcHtmlString GenerateDropDownListGroupFor <TModel, TValue>(HtmlHelper <TModel> helper, Expression <Func <TModel, TValue> > expression, IEnumerable <SelectListItem> selectList, object wrapperHtmlAttributes = null, object inputHtmlAttributes = null)
        {
            var htmlAttributes = HtmlHelperExtension.AddCssClass(inputHtmlAttributes, "form-control");

            var label         = helper.LabelFor(expression, htmlAttributes: new { @class = "control-label" });
            var input         = helper.DropDownListFor(expression, selectList, "", htmlAttributes);
            var validationMsg = helper.ValidationMessageFor(expression, "", new { @class = "text-danger" });

            var div2 = new DivControl(input + validationMsg.ToHtmlString());
            var div1 = new DivControl(label + div2.ToHtmlString()).AddCssClass("form-group").MergeAttributes(wrapperHtmlAttributes);

            return(MvcHtmlString.Create(div1.ToHtmlString()));
        }
예제 #5
0
        public static MvcHtmlString CheckBoxGroupFor <TModel>(this HtmlHelper <TModel> helper, Expression <Func <TModel, bool> > expression, object wrapperHtmlAttributes = null, object inputHtmlAttributes = null)
        {
            var    expression1 = (MemberExpression)expression.Body;
            string name        = expression1.Member.Name;

            var htmlAttributes = HtmlHelperExtension.AddCssClass(inputHtmlAttributes, "form-control");

            var label    = helper.LabelFor(expression);
            var checkBox = new CheckBoxControl().SetId(name).SetColor(ColorOptions.Primary).SetAttributes(htmlAttributes);

            var div2 = new DivControl(checkBox.ToHtmlString()).AddCssClass(" ctm-checkbox");
            var div1 = new DivControl(label + div2.ToHtmlString()).AddCssClass("form-group").MergeAttributes(wrapperHtmlAttributes);

            return(MvcHtmlString.Create(div1.ToHtmlString()));
        }
예제 #6
0
        protected string Form_Delete_Body <TModel>(AjaxHelper <TModel> helper)
        {
            var htmlHelper  = new HtmlHelper <TModel>(helper.ViewContext, helper.ViewDataContainer);
            var model       = helper.ViewData.Model;
            var modelIdName = ModelHelper <TModel> .GetPrimaryKeys()[0].Name;

            var modelIdValue = ModelHelper <TModel> .GetPrimaryKeyValues(model)[0];

            var row1 = htmlHelper.Hidden(modelIdName, modelIdValue);
            var row2 = new DivControl(model.ToString());
            var row3 = htmlHelper.Button()
                       .SetText(ConstViews.INFO_Delete)
                       .IsSubmitBtn(true)
                       .MergeAttribute("onclick", "hideElement('" + modelIdValue + "')");

            return(string.Concat(row1, row2, row3));
        }
예제 #7
0
        protected override string Render()
        {
            TagBuilder input      = new TagBuilder("input");
            TagBuilder label      = null;
            TagBuilder googleIcon = null;
            TagBuilder glyphIcon  = null;

            input.MergeAttribute("type", "text");
            input.AddCssClass("form-control");
            input.MergeAttribute("placeholder", Placeholder);
            input.GenerateId(Id);

            if (LabelText != null)
            {
                label = new TagBuilder("label");
                label.MergeAttribute("for", Id);
                label.SetInnerText(LabelText);
            }

            if (GoogleIcon != null)
            {
                googleIcon = new TagBuilder("span");
                googleIcon.AddCssClass("input-group-addon");
                TagBuilder i = new TagBuilder("i");
                i.AddCssClass("material-icons");
                i.SetInnerText(GoogleIcon);
            }

            if (GlyphIcon != null)
            {
                glyphIcon = new TagBuilder("span");
                glyphIcon.AddCssClass("input-group-addon");
                TagBuilder i = new TagBuilder("i");
                i.AddCssClass("glyphicon");
                i.AddCssClass(GoogleIcon);
            }

            var wrapper = new DivControl(
                label?.ToString()
                + googleIcon
                + glyphIcon + input)
                          .AddCssClass("form-group").ToHtmlString();

            return(wrapper);
        }
예제 #8
0
        protected override string Render()
        {
            // Table
            TagBuilder table = new TagBuilder("table");

            table.AddCssClass("table");
            table.AddCssClass("table-hover");

            // Header
            TagBuilder header = new TagBuilder("thead")
            {
                InnerHtml = new HeaderControl(_header).ToHtmlString()
            };

            // Body
            TagBuilder body = new TagBuilder("tbody");

            _rows?.ForEach(o =>
            {
                body.InnerHtml += new RowControl(o);
            });
            _rowsWithId?.ForEach(o =>
            {
                body.InnerHtml += new RowControl(o.Value).SetId(o.Key);
            });
            _rowsWithIdAndTrWithNameAttr?.ForEach(o =>
            {
                body.InnerHtml += new RowControl(o.Value).SetId(o.Key);
            });


            table.InnerHtml = header + body.ToString();

            // Container
            var container = new DivControl(table.ToString())
                            .AddCssClass("table-responsive")
                            .MergeAttributes(HtmlAttributes);

            return(container.ToHtmlString());
        }
예제 #9
0
        private MvcForm GenerateSearchForm(AjaxHelper helper, string actionName, string areaName, object routeValues, object htmlAttributes, string formBody)
        {
            var htmlHelper = new HtmlHelper(helper.ViewContext, helper.ViewDataContainer);

            // Search & Download buttons
            var searchBtn = htmlHelper.Button()
                            .IsSubmitBtn(true)
                            .SetMaterialIcon("search")
                            .AddCssClass("col-sm-6");
            var downloadBtn = htmlHelper.Button()
                              .SetMaterialIcon("file_download")
                              .AddCssClass("col-sm-6")
                              .MergeAttribute("onclick", "downloadBtnClickEvent(); ");
            var buttonWrapper = new DivControl(searchBtn.ToHtmlString() + downloadBtn)
                                .AddCssClass("col-12");

            var row = new DivControl(buttonWrapper.ToString()).AddCssClass("row");

            formBody += row;

            return(GenerateForm(helper, actionName, areaName, routeValues, htmlAttributes, formBody));
        }
        protected sealed override string Form_Search_Body(AjaxHelper helper)
        {
            var htmlHelper = new HtmlHelper <Search>(helper.ViewContext, helper.ViewDataContainer);
            var urlHelper  = new UrlHelper(helper.ViewContext.RequestContext, helper.RouteCollection);
            var model      = (Search)helper.ViewData.Model;

            string hidableDivId = Guid.NewGuid().ToString();
            var    ccName       = htmlHelper
                                  .TextBoxGroupFor(o => o.CCName, new { @class = "col-sm-12" }, new
            {
                data_url = urlHelper.Action("GetCabinCrewNames", "Query", new { area = Helpers.ConstantHelper.AreaNameAPI }),
                data_allowMultipleValues = true
            });
            var categoryID = htmlHelper
                             .DropDownListGroupFor(o => o.CategoryID, model.CategoryList, new { @class = "col-sm-4" });
            var fromDate = htmlHelper
                           .DateTimeGroupFor(o => o.FromDate, new { @class = "col-sm-4" });
            var toDate = htmlHelper
                         .DateTimeGroupFor(o => o.ToDate, new { @class = "col-sm-4" });
            var isLatest = htmlHelper
                           .CheckBoxGroupFor(o => o.IsLatest, new { @class = "col-12" }, new { data_hidableDivId = hidableDivId });



            // Wrap
            var row1 = new DivControl(ccName.ToHtmlString()).AddCssClass("row");
            var row3 = new DivControl(isLatest.ToHtmlString()).AddCssClass("row");
            var row2 = new DivControl(categoryID.ToHtmlString()
                                      + fromDate
                                      + toDate)
                       .AddCssClass("row")
                       .MergeAttribute("id", hidableDivId)
                       .Hide();

            return(row1.ToHtmlString()
                   + row2
                   + row3);
        }