/// <summary> /// /// </summary> /// <param name="myGroup"></param> /// <param name="WorkflowStateId"></param> /// <returns></returns> public static FormGroupDTO GetFormGroupDTO(IFormGroup myGroup, long WorkflowStateId) { FormGroupDTO result = new FormGroupDTO(); List <string> unMappedField = new List <string> { "fieldParameters" }; ToolBox.MapObject(myGroup, result, true); result.formFields = new List <FormFieldDTO>(); foreach (IFormField curField in myGroup.GetFormFields().Where(f => f.WorkflowStateId == WorkflowStateId || f.WorkflowStateId == null).OrderBy(f => f.WorkflowStateId)) { if (result.formFields.Where(s => s.FieldName == curField.FieldName && s.Active).FirstOrDefault() == null) // Check field not already defined { FormFieldDTO curFieldDTO = new FormFieldDTO(); ToolBox.MapObject(curField, curFieldDTO, unMappedField: unMappedField); curFieldDTO.FieldParameters = JsonConvert.DeserializeObject <Dictionary <string, object> >(curField.FieldParameters); // TODO Ajouter les traitements pour les parameters result.formFields.Add(curFieldDTO); } } return(result); }
/// <summary> /// Returns a switch input element for each property in the object that is represented by the specified expression. /// </summary> /// /// <returns> /// A switch input element for each property in the object that is represented by the specified expression. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <typeparam name="TModel">The type of the model.</typeparam> public static YimaFormSwitch <TModel> YimaSwitchFor <TModel>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, bool> > expression) { return(formGroup.YimaSwitchFor <TModel>(expression, (IDictionary <string, object>)null)); }
/// <summary> /// Initializes a new instance of the form check box for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <param name="formGroup">The current form group instance.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="htmlAttributes">A dictionary that contains the HTML attributes to set for the element.</param> public YimaFormSwitch(IFormGroup <TModel> formGroup, Expression <Func <TModel, bool> > expression, IDictionary <string, object> htmlAttributes) : base(formGroup, expression, htmlAttributes) { }
/// <summary> /// Returns a switch input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <returns> /// A switch input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param>< /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="htmlAttributes">A dictionary that contains the HTML attributes to set for the element.</param> /// <typeparam name="TModel">The type of the model.</typeparam> public static YimaFormSwitch <TModel> YimaSwitchFor <TModel>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, bool> > expression, IDictionary <string, object> htmlAttributes) { return(new YimaFormSwitch <TModel>(formGroup, expression, htmlAttributes)); }
/// <summary> /// Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <returns> /// An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="value">The value of the selected radio button. The value is retrieved in this order - the <see cref="T:System.Web.Mvc.ModelStateDictionary"/> object, the value of this parameter, the <see cref="T:System.Web.Mvc.ViewDataDictionary"/> object, and lastly, a value attribute in the html attributes.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <typeparam name="TModel">The type of the model.</typeparam> /// <typeparam name="TProperty">The type of the value.</typeparam> public static YimaFormRadioButton <TModel, TProperty> YimaRadioButtonFor <TModel, TProperty>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, TProperty> > expression, object value, object htmlAttributes) { return(formGroup.YimaRadioButtonFor <TModel, TProperty>(expression, value, (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); }
/// <summary> /// Returns an input icon component. /// </summary> /// <param name="formGroup">The form group instance that this method extends.</param> /// <param name="textBox">The text box component of input icon.</param> /// <returns>An input icon component.</returns> public static YimaFormInputIcon InputIcon(this IFormGroup formGroup, FormTextBoxBase textBox) { return(new YimaFormInputIcon(formGroup, textBox)); }
/// <summary> /// Returns an input icon component. /// </summary> /// <param name="formGroup">The form group instance that this method extends.</param> /// <param name="textArea">The text area component of input icon.</param> /// <returns>An input icon component.</returns> public static YimaFormInputIcon InputIcon(this IFormGroup formGroup, TextAreaBase textArea) { return(new YimaFormInputIcon(formGroup, textArea)); }
/// <summary> /// Initializes a new instance of the component with the specified form group. /// </summary> /// <param name="formGroup">The form group.</param> public YimaFormHeader(IFormGroup formGroup) : base(formGroup) { Init(); }
public FormGroupPresenter(IFormGroup view, IDBaseManager manager) { Initialize(view, manager); }
public FormGroupPresenter(IFormGroup view, IDBaseManager manager, Group group) { Initialize(view, manager); _group = group; }
private void Initialize(IFormGroup view, IDBaseManager manager) { _view = view; _manager = manager; _view.OK_Click += _view_OK_Click; }
/// <summary> /// Initializes a new instance of form radio button for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <param name="formGroup">The current form group instance.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="value">The value of the selected radio button. The value is retrieved in this order - the <see cref="T:System.Web.Mvc.ModelStateDictionary"/> object, the value of this parameter, the <see cref="T:System.Web.Mvc.ViewDataDictionary"/> object, and lastly, a value attribute in the HTML attributes.</param> /// <param name="htmlAttributes">A dictionary that contains the HTML attributes to set for the element.</param> public YimaFormRadioButton(IFormGroup <TModel> formGroup, Expression <Func <TModel, TProperty> > expression, object value, IDictionary <string, object> htmlAttributes) : base(formGroup, expression, value, htmlAttributes) { }
/// <summary> /// Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <returns> /// An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="value">The value of the selected radio button. The value is retrieved in this order - the <see cref="T:System.Web.Mvc.ModelStateDictionary"/> object, the value of this parameter, the <see cref="T:System.Web.Mvc.ViewDataDictionary"/> object, and lastly, a value attribute in the html attributes.</param> /// <param name="htmlAttributes">A dictionary that contains the HTML attributes to set for the element.</param> /// <typeparam name="TModel">The type of the model.</typeparam> /// <typeparam name="TProperty">The type of the value.</typeparam> public static YimaFormRadioButton <TModel, TProperty> YimaRadioButtonFor <TModel, TProperty>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, TProperty> > expression, object value, IDictionary <string, object> htmlAttributes) { return(new YimaFormRadioButton <TModel, TProperty>(formGroup, expression, value, htmlAttributes)); }
/// <summary> /// Returns a switch input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </summary> /// /// <returns> /// A switch input element for each property in the object that is represented by the specified expression, using the specified HTML attributes. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <typeparam name="TModel">The type of the model.</typeparam> public static YimaFormSwitch <TModel> YimaSwitchFor <TModel>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, bool> > expression, object htmlAttributes) { return(formGroup.YimaSwitchFor <TModel>(expression, (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); }
/// <summary> /// Initializes a new instance of the component with the specified form group and text box. /// </summary> /// <param name="formGroup">The form group.</param> /// <param name="textBox">The text box.</param> public YimaFormInputIcon(IFormGroup formGroup, FormTextBoxBase textBox) : base(formGroup) { Init(textBox); }
/// <summary> /// Returns a form header component. /// </summary> /// <param name="formGroup">The formGroup instance that this method extends.</param> /// <param name="header">The value of the header.</param> /// <returns>A form header component.</returns> public static YimaFormHeader FormHeader(this IFormGroup formGroup, string header) { return(new YimaFormHeader(formGroup).AddChild(header)); }
/// <summary> /// Initializes a new instance of the component with the specified form group and text area. /// </summary> /// <param name="formGroup">The form group.</param> /// <param name="textArea">The text area.</param> public YimaFormInputIcon(IFormGroup formGroup, FormTextAreaBase textArea) : base(formGroup) { Init(textArea); }
// This prepares the outer form group if we need one // Needs to be in a separate method so that derived classes can create the form group before outputting any wrappers of their own protected void Prepare(TextWriter writer) { // Only prepare once if (_prepared) { return; } _prepared = true; // Make sure we're in a form group IFormGroup formGroup = GetComponent <IFormGroup>(); if (formGroup == null && EnsureFormGroup) { _formGroup = new FormGroup <THelper>(Helper); formGroup = _formGroup; } // Move any validation classes to the form group, but only if it's implicit for this control and doesn't already have any if (CssClasses.Any(x => x.StartsWith("has-")) && _formGroup != null && formGroup != null && !formGroup.CssClasses.Any(x => x.StartsWith("has-"))) { foreach (string formValidation in CssClasses.Where(x => x.StartsWith("has-"))) { formGroup.CssClasses.Add(formValidation); } CssClasses.RemoveWhere(x => x.StartsWith("has-")); } // Move any grid column classes to the form group, but only if it's implicit for this control and doesn't already have any if (CssClasses.Any(x => x.StartsWith("col-")) && _formGroup != null && formGroup != null && !formGroup.CssClasses.Any(x => x.StartsWith("col-"))) { foreach (string col in CssClasses.Where(x => x.StartsWith("col-"))) { formGroup.CssClasses.Add(col); } CssClasses.RemoveWhere(x => x.StartsWith("col-")); } // Add the label to the form group or write it if (_label != null) { // Set the label's for attribute to the input name string name = Attributes.GetValue("name"); if (!string.IsNullOrWhiteSpace(name)) { _label.MergeAttribute("for", name); } // Add or write the label if (_formGroup != null) { _formGroup.ControlLabel = _label; } else { _label.StartAndFinish(writer); } } // Start the new form group if we created one if (_formGroup != null) { _formGroup.Start(writer); } _prepared = true; }
/// <summary> /// Returns a radio button input element for each property in the object that is represented by the specified expression. /// </summary> /// /// <returns> /// An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression. /// </returns> /// <param name="formGroup">The IFormGroup instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="value">The value of the selected radio button. The value is retrieved in this order - the <see cref="T:System.Web.Mvc.ModelStateDictionary"/> object, the value of this parameter, the <see cref="T:System.Web.Mvc.ViewDataDictionary"/> object, and lastly, a value attribute in the html attributes.</param> /// <typeparam name="TModel">The type of the model.</typeparam> /// <typeparam name="TProperty">The type of the value.</typeparam> public static YimaFormRadioButton <TModel, TProperty> YimaRadioButtonFor <TModel, TProperty>(this IFormGroup <TModel> formGroup, Expression <Func <TModel, TProperty> > expression, object value) { return(formGroup.YimaRadioButtonFor <TModel, TProperty>(expression, value, (IDictionary <string, object>)null)); }