/// <summary> /// Adds a field for every argument that the DataMethos needs in order to be invoked /// </summary> /// <param name="method">DataMethod which parameters will be used as fields</param> public virtual void AddFields(MethodInfo method) { if (method == null) { throw new ArgumentNullException("dmethod"); } uint order = 0; //add a field for each parameter foreach (ParameterInfo param in method.GetParameters()) { FormField field; field = FormField.CreateFieldFrom(param.ParameterType); //set common values field.Container = this; field.Name = param.Name; field.Required = !param.IsOptional && !param.IsOut; field.CaptionControl.Text = new System.Resources.ResourceManager(method.DeclaringType).GetString(method.GetFriendlyFullName().Replace('.', '_') + '_' + param.Name); field.SortOrder = order++; Fields.Add(field); } }
/// <summary> /// Creates the field of specified type. /// <para xml:lang="es">Crea el campo del tipo especificado.</para> /// </summary> /// <returns>The field from.</returns> /// <param name="type">Type.</param> protected virtual FormField CreateFieldFrom(Type type) { return(FormField.CreateFieldFrom(type)); }