public async Task <IActionResult> Edit(string id, Parentesco Parentesco) { Response response = new Response(); try { if (!string.IsNullOrEmpty(id)) { response = await apiServicio.EditarAsync(id, Parentesco, new Uri(WebApp.BaseAddress), "api/Parentescos"); if (response.IsSuccess) { return(this.RedireccionarMensajeTime( "Parentescos", "Index", $"{Mensaje.Success}|{response.Message}|{"7000"}" )); } this.TempData["MensajeTimer"] = $"{Mensaje.Error}|{response.Message}|{"10000"}"; return(View(Parentesco)); } return(BadRequest()); } catch (Exception ex) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppTh), Message = "Editando un Parentesco", ExceptionTrace = ex.Message, LogCategoryParametre = Convert.ToString(LogCategoryParameter.Edit), LogLevelShortName = Convert.ToString(LogLevelParameter.ERR), UserName = "******" }); return(BadRequest()); } }
private void cargar_exepciones() { EventosExepciones evntexp = new EventosExepciones(); Func_Utiles func_util = new Func_Utiles(); Parentesco prnt = new Parentesco(); foreach (var item in evntexp.GetListadoExepciones(_cuil)) { dgv_titu_benef.Rows.Add(); int fila = dgv_titu_benef.Rows.Count - 1; dgv_titu_benef.Rows[fila].Cells["nombre"].Value = item.EventExepApellido + " " + item.EventExepNombre; dgv_titu_benef.Rows[fila].Cells["Parentesco"].Value = prnt.GetParentescoDescrip(item.EventExepParent).parent_descrip; dgv_titu_benef.Rows[fila].Cells["CodigoFliar"].Value = 0; dgv_titu_benef.Rows[fila].Cells["dni"].Value = item.EventExepDni; dgv_titu_benef.Rows[fila].Cells["sexo"].Value = item.EventExpSexo; dgv_titu_benef.Rows[fila].Cells["Edad"].Value = func_util.calcular_edad(item.EventFechaNac); dgv_titu_benef.Rows[fila].Cells["Exepcion"].Value = 1; dgv_titu_benef.Rows[fila].Cells["ExepcionID"].Value = item.EventExepId; dgv_titu_benef.Rows[fila].Cells["Emitir"].Value = Properties.Resources.impresora_PNG_24; //D:\Proyectos\entrega_cupones\entrega_cupones\Resources\impresora (1).png; } }
private Response Existe(Parentesco Parentesco) { var bdd = Parentesco.Nombre; var Parentescorespuesta = db.Parentesco.Where(p => p.Nombre == bdd).FirstOrDefault(); if (Parentescorespuesta != null) { return(new Response { IsSuccess = true, Message = Mensaje.ExisteRegistro, Resultado = null, }); } return(new Response { IsSuccess = false, Resultado = Parentescorespuesta, }); }
/// <summary> /// Método que carrega uma entidade. /// </summary> /// <param name="entidade">Entidade a ser carregada (somente o identificador é necessário).</param> /// <returns></returns> public Parentesco Carregar(Parentesco entidade) { Parentesco entidadeRetorno = null; string SQL = @"SELECT * FROM Parentesco WHERE ID=@ID " ; DbCommand command = _db.GetSqlStringCommand(SQL); _db.AddInParameter(command, "ID", DbType.Int32, entidade.ID); IDataReader entidades = _db.ExecuteReader(command); if (entidades.Read()) { entidadeRetorno = new Parentesco(); Popula(entidades, entidadeRetorno); } entidades.Close(); return(entidadeRetorno); }
//Botão Salvar -> métodos de cadastro private void btnSalvar_Click(object sender, EventArgs e) { try { RecemNascido rn = new RecemNascido(); if (VerificaCamposPreenchidos()) { if (rn.validaDnvDo(txtNumeroDNVDO.Text, Convert.ToString(cboLivroRegistro.SelectedItem))) { conexao = new Conexao(); //Cadastro do Recem Nascido rn = getDadosRN(); conexao.cadastrarRN(rn); livro = getDadosLivro(); conexao.cadastrarLivroRegistro(livro); //Cadastro de parentesco do RN parente = getDadosParente("Mae"); //Cadastra MAE conexao.cadastrarParente(parente); parente = getDadosParente("Pai"); //Cadastra PAI conexao.cadastrarParente(parente); MessageBox.Show("Cadastrado com Sucesso!"); ClearForm(this); //Limpa form após cadastrar com sucesso } else { MessageBox.Show("Insira um Dnv / DO Valido!"); } } else { MessageBox.Show("Preencha os campos obrigatórios!"); } } catch (Exception ex) { MessageBox.Show("Erro! " + ex); } }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IParentescoApiConsumer.SetAuthHeader(_tokenManager.Token); Parentesco varParentesco = null; if (id.ToString() != "0") { string where = ""; } var result = _IParentescoApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Método que retorna todas as entidades. /// SELECT * FROM Parentesco ORDER BY ID DESC /// </summary> public IList <Parentesco> Listar(Int32 paginaAtual, Int32 totalRegPorPagina) { Parentesco entidadeRetorno = null; string SQL = @"WITH Members AS (SELECT Parentesco.ID ,Parentesco.Nome , ROW_NUMBER() OVER ( ORDER BY ID DESC) AS RowNumber FROM Parentesco WHERE 1=1 "; SQL += @" ) SELECT RowNumber, ID ,Nome FROM Members WHERE RowNumber <= (1+(@paginaAtual-1)) * @totalRegPagina AND RowNumber >= 1+((@paginaAtual-1)* @totalRegPagina) ORDER BY RowNumber ASC; "; DbCommand command = _db.GetSqlStringCommand(SQL); _db.AddInParameter(command, "paginaAtual", DbType.Int32, paginaAtual); _db.AddInParameter(command, "totalRegPagina", DbType.Int32, totalRegPorPagina); IDataReader entidades = _db.ExecuteReader(command); IList <Parentesco> list = new List <Parentesco>(); while (entidades.Read()) { entidadeRetorno = new Parentesco(); Popula(entidades, entidadeRetorno); list.Add(entidadeRetorno); } entidades.Close(); return(list); }
private void Guardar() { Utility oUtil = new Utility(); //instancio el usuario Usuario us = new Usuario(); us = (Usuario)us.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); int id = Convert.ToInt32(Request.QueryString["id"]); //datos del Paciente Paciente pac = new Paciente(); if (id != 0) { pac = (Paciente)pac.Get(typeof(Paciente), id); } pac.IdEfector = us.IdEfector; pac.Apellido = oUtil.SacaComillas(txtApellido.Text.ToUpper()); pac.Nombre = oUtil.SacaComillas(txtNombre.Text.ToUpper()); pac.IdEstado = Convert.ToInt32(ddlEstadoP.SelectedValue); if (ddlEstadoP.SelectedValue == "2") { if (id == 0) // solo si es nuevo genera un numero { pac.NumeroDocumento = generarNumero(); } } else { if (txtNumeroDocumento.Text != "") { pac.NumeroDocumento = int.Parse(txtNumeroDocumento.Text); } } //if (!string.IsNullOrEmpty(txtHC.Text)) //pac.HistoriaClinica = Convert.ToInt32(txtHC.Text); //else //pac.HistoriaClinica = 0; pac.FechaAlta = Convert.ToDateTime(txtFalta.Value); pac.IdSexo = Convert.ToInt32(ddlSexo.SelectedValue); //valido que la fecha no se mayor a la actual if ((Convert.ToDateTime(txtFechaNac.Value) <= DateTime.Now) && (txtFechaNac.Value != null)) { pac.FechaNacimiento = Convert.ToDateTime(txtFechaNac.Value); } pac.IdPais = Convert.ToInt32(ddlNacionalidad.SelectedValue); if (ddlProvincia.SelectedValue != "") { pac.IdProvincia = Convert.ToInt32(ddlProvincia.SelectedValue); } //pac.IdNivelInstrucccion = Convert.ToInt32(ddlNivelInstruccion.SelectedValue); //pac.IdSituacionLaboral = Convert.ToInt32(ddlSituacionLaboral.SelectedValue); //pac.IdProfesion = Convert.ToInt32(ddlProfesion.SelectedValue); //pac.IdOcupacion = Convert.ToInt32(ddlOcupacion.SelectedValue); pac.Calle = txtCalle.Text.ToUpper(); if (!string.IsNullOrEmpty(txtNumero.Text)) { pac.Numero = Convert.ToInt32(txtNumero.Text); } else { pac.Numero = 0; } pac.Piso = txtPiso.Text; pac.Departamento = txtDepartamento.Text; pac.Manzana = txtManzana.Text.ToString(); //if () if (ddlProvinciaDomicilio.SelectedValue != "") { pac.IdProvinciaDomicilio = Convert.ToInt32(ddlProvinciaDomicilio.SelectedValue); } if (ddlDepartamento.SelectedValue != "") { pac.IdDepartamento = Convert.ToInt32(ddlDepartamento.SelectedValue); } if (ddlLocalidad.SelectedValue != "") { pac.IdLocalidad = Convert.ToInt32(ddlLocalidad.SelectedValue); } if (ddlBarrio.SelectedValue != "") { pac.IdBarrio = Convert.ToInt32(ddlBarrio.SelectedValue); } pac.Referencia = oUtil.SacaComillas(txtReferencia.Text.ToUpper()); pac.InformacionContacto = oUtil.SacaComillas(txtContacto.Text); pac.FechaDefuncion = Convert.ToDateTime("01/01/1900"); pac.IdUsuario = us.IdUsuario; pac.FechaUltimaActualizacion = DateTime.Now; pac.Save(); //Guardo los datos del Parentesco. Traigo con lblbIdParentesco el idParentesco asociado al paciente //par = (Parentesco)par.Get(typeof(Parentesco),"IdPaciente", pac.IdPaciente); if ((txtApellidoP.Text != "") & (txtNombreP.Text != "")) { Parentesco par = new Parentesco(); if (lblIdParentesco.Text != "") { par = (Parentesco)par.Get(typeof(Parentesco), "IdParentesco", int.Parse(lblIdParentesco.Text)); } par.Apellido = oUtil.SacaComillas(txtApellidoP.Text.ToUpper()); par.Nombre = oUtil.SacaComillas(txtNombreP.Text.ToUpper()); par.IdTipoDocumento = 1; // Convert.ToInt32(ddlTipoDocP.SelectedValue); par.IdPaciente = pac; if (ddlParentesco.SelectedValue != "") { par.TipoParentesco = ddlParentesco.SelectedValue; } if (!string.IsNullOrEmpty(txtNumeroP.Text)) { par.NumeroDocumento = Convert.ToInt32(txtNumeroP.Text); } //par.NumeroDocumento = Convert.ToInt32(txtNumeroP.Text); if (txtFechaN.Value != "") { par.FechaNacimiento = Convert.ToDateTime(txtFechaN.Value); } else { par.FechaNacimiento = Convert.ToDateTime("01/01/1900"); } if (ddlProvinciaP.SelectedValue != "0") { par.IdProvincia = Convert.ToInt32(ddlProvinciaP.SelectedValue); } //par.IdProvincia = Convert.ToInt32(ddlProvinciaP.SelectedValue); if (ddlNacionalidadP.SelectedValue != "0") { par.IdPais = Convert.ToInt32(ddlNacionalidadP.SelectedValue); } //if (ddlNIvelInstruccionP.SelectedValue != "0") // par.IdNivelInstruccion = Convert.ToInt32(ddlNIvelInstruccionP.SelectedValue); //if (ddlSituacionLaboralP.SelectedValue != "0") // par.IdSituacionLaboral = Convert.ToInt32(ddlSituacionLaboralP.SelectedValue); //if (ddlProfesionP.SelectedValue != "0") // par.IdProfesion = Convert.ToInt32(ddlProfesionP.SelectedValue); par.IdUsuario = us; //guardo la fecha actual de modificacion par.FechaModificacion = DateTime.Now; par.Save(); } if (Request["llamada"] != null) { if (Request["llamada"] == "LaboTurno") { Response.Redirect("../Turnos/TurnoEdit2.aspx?idPaciente=" + pac.IdPaciente.ToString() + "&Modifica=0"); } if (Request["llamada"] == "LaboProtocolo") { if (Request["idProtocolo"] == null) { //if (Request["llamada"].ToString()=="LaboScreening") // Response.Redirect("../Neonatal/IngresoEdit.aspx?idPaciente=" + pac.IdPaciente.ToString() , false); //else Response.Redirect("../Protocolos/ProtocoloEdit2.aspx?idPaciente=" + pac.IdPaciente.ToString() + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Request["idUrgencia"].ToString() + "&Operacion=Alta"); } else { Response.Redirect("../Protocolos/ProtocoloEdit2.aspx?idPaciente=" + pac.IdPaciente.ToString() + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Request["idUrgencia"].ToString() + "&Operacion=Modifica&idProtocolo=" + Request["idProtocolo"].ToString() + "&Desde=" + Request["Desde"].ToString()); } } } //try { // if (Request.QueryString["llamada"] == "Labo") { // // tbParamA.Value = par.IdPaciente.ToString(); // // Response.Write("<script>window.close();</scrip>"); // } // else // Response.Redirect("PacienteList.aspx"); // //lblMensaje.Text = "Los datos fueron guardados correctamente"; //} catch (Exception ex) { // // Poner la logica de error // lblMensaje.Text = "Los datos no fueron guardados correctamente"; // throw; //} }
public void EditarParentescos(Parentesco parentesco) { Context.Entry(parentesco).State = EntityState.Modified; Context.SaveChanges(); }
public void AddParentesco(Parentesco parentesco) { Context.parentesco.Add(parentesco); Context.SaveChanges(); }
public IActionResult Put([FromBody] Parentesco parentesco) { this.repository.Update(parentesco); return(Ok(parentesco)); }
private int Decodificar(string texto) { //@PAC|114335^ABADIA RIVERO^PEDRO JULIAN^50242914^3^28/02/2010^1^-^1 //@PAR|20121445^RIVERO^JUANA^12/12/1980 //@SOL|114335^39^RIVERO^ABADIA RIVERO^12:30^35^3521,00^False^True^10/03/2012^12:00^True^0^False^False^False^False^False^^^13 //@ALA|La extracción se realizó antes de las 36 horas de vida.^El RN tuvo ingesta de leche en las primeras 24 horas@PAC|114335^ABADIA RIVERO^PEDRO JULIAN^50242914^3^28/02/2010^1^-^1@PAR|20121445^RIVERO^JUANA^12/12/1980@SOL|114335^59^RIVERO^ABADIA RIVERO^12:00^30^2513,00^False^False^01/03/2012^12:00^False^1^False^False^False^False^False^cualquier antecedente de prueba.cualquier antecedente de prueba.cualquier antecedente de prueba.cualquier antecedente de prueba.cualquier antecedente de prueba.cualquier antecedente de prueba.^^14@ALA|La extracción se realizó antes de las 36 horas de vida.^Deberá repetirse la muestra a los 15 días: La edad gestacional es menor a 35 semanas. Usuario oUser = new Usuario(); oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString()));; string[] arr = texto.Split(("@").ToCharArray()); int idPaciente = 0; int idSolicitud = 0; int cantidadPacientes = 0; if (arr.Length > 0) { for (int j = 0; j < arr.Length; j++) { string s_tipoSegmento = arr[j].ToString(); string[] arrSegmento = s_tipoSegmento.Split(("|").ToCharArray()); for (int i = 0; i < arrSegmento.Length; i++) { switch (arrSegmento[i].Trim()) { case "PAC": idPaciente = 0; Efector oEfector = new Efector(); cantidadPacientes += 1; string s_DatosPaciente = arrSegmento[1].ToString(); string[] arrDatosPaciente = s_DatosPaciente.Split(("^").ToCharArray()); Paciente oPaciente = new Paciente(); oPaciente.Apellido = arrDatosPaciente[1].ToString(); oPaciente.Nombre = arrDatosPaciente[2].ToString(); int numeroDocumento = int.Parse(arrDatosPaciente[3].ToString()); int idestado = int.Parse(arrDatosPaciente[6].ToString()); idPaciente = existe(numeroDocumento, idestado); if (idPaciente == 0) { oPaciente.NumeroDocumento = numeroDocumento; oPaciente.IdSexo = int.Parse(arrDatosPaciente[4].ToString()); oPaciente.FechaNacimiento = DateTime.Parse(arrDatosPaciente[5].ToString()); oPaciente.IdEstado = int.Parse(arrDatosPaciente[6].ToString()); oPaciente.InformacionContacto = arrDatosPaciente[7].ToString(); oPaciente.IdEfector = (Efector)oEfector.Get(typeof(Efector), int.Parse(arrDatosPaciente[8].ToString())); oPaciente.FechaAlta = DateTime.Now; oPaciente.FechaDefuncion = Convert.ToDateTime("01/01/1900"); oPaciente.FechaUltimaActualizacion = DateTime.Now; oPaciente.HistoriaClinica = 0; oPaciente.IdPais = 0; oPaciente.IdProvincia = 0; oPaciente.IdNivelInstruccion = 0; oPaciente.IdSituacionLaboral = 0; oPaciente.IdProfesion = 0; oPaciente.IdOcupacion = 0; oPaciente.IdLocalidad = 0; oPaciente.IdBarrio = 0; oPaciente.IdDepartamento = 0; oPaciente.IdProvinciaDomicilio = 0; oPaciente.IdObraSocial = 0; oPaciente.IdUsuario = 2; oPaciente.IdEstadoCivil = 0; oPaciente.Save(); idPaciente = oPaciente.IdPaciente; } break; case "PAR": if (idPaciente != 0) { string s_DatosParentesco = arrSegmento[1].ToString(); string[] arrDatosParentesco = s_DatosParentesco.Split(("^").ToCharArray()); if (arrDatosParentesco.Length > 2) { Paciente oPac = new Paciente(); oPac = (Paciente)oPac.Get(typeof(Paciente), idPaciente); Parentesco par = new Parentesco(); par.IdPaciente = oPac; par.NumeroDocumento = Convert.ToInt32(arrDatosParentesco[0].ToString()); par.Apellido = arrDatosParentesco[1].ToString(); par.Nombre = arrDatosParentesco[2].ToString().ToUpper(); par.IdTipoDocumento = 1; par.FechaNacimiento = Convert.ToDateTime(arrDatosParentesco[3].ToString()); par.IdPais = Convert.ToInt32(1); par.IdProvincia = 0; par.IdNivelInstruccion = 0; par.IdSituacionLaboral = 0; par.IdProfesion = 0; par.IdUsuario = oUser; par.FechaModificacion = DateTime.Now; par.Save(); } } break; case "SOL": if (idPaciente != 0) { idSolicitud = 0; string s_DatosSolicitud = arrSegmento[1].ToString(); string[] arrDatosSolicitud = s_DatosSolicitud.Split(("^").ToCharArray()); int numeroOrigen = int.Parse(arrDatosSolicitud[20].ToString()); if (!existe(numeroOrigen)) { SolicitudScreening oSolicitud = new SolicitudScreening(); Efector oEfectorSolicitante = new Efector(); Paciente oPac = new Paciente(); oPac = (Paciente)oPac.Get(typeof(Paciente), idPaciente); oSolicitud.IdPaciente = oPac; oSolicitud.IdEfector = oUser.IdEfector; oSolicitud.IdEfectorSolicitante = (Efector)oEfectorSolicitante.Get(typeof(Efector), int.Parse(arrDatosSolicitud[1].ToString())); oSolicitud.ApellidoMaterno = arrDatosSolicitud[2].ToString(); oSolicitud.ApellidoPaterno = arrDatosSolicitud[3].ToString(); oSolicitud.HoraNacimiento = arrDatosSolicitud[4].ToString(); oSolicitud.EdadGestacional = int.Parse(arrDatosSolicitud[5].ToString()); oSolicitud.Peso = decimal.Parse(arrDatosSolicitud[6].ToString()); if (arrDatosSolicitud[7].ToString() == "False") { oSolicitud.Prematuro = false; } else { oSolicitud.Prematuro = true; } if (arrDatosSolicitud[8].ToString() == "False") { oSolicitud.PrimeraMuestra = false; } else { oSolicitud.PrimeraMuestra = true; } oSolicitud.FechaExtraccion = DateTime.Parse(arrDatosSolicitud[9].ToString()); oSolicitud.HoraExtraccion = arrDatosSolicitud[10].ToString(); if (arrDatosSolicitud[11].ToString() == "False") { oSolicitud.IngestaLeche24Horas = false; } else { oSolicitud.IngestaLeche24Horas = true; } oSolicitud.TipoAlimentacion = int.Parse(arrDatosSolicitud[12].ToString()); if (arrDatosSolicitud[13].ToString() == "False") { oSolicitud.Antibiotico = false; } else { oSolicitud.Antibiotico = true; } if (arrDatosSolicitud[14].ToString() == "False") { oSolicitud.Transfusion = false; } else { oSolicitud.Transfusion = true; } if (arrDatosSolicitud[15].ToString() == "False") { oSolicitud.Corticoides = false; } else { oSolicitud.Corticoides = true; } if (arrDatosSolicitud[16].ToString() == "False") { oSolicitud.Dopamina = false; } else { oSolicitud.Dopamina = true; } if (arrDatosSolicitud[17].ToString() == "False") { oSolicitud.EnfermedadTiroideaMaterna = false; } else { oSolicitud.EnfermedadTiroideaMaterna = true; } oSolicitud.AntecedentesMaternos = arrDatosSolicitud[18].ToString(); oSolicitud.Observaciones = arrDatosSolicitud[19].ToString(); oSolicitud.NumeroOrigen = int.Parse(arrDatosSolicitud[20].ToString()); oSolicitud.FechaRegistro = DateTime.Parse(DateTime.Now.ToShortDateString()); oSolicitud.IdUsuarioRegistro = oUser; oSolicitud.Save(); idSolicitud = oSolicitud.IdSolicitudScreening; } } break; case "ALA": if (idSolicitud != 0) { string s_DatosAlarmas = arrSegmento[1].ToString(); string[] arrDatosAlarmas = s_DatosAlarmas.Split(("^").ToCharArray()); for (int k = 0; k < arrDatosAlarmas.Length; k++) { string s_descripcionAlarma = arrDatosAlarmas[k].ToString(); if (s_descripcionAlarma.Trim() != "") { SolicitudScreening oSolicitud = new SolicitudScreening(); oSolicitud = (SolicitudScreening)oSolicitud.Get(typeof(SolicitudScreening), idSolicitud); AlarmaScreening oRegistro = new AlarmaScreening(); oRegistro.IdSolicitudScreening = oSolicitud; oRegistro.IdEfector = oSolicitud.IdEfector; oRegistro.Descripcion = s_descripcionAlarma; oRegistro.IdUsuarioRegistro = int.Parse(Session["idUsuario"].ToString()); oRegistro.FechaRegistro = DateTime.Now; oRegistro.Save(); } } } break; } } } } return(cantidadPacientes); }
public void Update(Parentesco obj) { context.Entry(obj).State = EntityState.Modified; context.SaveChanges(); }
public void EditarParentescos(Parentesco parentesco) { _parentescoRepository.EditarParentescos(parentesco); }
private void Parentesco_Click(object sender, RoutedEventArgs e) { Parentesco parentesco = new Parentesco(); parentesco.Show(); }
private bool existsParentesco(Parentesco parentesco) { return(_repositoryReadParentesco.exists(parentesco.Id)); }
public async Task <Response> PutParentesco([FromRoute] int id, [FromBody] Parentesco Parentesco) { try { if (!ModelState.IsValid) { return(new Response { IsSuccess = false, Message = Mensaje.ModeloInvalido }); } var existe = Existe(Parentesco); if (existe.IsSuccess) { return(new Response { IsSuccess = false, Message = Mensaje.ExisteRegistro, }); } var ParentescoActualizar = await db.Parentesco.Where(x => x.IdParentesco == id).FirstOrDefaultAsync(); if (ParentescoActualizar != null) { try { ParentescoActualizar.Nombre = Parentesco.Nombre.ToString().ToUpper(); await db.SaveChangesAsync(); return(new Response { IsSuccess = true, Message = Mensaje.GuardadoSatisfactorio, }); } catch (Exception ex) { return(new Response { IsSuccess = false, Message = Mensaje.Error, }); } } return(new Response { IsSuccess = false, Message = Mensaje.ExisteRegistro }); } catch (Exception) { return(new Response { IsSuccess = false, Message = Mensaje.Excepcion }); } }
public override async void Init(object initData) { base.Init(initData); Familiar = new Familiar(); SelectedParentesco = new Parentesco(); oHorario = new PageModelHelper { ActivityRunning = true, Visualizar = false, VisualizarTermino = false, NovoFamiliar = false, NovoCadastro = false, FamiliarExibicao = true }; var x = initData as Tuple <Familiar, App>; if (x != null) { Familiar = x.Item1; if (x.Item2 != null) { app = x.Item2; } } TipoContato = new TipoContato(); oHorario.NovoFamiliar = Familiar?.Id == null; if (oHorario.NovoFamiliar) { oHorario.BoasVindas = "Tirar foto"; NovoFamiliar = true; ConTelefone = new ConTelefone { Id = Guid.NewGuid().ToString() }; ConCelular = new ConCelular { Id = Guid.NewGuid().ToString() }; ConEmail = new ConEmail { Id = Guid.NewGuid().ToString() }; ContatoEmergencia = new ContatoEmergencia { Id = Guid.NewGuid().ToString() }; } else { NovoFamiliar = false; oHorario.BoasVindas = "Alterar foto"; } oHorario.NovoCadastro = Familiar?.Id == null; oHorario.FamiliarExibicao = Familiar?.Id != null; await GetData(); if (Familiar?.FamFoto != null) { FamiliarFoto = ImageSource.FromStream(() => new MemoryStream(Familiar.FamFoto)); } var n = new HttpClient(); var b = await n.GetStringAsync("http://www.geonames.org/childrenJSON?geonameId=3469034"); var o = JsonConvert.DeserializeObject <RootObject>(b); ListaEstados = new ObservableCollection <Geoname>(o.geonames); oHorario.ActivityRunning = false; oHorario.Visualizar = true; }
public Parentesco Update(Parentesco parentesco) { throw new NotImplementedException(); }
public async Task <Response> PutParentesco([FromRoute] int id, [FromBody] Parentesco Parentesco) { try { if (!ModelState.IsValid) { return(new Response { IsSuccess = false, Message = Mensaje.ModeloInvalido }); } var existe = Existe(Parentesco); if (existe.IsSuccess) { return(new Response { IsSuccess = false, Message = Mensaje.ExisteRegistro, }); } var ParentescoActualizar = await db.Parentesco.Where(x => x.IdParentesco == id).FirstOrDefaultAsync(); if (ParentescoActualizar != null) { try { ParentescoActualizar.Nombre = Parentesco.Nombre; await db.SaveChangesAsync(); return(new Response { IsSuccess = true, Message = Mensaje.Satisfactorio, }); } catch (Exception ex) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.SwTH), ExceptionTrace = ex, Message = Mensaje.Excepcion, LogCategoryParametre = Convert.ToString(LogCategoryParameter.Critical), LogLevelShortName = Convert.ToString(LogLevelParameter.ERR), UserName = "", }); return(new Response { IsSuccess = false, Message = Mensaje.Error, }); } } return(new Response { IsSuccess = false, Message = Mensaje.ExisteRegistro }); } catch (Exception) { return(new Response { IsSuccess = false, Message = Mensaje.Excepcion }); } }
public async Task <Response> ListarFichaMedicaViewModel([FromBody] FichaMedicaViewModel fmv) { try { Persona personaVar = new Persona(); if (fmv.DatosBasicosPersonaViewModel.IdPersona < 1) { try { personaVar = db.Persona.Where(x => x.Identificacion == fmv.DatosBasicosPersonaViewModel.Identificacion).FirstOrDefault(); } catch (Exception ex) { return(new Response { IsSuccess = false, Message = Mensaje.RegistroNoEncontrado }); } } else { try { personaVar = db.Persona.Where(x => x.IdPersona == fmv.DatosBasicosPersonaViewModel.IdPersona).FirstOrDefault(); } catch (Exception ex) { return(new Response { IsSuccess = false, Message = Mensaje.RegistroNoEncontrado }); } } if (personaVar == null) { return(new Response { IsSuccess = false, Message = Mensaje.RegistroNoEncontrado }); } PersonaEstudio personaEstudioVar = db.PersonaEstudio.Where(x => x.IdPersona == personaVar.IdPersona).FirstOrDefault(); Sexo sexoVar = db.Sexo.Where(x => x.IdSexo == personaVar.IdSexo).FirstOrDefault(); Nacionalidad NacionalidadVar = db.Nacionalidad.Where(x => x.IdNacionalidad == personaVar.IdNacionalidad).FirstOrDefault(); Parroquia parroquiaVar = db.Parroquia.Where(x => x.IdParroquia == personaVar.IdParroquia).FirstOrDefault(); EstadoCivil estadoCivilVar = db.EstadoCivil.Where(x => x.IdEstadoCivil == personaVar.IdEstadoCivil).FirstOrDefault(); Etnia etniaVar = db.Etnia.Where(x => x.IdEtnia == personaVar.IdEtnia).FirstOrDefault(); TipoSangre tipoSangreVar = db.TipoSangre.Where(x => x.IdTipoSangre == personaVar.IdTipoSangre).FirstOrDefault(); PersonaDiscapacidad personaDiscapacidadVar = db.PersonaDiscapacidad.Where(x => x.IdPersona == personaVar.IdPersona).FirstOrDefault(); Empleado empleadoVar = db.Empleado.Where(x => x.IdPersona == personaVar.IdPersona).FirstOrDefault(); /* INICIALIZACIÓN DE OBJETOS CON VALORES NULOS */ Titulo tituloVar = new Titulo(); Estudio estudioVar = new Estudio(); EmpleadoContactoEmergencia contactoEmergenciaVar = new EmpleadoContactoEmergencia(); Dependencia dependenciaVar = new Dependencia(); EmpleadoFamiliar empleadoFamiliarVar = new EmpleadoFamiliar(); Persona personaEmergenciaVar = new Persona(); Sucursal sucursalVar = new Sucursal(); Parentesco parentescoVar = new Parentesco(); TipoDiscapacidad discapacidadVar = new TipoDiscapacidad(); IndiceOcupacionalModalidadPartida indOcupModParVar = new IndiceOcupacionalModalidadPartida(); IndiceOcupacional inOcupVar = new IndiceOcupacional(); ManualPuesto manPuestoVar = new ManualPuesto(); /* INICIALIZACIÓN DE VARIABLES NULAS*/ var datoConadis = ""; var datoPorcentaje = ""; var datoCargoTrabajo = ""; var datoPuestoTrabajo = ""; var datoEdad = ""; bool datoCondicionEspecial = false; int datoNumHijos = 0; var datoSedeTrabajo = ""; var datoPersonaEmergencia = ""; var datoPersonaEmergenciaContacto = ""; var nombreCampoHijos = "Hijo/a"; if (personaEstudioVar != null && personaEstudioVar.IdPersonaEstudio > 0) { tituloVar = db.Titulo.Where(x => x.IdTitulo == personaEstudioVar.IdTitulo).FirstOrDefault(); } if (tituloVar != null && tituloVar.IdEstudio > 0) { estudioVar = db.Estudio.Where(x => x.IdEstudio == tituloVar.IdEstudio).FirstOrDefault(); } if (empleadoVar != null && empleadoVar.IdEmpleado > 0) { contactoEmergenciaVar = db.EmpleadoContactoEmergencia.Where(x => x.IdEmpleado == empleadoVar.IdEmpleado).FirstOrDefault(); dependenciaVar = db.Dependencia.Where(x => x.IdDependencia == empleadoVar.IdDependencia).FirstOrDefault(); empleadoFamiliarVar = db.EmpleadoFamiliar.Where(x => x.IdEmpleado == empleadoVar.IdEmpleado).FirstOrDefault(); indOcupModParVar = db.IndiceOcupacionalModalidadPartida.Where(x => x.IdEmpleado == empleadoVar.IdEmpleado).FirstOrDefault(); var listaHijos = db.EmpleadoFamiliar.Where(x => x.IdEmpleado == empleadoVar.IdEmpleado).ToList(); datoNumHijos = listaHijos.Count(); } if (indOcupModParVar != null && indOcupModParVar.IdEmpleado > 0) { inOcupVar = db.IndiceOcupacional.Where(x => x.IdIndiceOcupacional == indOcupModParVar.IdIndiceOcupacional).FirstOrDefault(); } if (inOcupVar != null && inOcupVar.IdIndiceOcupacional > 0) { manPuestoVar = db.ManualPuesto.Where(x => x.IdManualPuesto == inOcupVar.IdManualPuesto).FirstOrDefault(); } if (contactoEmergenciaVar != null && contactoEmergenciaVar.IdEmpleadoContactoEmergencia > 0) { personaEmergenciaVar = db.Persona.Where(x => x.IdPersona == contactoEmergenciaVar.IdPersona).FirstOrDefault(); } if (dependenciaVar != null && dependenciaVar.IdDependencia > 0) { sucursalVar = db.Sucursal.Where(x => x.IdSucursal == dependenciaVar.IdSucursal).FirstOrDefault(); } if (empleadoFamiliarVar != null && empleadoFamiliarVar.IdEmpleadoFamiliar > 0 && contactoEmergenciaVar != null && contactoEmergenciaVar.IdEmpleadoContactoEmergencia > 0) { parentescoVar = db.Parentesco.Where(x => x.IdParentesco == contactoEmergenciaVar.IdParentesco).FirstOrDefault(); } if (personaDiscapacidadVar != null && personaDiscapacidadVar.IdPersonaDiscapacidad > 0) { discapacidadVar = db.TipoDiscapacidad.Where(x => x.IdTipoDiscapacidad == personaDiscapacidadVar.IdTipoDiscapacidad).FirstOrDefault(); datoCondicionEspecial = true; } /* Validación obtencion de dato nulo */ if (discapacidadVar != null && discapacidadVar.IdTipoDiscapacidad > 0) { datoConadis = personaDiscapacidadVar.NumeroCarnet; datoPorcentaje = personaDiscapacidadVar.Porciento + " %"; } if (sucursalVar != null && sucursalVar.IdSucursal > 0) { datoSedeTrabajo = sucursalVar.Nombre; } if (personaEmergenciaVar != null && personaEmergenciaVar.IdPersona > 0) { datoPersonaEmergencia = personaEmergenciaVar.Nombres + " " + personaEmergenciaVar.Apellidos; datoPersonaEmergenciaContacto = personaEmergenciaVar.TelefonoCasa + " " + personaEmergenciaVar.TelefonoPrivado; } if (manPuestoVar != null && manPuestoVar.IdManualPuesto > 0) { datoPuestoTrabajo = manPuestoVar.Descripcion; datoCargoTrabajo = manPuestoVar.Nombre; } DateTime year = (DateTime)personaVar.FechaNacimiento; int yActual = DateTime.Now.Year; int yNacimiento = (int)(year.Year); datoEdad = (yActual - yNacimiento) + ""; DatosBasicosPersonaViewModel dbvm = new DatosBasicosPersonaViewModel { IdPersona = personaVar.IdPersona, NombresApellidos = personaVar.Nombres + " " + personaVar.Apellidos, Identificacion = personaVar.Identificacion, LugarNacimiento = NacionalidadVar.Nombre + "/ " + parroquiaVar.Nombre, FechaNacimiento = year.ToString("dd/MM/yyyy"), DireccionDomiciliaria = personaVar.CallePrincipal + " " + personaVar.CalleSecundaria + " " + personaVar.Numero, Telefono = personaVar.TelefonoPrivado + " " + personaVar.TelefonoCasa, Edad = datoEdad, Genero = sexoVar.Nombre, NivelEducativo = estudioVar.Nombre, EstadoCivil = estadoCivilVar.Nombre, Profesion = (tituloVar != null)? tituloVar.Nombre:"", NumeroHijos = datoNumHijos, Etnia = etniaVar.Nombre, CondicionEspecial = datoCondicionEspecial, TipoDiscapacidad = discapacidadVar.Nombre, Conadis = datoConadis, Porcentaje = datoPorcentaje, NombreCargoTrabajo = datoCargoTrabajo, DescripcionPuestoTrabajo = datoPuestoTrabajo, SedeTrabajo = datoSedeTrabajo, ContactoEmergencias = datoPersonaEmergencia, Parentesco = parentescoVar.Nombre, ParienteTelefono = datoPersonaEmergenciaContacto, FechaIngreso = empleadoVar.FechaIngreso }; var ListaFichasMedicas = await db.FichaMedica.Where(x => x.IdPersona == personaVar.IdPersona).OrderByDescending(x => x.FechaFichaMedica).ToListAsync(); // devuelve una lista var fichaMedicaViewModel = new FichaMedicaViewModel { DatosBasicosPersonaViewModel = dbvm, FichasMedicas = ListaFichasMedicas, ListaPersonas = ListaPersonasFichaMedicaView() }; return(new Response { IsSuccess = true, Resultado = fichaMedicaViewModel }); } catch (Exception ex) { var fichaMedicaViewModel = new FichaMedicaViewModel(); return(new Response { IsSuccess = false, Resultado = fichaMedicaViewModel, Message = Mensaje.Error }); } }
public void AddParentesco(Parentesco parentesco) { _parentescoRepository.AddParentesco(parentesco); }
public void Create(Parentesco obj) { context.Parentesco.Add(obj); context.SaveChanges(); }
private Dependiente getDependiente(Identidad identidad, Nombre nombre, Parentesco parentesco) { return(new Dependiente(identidad, nombre, parentesco, new DateTime(1984, 8, 2))); }
public Parentesco Create(Parentesco parentesco) { return(parentesco); }