public void PruebaComandoConsultarCargosContactos() { FabricaEntidades laFabrica = new FabricaEntidades(); Comando <bool, List <String> > comando = FabricaComandos.CrearComandoConsultarListaCargos(); Assert.IsNotNull(comando.Ejecutar(true)); }
/// <summary> /// Metodo que llena el comboBox con los cargos dependiendo del tipo de empresa /// </summary> /// <param name="codigo">valor seleccionado en el combo tipo empresa</param> public void ListarCargo(string SelectedValue) { vista.comboCargo.Enabled = true; Dictionary <string, string> options = new Dictionary <string, string>(); options.Add("-1", "Seleccionar Cargo"); try { if (this.vista.comboCargo.SelectedIndex == 1) { Comando <bool, List <String> > comando_juridico = FabricaComandos.CrearComandoConsultarListaCargos(); List <String> listCago = comando_juridico.Ejecutar(true); foreach (String cargo in listCago) { options.Add(cargo, cargo); } } else { Comando <bool, List <String> > comando_usuario = FabricaComandos.CrearComandoLeerCargosUsuarios(); List <String> listCago = comando_usuario.Ejecutar(true); foreach (String cargo in listCago) { options.Add(cargo, cargo); } } } catch (ExceptionTotemConexionBD) { vista.alertaUsuarioClase = RecursosInterfazM3.Alerta_Clase_Error; vista.alertaUsuarioRol = RecursosInterfazM3.Alerta_Rol; vista.AlertaUsuario = RecursosInterfazM3.Alerta_Html + RecursosInterfazM3.Alerta_Conexion_Error + RecursosInterfazM3.Alerta_Html_Final; } catch (ExceptionTotem) { vista.alertaUsuarioClase = RecursosInterfazM3.Alerta_Clase_Error; vista.alertaUsuarioRol = RecursosInterfazM3.Alerta_Rol; vista.AlertaUsuario = RecursosInterfazM3.Alerta_Html + RecursosInterfazM3.Alerta_Totem_Error + RecursosInterfazM3.Alerta_Html_Final; } vista.comboCargo.DataSource = options; vista.comboCargo.DataTextField = "value"; vista.comboCargo.DataValueField = "key"; vista.comboCargo.DataBind(); }
/// <summary> /// Metodo para llenar el combo box de cargos /// </summary> public void llenarComboCargos() { Comando <bool, List <String> > comando = FabricaComandos.CrearComandoConsultarListaCargos(); Dictionary <string, string> options = new Dictionary <string, string>(); options.Add("-1", "Selecciona un cargo"); try { List <String> resultado = comando.Ejecutar(true); foreach (String cargo in resultado) { options.Add(cargo, cargo); } } catch (Exception ex) { throw ex; } vista.comboCargo.DataSource = options; vista.comboCargo.DataTextField = "value"; vista.comboCargo.DataValueField = "key"; vista.comboCargo.DataBind(); vista.comboCargo.Enabled = true; }