/// <summary> /// Convierte un campo /// </summary> private JabberFormItem ConvertField(DataField objDataField, string strName) { JabberFormItem objFormItem = new JabberFormItem(ConvertFieldType(objDataField.Type), strName, objDataField.Label, objDataField.Required); // AƱade los valores objFormItem.Values.AddRange(objDataField.Values); // Devuelve el campo return objFormItem; }
/// <summary> /// Obtiene el tipo del control /// </summary> private ListProperties.ControlType GetType(JabberFormItem.FormItemType intType) { switch (intType) { case JabberFormItem.FormItemType.Boolean: return ListProperties.ControlType.CheckBox; case JabberFormItem.FormItemType.Fixed: return ListProperties.ControlType.Label; case JabberFormItem.FormItemType.TextSingle: case JabberFormItem.FormItemType.TextPrivate: return ListProperties.ControlType.TextBox; case JabberFormItem.FormItemType.TextMultiple: return ListProperties.ControlType.MultiLine; default: return ListProperties.ControlType.Unknown; } }
/// <summary> /// Convierte los valores de un elemento de formulario /// </summary> private DataField Convert(JabberFormItem objFormItem) { switch (objFormItem.Type) { case JabberFormItem.FormItemType.Hidden: return new HiddenField(objFormItem.Name, objFormItem.Values.ToArray()); case JabberFormItem.FormItemType.Boolean: return new BooleanField(objFormItem.Name, objFormItem.GetFirstResult().GetBool()); case JabberFormItem.FormItemType.TextMultiple: return new TextMultiField(objFormItem.Name, objFormItem.Results.ToArray()); case JabberFormItem.FormItemType.TextPrivate: return new PasswordField(objFormItem.Name, objFormItem.GetFirstResult()); case JabberFormItem.FormItemType.TextSingle: return new TextField(objFormItem.Name, objFormItem.GetFirstResult()); default: return null; } }
/// <summary> /// Comprueba si se debe mostrar un elemento /// </summary> private bool MustShow(JabberFormItem objFormItem) { return objFormItem.Type != JabberFormItem.FormItemType.Hidden; }
/// <summary> /// Comprueba si se debe enviar un resultado /// </summary> private bool MustSend(JabberFormItem objFormItem) { return objFormItem.Type != JabberFormItem.FormItemType.Fixed; }