private List <ElementoFormulario> ObtenerElementos(ProxyPagoServicios.ArrayOfElement elementos) { List <ElementoFormulario> listaElemento = new List <ElementoFormulario>(); foreach (ProxyPagoServicios.element info in elementos) { ElementoFormulario elemento = new ElementoFormulario() { Valor = info.m_value, Nombre = info.m_name, SoloLectura = info.m_readonly, TipoElementoFormulario = info.m_eType.ToString() }; if (info.m_input != null) { elemento.DefinicionElementoInput = new InputElement(); elemento.DefinicionElementoInput.TipoInput = info.m_input.m_iType.ToString(); elemento.DefinicionElementoInput.ValorMaximo = info.m_input.m_iMaxValue; elemento.DefinicionElementoInput.ValorMinimo = info.m_input.m_iMinValue; } if (info.m_select != null) { elemento.DefinicionElementoSelect = new SelectElement(); List <OpcionSelect> listaOpcion = new List <OpcionSelect>(); foreach (ProxyPagoServicios.option option in info.m_select.m_options) { OpcionSelect nuevaOpcion = new OpcionSelect(); nuevaOpcion.Texto = option.m_text; nuevaOpcion.Valor = option.m_value; nuevaOpcion.Cantidad = option.m_amount; listaOpcion.Add(nuevaOpcion); } elemento.DefinicionElementoSelect.Opciones = listaOpcion.ToArray(); } listaElemento.Add(elemento); } return(listaElemento); }
private ProxyPagoServicios.Form ObtenerElementosAdicionales(PagoServiciosInfoAdicional infoAdicional, int moduleId) { ProxyPagoServicios.Form formulario = new ProxyPagoServicios.Form(); ProxyPagoServicios.ArrayOfElement lista = new ProxyPagoServicios.ArrayOfElement(); foreach (ElementoFormulario elemento in infoAdicional.ElementosFormulario) { ProxyPagoServicios.element nuevoElemento = new ProxyPagoServicios.element(); nuevoElemento.m_value = elemento.Valor; nuevoElemento.m_name = elemento.Nombre; nuevoElemento.m_readonly = elemento.SoloLectura; if (elemento.TipoElementoFormulario == "input") { nuevoElemento.m_eType = ProxyPagoServicios.elementType.input; nuevoElemento.m_input = new ProxyPagoServicios.inputElement(); if (elemento.DefinicionElementoInput.TipoInput == "dinero") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.dinero; } else if (elemento.DefinicionElementoInput.TipoInput == "fecha") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.fecha; } else if (elemento.DefinicionElementoInput.TipoInput == "numero") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.numero; } else if (elemento.DefinicionElementoInput.TipoInput == "password") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.password; } else if (elemento.DefinicionElementoInput.TipoInput == "submit") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.submit; } else if (elemento.DefinicionElementoInput.TipoInput == "texto") { nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.texto; } nuevoElemento.m_input.m_iMaxValue = elemento.DefinicionElementoInput.ValorMaximo; nuevoElemento.m_input.m_iMinValue = elemento.DefinicionElementoInput.ValorMinimo; } else if (elemento.TipoElementoFormulario == "select") { nuevoElemento.m_eType = ProxyPagoServicios.elementType.select; nuevoElemento.m_select = new ProxyPagoServicios.selectElement(); nuevoElemento.m_select.m_options = new ProxyPagoServicios.ArrayOfOption(); foreach (OpcionSelect opcionSelect in elemento.DefinicionElementoSelect.Opciones) { ProxyPagoServicios.option opcion = new ProxyPagoServicios.option(); opcion.m_amount = opcionSelect.Cantidad; opcion.m_text = opcionSelect.Texto; opcion.m_value = opcionSelect.Valor; nuevoElemento.m_select.m_options.Add(opcion); } } lista.Add(nuevoElemento); } formulario.m_form = lista; formulario.m_moduleId = moduleId; return(formulario); }