/// <summary> /// funcion para guardar el medio /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btAceptar_Click(object sender, RoutedEventArgs e) { string nombre = txNombre.Text; if (nombre == "") { MessageBox.Show("no a ingresado ningun nombre", "error"); return; } TV_MedioSolicitud tvMedio = new TV_MedioSolicitud(); tvMedio.medio = nombre; MedioSolicitud medio = new MedioSolicitud(); if (forma == 1) { medio.crear(tvMedio); MessageBox.Show("Medio creado"); } else { tvMedio.idSolicitud = IdMedio; medio.modificar(tvMedio); } this.Close(); }
public MedioForm(int idMedio) { this.IdMedio = idMedio; forma = 2; InitializeComponent(); MedioSolicitud medio = new MedioSolicitud(); txNombre.Text = medio.obtener(idMedio).medio; }
private void obtenerMedioSolicitud() { elementos.Clear(); MedioSolicitud medioSolicitud = new MedioSolicitud(); var resultado = medioSolicitud.obtenerTodos(); foreach (var r in resultado) { elementos.Add(new BomberoComboBox { id = r.idSolicitud.ToString(), nombre = r.medio }); } }
public async Task <ActionResult> MedioSolicitud_CreaMdf([FromBody] MedioSolicitud medioSolicitudModel) { var data = await _incidenciaBussines.MedioSolicitud_CreaMdf(medioSolicitudModel); if (data.Exito) { if (medioSolicitudModel.IdMedSol == null) { return(Ok(new { data = "MedioSolicitud Fue registrado correctamente." })); } else { return(Ok(new { data = "MedioSolicitud Fue editado correctamente." })); } } else { return(BadRequest(new { data = data.MsjDB })); } }
public async Task <CommonResult <MedioSolicitud> > MedioSolicitud_CreaMdf(MedioSolicitud medioSolicitudModel) { CommonResult <MedioSolicitud> _commonResult = new CommonResult <MedioSolicitud>(); try { using (IDbConnection conexion = new SqlConnection(_Iconexion.GetConexion())) { var Parameters = new DynamicParameters(); Parameters.Add("@IdMedSol", medioSolicitudModel.IdMedSol, dbType: DbType.Int32, direction: ParameterDirection.Input); Parameters.Add("@Descripcion", medioSolicitudModel.Descripcion, dbType: DbType.String, direction: ParameterDirection.Input, size: 2500); Parameters.Add("@msj", dbType: DbType.String, direction: ParameterDirection.Output, size: 200); var Result = await conexion.ExecuteScalarAsync("SP_MedioSolicitud_CreaMdf", param : Parameters, commandType : CommandType.StoredProcedure); string PCmsj = Parameters.Get <string>("@msj"); if (String.IsNullOrEmpty(PCmsj)) { _commonResult.Exito = true; return(_commonResult); } else { _commonResult.Exito = false; _commonResult.MsjDB = PCmsj; _commonResult.MsjError = ""; return(_commonResult); } } } catch (Exception ex) { _commonResult.Exito = false; _commonResult.MsjDB = ""; _commonResult.MsjError = ex.Message; return(_commonResult); } }
public async Task <CommonResult <MedioSolicitud> > MedioSolicitud_ConsUn(int?IdMedSol) { CommonResult <MedioSolicitud> _commonResult = new CommonResult <MedioSolicitud>(); try { using (IDbConnection conexion = new SqlConnection(_Iconexion.GetConexion())) { var Parameters = new DynamicParameters(); Parameters.Add("@IdMedSol", IdMedSol, dbType: DbType.Int32, direction: ParameterDirection.Input); Parameters.Add("@msj", dbType: DbType.String, direction: ParameterDirection.Output, size: 200); MedioSolicitud Result = await conexion.QueryFirstAsync <MedioSolicitud>("SP_MedioSolicitudConsUn", param : Parameters, commandType : CommandType.StoredProcedure); string PCmsj = Parameters.Get <string>("@msj"); if (String.IsNullOrEmpty(PCmsj)) { _commonResult.Exito = true; _commonResult.Entidad = Result; return(_commonResult); } else { _commonResult.Exito = false; _commonResult.MsjDB = PCmsj; _commonResult.MsjError = ""; return(_commonResult); } } } catch (Exception ex) { _commonResult.Exito = false; _commonResult.MsjDB = ""; _commonResult.MsjError = ex.Message; return(_commonResult); } }
public Task <CommonResult <MedioSolicitud> > MedioSolicitud_CreaMdf(MedioSolicitud medioSolicitudModel) { return(_IncidenciaRepository.MedioSolicitud_CreaMdf(medioSolicitudModel)); }
private void btEliminar_Click(object sender, RoutedEventArgs e) { var r = MessageBox.Show("Desea eliminar este elemento", "Precaución", MessageBoxButton.OKCancel); if (r == MessageBoxResult.Cancel) { return; } try { if (tipo == "animal") { Animal animal = new Animal(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; animal.eliminar(int.Parse(seleccionado.id)); obtenerAnimales(); } else if (tipo == "CausaEnfermedadComun") { Animal animal = new Animal(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; animal.eliminar(int.Parse(seleccionado.id)); obtenerEnfermedadesComunes(); } else if (tipo == "causaIntoxicacion") { CausaIntoxicacion causa = new CausaIntoxicacion(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; causa.eliminar(int.Parse(seleccionado.id)); obtenerCausasDeIntoxicacion(); } else if (tipo == "causaSuicidio") { CausaSuicidio causa = new CausaSuicidio(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; causa.eliminar(int.Parse(seleccionado.id)); obtenerCausasSuicidio(); } else if (tipo == "grado") { Grado grado = new Grado(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; grado.eliminar(int.Parse(seleccionado.id)); obtenerGrado(); } else if (tipo == "medioSolicitud") { MedioSolicitud medio = new MedioSolicitud(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; medio.eliminar(int.Parse(seleccionado.id)); obtenerMedioSolicitud(); } else if (tipo == "rol") { MedioSolicitud medio = new MedioSolicitud(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; medio.eliminar(int.Parse(seleccionado.id)); obtenerRoles(); } else if (tipo == "tipoServicio") { TipoServicio tipoServicio = new TipoServicio(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; tipoServicio.eliminar(int.Parse(seleccionado.id)); obtenerTiposDeServicio(); } else if (tipo == "tipoUnidad") { TipoUnidad tipoUnidad = new TipoUnidad(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; tipoUnidad.eliminar(int.Parse(seleccionado.id)); obtenerTiposUnidad(); } else if (tipo == "tipoVehiculo") { TipoVehiculo tipoUnidad = new TipoVehiculo(); var seleccionado = (BomberoComboBox)dgUnidades.SelectedItem; tipoUnidad.eliminar(int.Parse(seleccionado.id)); obtenerTiposDeVehiculo(); } } catch { MessageBox.Show("No se puede eliminar solo editar"); return; } actualizarGrid(); }