public ProductService(
     IValidationCollection validation,
     IProductRepository productRepository)
 {
     _Validation        = validation;
     _ProductRepository = productRepository;
 }
Beispiel #2
0
 public PersonService(
     IValidationCollection validation,
     IPersonRepository personRepository)
 {
     _Validation       = validation;
     _PersonRepository = personRepository;
 }
 public NegotiationService(
     IValidationCollection validation,
     INegotiationRepository negotiationRepository,
     IProductRepository productRepository)
 {
     _Validation            = validation;
     _NegotiationRepository = negotiationRepository;
     _ProductRepository     = productRepository;
 }
        public static IValidationCollection GetDateValidators(this IHtmlHelper helper, CalendarTypes type, bool required = false, DateRange range = null, string memberName = null, string alternateLabel = null)
        {
            IValidationCollection coll = helper.VCollection();

            coll.AddDate(type, range);
            if (required)
            {
                coll.AddRequired();
            }
            return(coll);
        }
        public static IHtmlContent TextBoxCell <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp,
                                                           string textBoxType         = "text",
                                                           IValidationCollection coll = null,
                                                           object cellAttributes      = null,
                                                           object inputAttr           = null,
                                                           string classes             = "")
        {
            var        Provider = helper.GetService <ITablesHelper>();
            CellWriter mod      = Provider.TextBoxCell(helper, exp, textBoxType, null, coll, cellAttributes, inputAttr, classes);

            return(mod.Write(InputControls.TextBox));
        }
Beispiel #6
0
        public virtual ControlGroupWriter CalendarGroup <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, CalendarTypes type, DateRange range, Calendars cals, bool required, int size, string alternateLabel, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var mod = GetNewWriter(helper);

            mod.UseExpression(exp);
            mod.SetOptions(size, alternateLabel, null, attrs, inputAttr, inputClasses, groupClasses);
            IValidationCollection coll = helper.GetDateValidators(type, required, range, mod.InputModel.MemberName, alternateLabel);

            mod.UseValidation(coll, mod.InputModel.FieldName, alternateLabel);

            return(mod);
        }
Beispiel #7
0
        public void UseValidation(IValidationCollection coll, string fieldName = null, string alternateLabel = null, string rowIndex = null)
        {
            VCollection = coll;
            if (VCollection == null)
            {
                VCollection = new ValidationCollection(Helper.GetFormName());
            }
            string defName = InputModel.NgFormName + "__" + MemberName?.Replace(".", "_");

            fieldName = (fieldName ?? defName) + (rowIndex == null ? "" : $"'+{rowIndex}+'");
            VCollection.SetMember(ColumnId, fieldName, alternateLabel);

            ColumnModel.IsRequired         = VCollection.HasRequired();
            ColumnModel.ValidationMessages = GetCellErrors(VCollection);
        }
Beispiel #8
0
        public IHtmlContent GetCellErrors(IValidationCollection coll)
        {
            ValidationMessagesModel mod = new ValidationMessagesModel
            {
                FormName  = coll.FormName,
                FieldName = coll.FormFieldName,
            };
            string mess = "";

            foreach (Validator v in coll.Validators)
            {
                mess += v.ValidationMessage + "\n";
            }
            mod.Messages = new HtmlString(mess);
            return(Helper.GetComponent("TableCells/CellValidation", mod));
        }
Beispiel #9
0
        //static IElementsHelper Provider { get { return Shell.ScopedInjector.GetRequiredService<IElementsHelper>(); } }

        public static IHtmlContent TextAreaGroup <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp,
                                                             IValidationCollection coll = null,
                                                             int size = -1,
                                                             string alternateLabel = null,
                                                             string placeHolder    = null,
                                                             object attrs          = null,
                                                             bool localizable      = false,
                                                             object inputAttr      = null,
                                                             string inputClasses   = "",
                                                             string groupClasses   = "") where T : class
        {
            var Provider = helper.GetService <IElementsHelper>();
            var elem     = Provider.TextAreaGroup(helper, exp, coll, size, alternateLabel, placeHolder, attrs, localizable, inputAttr, inputClasses, groupClasses);

            return(elem.Write(InputControls.Textarea, localizable));
        }
        public static IHtmlContent TextBoxCell <T, TValue>(
            this IHtmlHelper <T> helper,
            Expression <Func <T, TValue> > exp,
            string textBoxType         = "text",
            IValidationCollection coll = null,
            object cellAttributes      = null,
            object inputAttr           = null,
            string classes             = "",
            string rowIndex            = null,
            bool localizable           = false)
        {
            var        Provider = helper.GetService <IMoldsterTableHelper>();
            CellWriter wt       = Provider.TextBoxCell(helper, exp, textBoxType, coll, cellAttributes, inputAttr, classes, rowIndex, localizable);

            return(wt.Write(InputControls.TextBox));
        }
Beispiel #11
0
        public static IHtmlContent AutoComplete <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp,
                                                            Lister src,
                                                            IValidationCollection coll = null,
                                                            int size = -1,
                                                            string alternateLabel = null,
                                                            string placeHolder    = null,
                                                            object attrs          = null,
                                                            object inputAttr      = null,
                                                            string inputClasses   = "",
                                                            string groupClasses   = "")
        {
            var Provider = helper.GetService <IElementsHelper>();
            var elem     = Provider.AutoCompleteGroup(helper, exp, src, coll, size, alternateLabel, placeHolder, attrs, inputAttr, inputClasses, groupClasses);

            return(elem.Write(InputControls.TextBox));
        }
Beispiel #12
0
        public void UseValidation(IValidationCollection coll, string fieldName = null, string alternateLabel = null)
        {
            VCollection = coll;
            if (VCollection == null)
            {
                VCollection = new ValidationCollection(Helper.GetFormName());
            }

            VCollection.SetMember(ColumnId, fieldName ?? InputModel.FieldName, alternateLabel);

            GroupModel.IsRequired = VCollection.HasRequired();
            if (GroupModel.IsRequired)
            {
                GroupModel.RequiredCondition = VCollection.GetRequiredCondition();
            }
            GroupModel.ValidationMessages = VCollection.GetMessages(Helper);
        }
Beispiel #13
0
        public static IHtmlContent InputControl <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp,
                                                            InputControls component,
                                                            string textType = "text",
                                                            Dictionary <string, object> radioOptions = null,
                                                            int size = -1,
                                                            string alternateLabel      = null,
                                                            string placeHolder         = null,
                                                            IValidationCollection coll = null,
                                                            object attrs        = null,
                                                            object inputAttr    = null,
                                                            string inputClasses = "",
                                                            string groupClasses = "")
        {
            var Provider = helper.GetService <IElementsHelper>();

            return(Provider.InputControl(helper, exp, component, textType, radioOptions, size, alternateLabel, placeHolder, coll, attrs, inputAttr, inputClasses, groupClasses));
        }
Beispiel #14
0
        protected virtual ComponentWriter GetInputControlWriter <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, InputControls component, string textType, Dictionary <string, object> radioOptions, int size, string alternateLabel, string placeHolder, IValidationCollection coll, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var mod = GetNewWriter(helper);

            mod.UseExpression(exp);
            mod.SetOptions(size, alternateLabel, placeHolder, attrs, inputAttr, inputClasses, groupClasses);
            if (coll != null)
            {
                mod.UseValidation(coll, null, alternateLabel);
            }
            switch (component)
            {
            case InputControls.Radio:
                mod.InputModel = mod.InputModel.GetRadioInput(radioOptions);
                break;

            case InputControls.CheckBox:
                mod.InputModel = mod.InputModel.GetCheckInput(null, null, true);
                break;
            }

            mod.InputModel.TextBoxType = textType;
            return(mod);
        }
        public IHtmlContent InputControl_Ng <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, InputControls component, string textType, Dictionary <string, object> radioOptions, IValidationCollection coll, int size, string alternateLabel, string placeHolder, object attrs, string listItem, string inputClasses)
        {
            var mod = GetInputControlWriter(helper, exp, component, textType, radioOptions, size, alternateLabel, placeHolder, coll, null, attrs, inputClasses, null);

            if (component == InputControls.CheckBox)
            {
                ((CheckNgInput)mod.InputModel).ListItemName = listItem ?? helper.GetModelName();
            }

            return(mod.Write(component));
        }
Beispiel #16
0
        public virtual ControlGroupWriter TextBoxGroup <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string textType, IValidationCollection coll, int size, string alternateLabel, string placeHolder, bool localizable, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var mod = GetNewWriter(helper);

            mod.UseExpression(exp);
            mod.SetOptions(size, alternateLabel, placeHolder, attrs, inputAttr, inputClasses, groupClasses);
            mod.UseValidation(coll, mod.InputModel.FieldName, alternateLabel);

            mod.InputModel.TextBoxType = textType;

            return(mod);
        }
Beispiel #17
0
        public virtual ControlGroupWriter AutoCompleteGroup <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, Lister src, IValidationCollection coll, int size, string alternateLabel, string placeHolder, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var mod = GetNewWriter(helper);

            mod.UseExpression(exp);
            mod.SetOptions(size, alternateLabel, placeHolder, attrs, inputAttr, inputClasses, groupClasses);

            if (coll != null)
            {
                mod.UseValidation(coll, mod.InputModel.FieldName, alternateLabel);
            }

            mod.InputModel.TextBoxType = "text";
            mod.InputModel.NgOptions   = src.IsLookup ? "Lookups." + src.ListName : src.ListName;

            return(mod);
        }
Beispiel #18
0
        public virtual IHtmlContent InputControl <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, InputControls component, string textType, Dictionary <string, object> radioOptions, int size, string alternateLabel, string placeHolder, IValidationCollection coll, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            ComponentWriter mod = GetInputControlWriter(helper, exp, component, textType, radioOptions, size, alternateLabel, placeHolder, coll, attrs, inputAttr, inputClasses, groupClasses);

            if (!mod.Accessibility.Read)
            {
                return(null);
            }
            if (!mod.Accessibility.Write)
            {
                return(mod.GetLabelControl());
            }
            return(mod.GetInputControl(component));
        }
        public override ControlGroupWriter AutoCompleteGroup <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, Lister src, IValidationCollection coll, int size, string alternateLabel, string placeHolder, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var d = base.AutoCompleteGroup(helper, exp, src, coll, size, alternateLabel, placeHolder, attrs, inputAttr, inputClasses, groupClasses);

            d.Accessibility = proc.Process(helper, exp, "AC_TextBox");
            helper.AddSource(src);
            return(d);
        }
        public override ControlGroupWriter TextBoxGroup <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string textType, IValidationCollection coll, int size, string alternateLabel, string placeHolder, bool localizable, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            var d = base.TextBoxGroup(helper, exp, textType, coll, size, alternateLabel, placeHolder, localizable, attrs, inputAttr, inputClasses, groupClasses);

            d.Accessibility = proc.Process(helper, exp, InputControls.TextBox);
            return(d);
        }
        public virtual CellWriter TextBoxCell <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string textBoxType, string rowIndex, IValidationCollection coll, object cellAttributes, object inputAttr, string classes)
        {
            var writer = new CellWriter(helper);

            writer.UseExpression(exp);

            writer.InputModel.TextBoxType = textBoxType;
            writer.InputModel.RowIndex    = rowIndex;
            writer.Initialize(null, null, cellAttributes, inputAttr, classes);
            if (coll != null)
            {
                writer.UseValidation(coll, rowIndex: rowIndex);
            }
            return(writer);
        }
        public override CellWriter TextBoxCell <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string textBoxType, string rowIndex, IValidationCollection coll, object cellAttributes, object inputAttr, string classes)
        {
            var w = base.TextBoxCell(helper, exp, textBoxType, rowIndex, coll, cellAttributes, inputAttr, classes);

            w.Accessibility = proc.ProcessCell(helper, exp, InputControls.TextBox);
            return(w);
        }