private void TraeUsuarios() { try { SISTMEDEntities E = new SISTMEDEntities(); dataGridViewUsuarios.Rows.Clear(); int indice; foreach (var _item in E.TBL_Usuarios) { indice = dataGridViewUsuarios.Rows.Add(); dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.USUARIO_ID].Value = _item.Id_Usuario; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.ID_PERFIL].Value = _item.Id_Perfil; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.USUARIO].Value = _item.IdentificadorUsuario; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.CLAVE].Value = _item.ContraseniaUsuario; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.NOMBRE_USUARIO].Value = _item.NombreUsuario; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.INACTIVO].Value = _item.Inactivo; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.SECTOR_ID].Value = _item.Sector_id; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.EMAIL].Value = _item.Email; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.MATRICULA].Value = _item.matricula; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.FIRMA].Value = _item.firma; dataGridViewUsuarios.Rows[indice].Cells[(int)Col_Usuario.FOTO].Value = _item.foto; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmboxTipoDocumento_SelectedIndexChanged(object sender, EventArgs e) { if (cmboxTipoDocumento.SelectedItem.ToString() == "Un piso específico") { cmboxPiso.Enabled = true; int id_sede = Clases.Paciente.PacienteSede; SISTMEDEntities E = new SISTMEDEntities(); var pisos = from h in E.Habitaciones join p in E.Piso on h.piso_id equals p.piso_id where h.sede_id == id_sede select p.descripcion; foreach (var piso in pisos) { if (!cmboxPiso.Items.Contains(piso)) { cmboxPiso.Items.Add(piso); } } } else { cmboxPiso.Enabled = false; btnImprimir.Enabled = true; } }
private void btnAceptar_Click(object sender, EventArgs e) { try { Seguridad.Encriptacion encripta = new Seguridad.Encriptacion(); SISTMEDEntities E = new SISTMEDEntities(); var clave = (from U in E.TBL_Usuarios where U.Id_Usuario == Clases.Usuario.UsuarioLogeado.id_usuario_Logeado select new { U.ContraseniaUsuario }).Single(); if (txtClaveActual.Text.Trim() != encripta.DESENCRIPTAR(clave.ContraseniaUsuario)) { MetroMessageBox.Show(this, "La clave ingresada como actual es incorrecta"); } else if (txtClaveNueva.Text.Trim() != txtClaveNueva2.Text.Trim()) { MetroMessageBox.Show(this, "Los campos de nueva clave deben ser iguales"); } else { E.Configuration.ValidateOnSaveEnabled = false; TBL_Usuarios U = new TBL_Usuarios { Id_Usuario = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado, ContraseniaUsuario = encripta.ENCRIPTAR(txtClaveNueva.Text) }; E.TBL_Usuarios.Attach(U); E.Entry(U).Property(p => p.ContraseniaUsuario).IsModified = true; E.SaveChanges(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Trae_Medicamento_Solicitado_Sin_Autorizar() { try { CultureInfo culture = new CultureInfo("en-US"); SISTMEDEntities E = new SISTMEDEntities(); this.dataGridViewMedicamentos.Rows.Clear(); int indice; foreach (var item in E.MED_Solicita_Medicamento_Nuevo.Where(med => med.pendiente == true && med.autoriza == false)) { indice = dataGridViewMedicamentos.Rows.Add(); dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.MEDICAMENTO_ID].Value = item.medicamento_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.MEDICAMENTO].Value = item.medicamento; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.BEJERMAN_ID].Value = item.bejerman_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.PRESENTACION_ID].Value = item.presentacion_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.PRESENTACION].Value = item.MED_Presentacion.descripcion; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.UNIDAD_DE_MEDIDA_ID].Value = item.unidadDeMedida_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.POTENCIA].Value = item.Potencia; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.USUARIO_SOLICITA_ID].Value = item.usuarioSolicita_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.USUARIO_SOLICITA].Value = item.TBL_Usuarios.NombreUsuario; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.FECHA_SOLICITA].Value = item.fechaSolicita; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.NO_AUTORIZA].Value = item.autoriza; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.PENDIENTE].Value = item.pendiente; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.AUT_ID].Value = item.usuarioAutoriza_id; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.AUTORIZA].Value = item.TBL_Usuarios.NombreUsuario; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.FECHA_AUTORIZA].Value = item.fechaAutoriza; dataGridViewMedicamentos.Rows[indice].Cells[(int)Col_Medicamentos_Solicitados.PACIENTE].Value = item.paciente_id == null? "" : item.Pacientes.nombre + " " + item.Pacientes.apellido; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void TraerMotivos() { try { //var _list = (from M in _Mod.MotivoEgreso orderby M.Descripcion // select new // { // M.motivoEgreso_id, // M.Descripcion // }); SISTMEDEntities _ModEgreso = new SISTMEDEntities(); var _list = (from M in _ModEgreso.MotivoEgreso orderby M.Descripcion select M).ToList(); dataGridViewMotivos.Rows.Clear(); int indice = 0; foreach (var item in _list) { indice = dataGridViewMotivos.Rows.Add(); dataGridViewMotivos.Rows[indice].Cells[(int)Col_Motivos.COL_ID].Value = item.motivoEgreso_id; //ID dataGridViewMotivos.Rows[indice].Cells[(int)Col_Motivos.COL_DESCRIPCION].Value = item.Descripcion; //DESCRIPCION dataGridViewMotivos.Rows[indice].Cells[(int)Col_Motivos.ID_TIPO].Value = item.tipo_id; // ID TIPO MOTIVO EGRESO dataGridViewMotivos.Rows[indice].Cells[(int)Col_Motivos.TIPO_MOTIVO].Value = item.MED_TipoEgreso.Descripcion; //DESCRIPCION TIPO MOTIVO indice++; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardar() { try { SISTMEDEntities E = new SISTMEDEntities(); TBL_Usuarios _item = new TBL_Usuarios(); Seguridad.Encriptacion encripta = new Seguridad.Encriptacion(); if (Convert.ToInt32(txtId.Text) != -1) //Si es -1 es porque es un ingreso nuevo { _item.Id_Usuario = Convert.ToInt32(txtId.Text); } _item.Id_Perfil = 1; _item.IdentificadorUsuario = txtUsuario.Text; _item.ContraseniaUsuario = encripta.ENCRIPTAR(txtClave.Text.ToString()); _item.NombreUsuario = txtDescripcion.Text; _item.Inactivo = chckInactivo.Checked; _item.Sector_id = Convert.ToInt32(cboPerfiles.SelectedValue); _item.Email = txtEmail.Text; _item.matricula = txtMatricula.Text; E.Entry(_item).State = (AlreadyExists(Convert.ToInt32(txtId.Text)) ? EntityState.Modified : EntityState.Added); E.SaveChanges(); MetroMessageBox.Show(this, "Se guardo correctamente"); TraeUsuarios(); LimpiarCampos(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// COMBOS //--------------------------------------------------------------------------------------------------------------------- COMBOS private void CargarCboAlimento(ComboBox _Combo) { try { SISTMEDEntities E = new SISTMEDEntities(); TRAEENTERALES_Result Ent = new TRAEENTERALES_Result(); Ent.art_DescGen = "Sin alimento enteral"; Ent.art_CodGen = "0"; var _lista = E.TRAEENTERALES().ToList(); _lista.Add(Ent); _lista = _lista.OrderBy(s => s.art_DescGen).ToList(); //Carga el combo _Combo.DataSource = _lista; _Combo.DisplayMember = "art_DescGen"; _Combo.ValueMember = "art_Codgen"; _Combo.ResumeLayout(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void TraeDescartables(int _suministroID) { try { SISTMEDEntities E = new SISTMEDEntities(); var q = from asoc in E.PRO_Asociacion_Procedimiento join art in E.ARTICULO on asoc.articulo_id equals art.art_CodGen where asoc.suministro_procedimiento_id == _suministroID select new { asoc, art }; int indice; foreach (var _itemDescartable in q) { indice = dataGridViewDescartables.Rows.Add(); dataGridViewDescartables.Rows[indice].Cells[(int)Col_Descartables.ID_SUMINISTRO].Value = _itemDescartable.asoc.suministro_procedimiento_id; dataGridViewDescartables.Rows[indice].Cells[(int)Col_Descartables.COD_DESCARTABLE].Value = _itemDescartable.asoc.articulo_id; dataGridViewDescartables.Rows[indice].Cells[(int)Col_Descartables.DESCARTABLE].Value = _itemDescartable.art.art_DescGen + " " + _itemDescartable.art.artele_Desc1 + " " + _itemDescartable.art.artele_Desc2; dataGridViewDescartables.Rows[indice].Cells[(int)Col_Descartables.CANTIDAD].Value = _itemDescartable.asoc.cantidad; dataGridViewDescartables.Rows[indice].Cells[(int)Col_Descartables.TIPO].Value = _itemDescartable.asoc.tipo_articulo; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridViewMedicamentos_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == (int)Col_Medicamentos.X) { DialogResult dialogResult = MetroMessageBox.Show(this, "Desea marcar este medicamento sin Codigo en Bejerman (No se Compra ni Stockea)?", "Sin Codigo Asociado", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { SISTMEDEntities E = new SISTMEDEntities(); E.Configuration.ValidateOnSaveEnabled = false; E.Configuration.ProxyCreationEnabled = false; int _codigoMedicamento = Convert.ToInt32(dataGridViewMedicamentos.CurrentRow.Cells[(int)Col_Medicamentos.MEDICAMENTO_ID].Value); MED_Solicita_Medicamento_Nuevo _itemSolicita = new MED_Solicita_Medicamento_Nuevo { medicamento_id = _codigoMedicamento, bejerman_id = "SIN CODIGO" }; E.MED_Solicita_Medicamento_Nuevo.Attach(_itemSolicita); E.Entry(_itemSolicita).Property(s => s.bejerman_id).IsModified = true; E.SaveChanges(); TraeMedicamentosPendientes(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { { DialogResult dialogResult = MessageBox.Show("Desea guardar el procedimiento?", "Procedimiento - Nutrición", MessageBoxButtons.YesNo, MessageBoxIcon.Question); { if (dialogResult == DialogResult.Yes) { SISTMEDEntities E = new SISTMEDEntities(); var q = from N in E.PRO_SuministroDeProcedimiento where N.paciente_id == paciente_id && N.tipoProcedimiento_id == 2 && N.fechaBaja == null select N; if (q.ToList().Count() > 0) { MessageBox.Show("Ya existe una nutricion para este paciente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Modifica_Suministro_Procedimiento_Nutricion(); Graba_Historial_Suministro_Procedimiento_Nutricion(); MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Opener.IActualiza(); this.Close(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void TraeObraSocial() { try { SISTMEDEntities _Stored = new SISTMEDEntities(); var _listObj = (from Tipos in _Stored.TraeObrasSociales() orderby Tipos.cli_RazSoc select Tipos).ToList(); TraeObrasSociales_Result _itemSeleccion = new TraeObrasSociales_Result();// ENTITIES QUE GENERA EL E. FRAMEWORK CUANDO ES UN STORED //Limpia el combo ComboBoxOSocial.SuspendLayout(); ComboBoxOSocial.DataSource = null; ComboBoxOSocial.Items.Clear(); // Carga el item de Seleccion _itemSeleccion.cli_RazSoc = "<Seleccione una Obra Social>"; _itemSeleccion.cli_Cod = "0"; _listObj.Insert(0, _itemSeleccion); //Carga el combo ComboBoxOSocial.DisplayMember = "cli_RazSoc"; ComboBoxOSocial.ValueMember = "cli_Cod"; ComboBoxOSocial.DataSource = _listObj.ToArray(); ComboBoxOSocial.SelectedIndex = 0; ComboBoxOSocial.ResumeLayout(); } catch (Exception ex) { } }
private void btnGuardar_Click(object sender, EventArgs e) { try { if (txtDiagnostico.Text == string.Empty) { MessageBox.Show("Debe ingresar un diagnostico", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { SISTMEDEntities E = new SISTMEDEntities(); MED_Diagnosticos _item = new MED_Diagnosticos(); _item.Diagnostico = txtDiagnostico.Text; E.Entry(_item).State = System.Data.Entity.EntityState.Added; E.SaveChanges(); Opener.ActualizaDiagnosticos(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbBoxHorarioAdministracion_SelectedIndexChanged(object sender, EventArgs e) { SISTMEDEntities E = new SISTMEDEntities(); string horario = cmbBoxHorarioAdministracion.SelectedItem.ToString(); int id_horarioadministracion = (from h in E.PRO_Alimento_Horarios_Administracion where h.descripcion.Equals(cmbBoxHorarioAdministracion.SelectedItem.ToString()) select h.id).Single(); // Obtener los alimentos que consume el paciente en ese horario de administracion IEnumerable <string> alimentos = from x in E.PRO_Alimento join y in E.PRO_Alimento_Paciente on x.alimento_id equals y.id_alimento join z in E.PRO_Alimento_Horarios_Administracion on y.id_horario_administracion equals z.id where z.id == id_horarioadministracion select x.descripcion; datagridAlimentosSeleccionados.Rows.Clear(); // Cargo los datos en el combo-box int indice; foreach (string alimento in alimentos) { indice = datagridAlimentosSeleccionados.Rows.Add(); datagridAlimentosSeleccionados.Rows[indice].Cells["Alimentos"].Value = alimento; } }
private void btnGrabar_Click(object sender, EventArgs e) { try { if (ValidarIngreso()) { MED_ModuloEmpresa _mod = new MED_ModuloEmpresa(); SISTMEDEntities _newCosto = new SISTMEDEntities(); _mod.codEmp = Clases.Usuario.EmpresaLogeada.EmpresaIngresada.ToString(); _mod.fechaAlta = DateTime.Now; _mod.fechaVigencia = dateTimeFechaVigencia.Value; _mod.modulo_id = comboBoxModulo.SelectedValue.ToString(); _mod.obraSocial_id = ComboBoxOSocial.SelectedValue.ToString(); _mod.costo = Convert.ToDouble(TextBoxCosto.Text.ToString(), culture); _newCosto.MED_ModuloEmpresa.Add(_mod); _newCosto.SaveChanges(); NuevoIngreso(); MessageBox.Show("Costo actualizado correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnReincorporar_Click(object sender, EventArgs e) { try { for (int i = 0; i < dataGridViewPacientesAlta.Rows.Count; i++) { if (dataGridViewPacientesAlta.Rows[i].Cells[(int)Col_Pacietnes.HABITACION].Value != null) { SISTMEDEntities E = new SISTMEDEntities(); E.Configuration.ValidateOnSaveEnabled = false; Pacientes P = new Pacientes { paciente_id = Convert.ToInt32(dataGridViewPacientesAlta.Rows[i].Cells[(int)Col_Pacietnes.PACIENTE_ID].Value), fechaEgreso = null, habitacion_id = Convert.ToInt32(dataGridViewPacientesAlta.Rows[i].Cells[(int)Col_Pacietnes.HABITACION].Value), sede_id = Clases.Paciente.PacienteSede }; E.Pacientes.Attach(P); E.Entry(P).Property(u => u.fechaEgreso).IsModified = true; E.Entry(P).Property(u => u.sede_id).IsModified = true; E.Entry(P).Property(u => u.habitacion_id).IsModified = true; E.SaveChanges(); this.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridViewMedicamentos_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == (int)Col_Medicamento.IMP) { DataGridViewCheckBoxCell cellSelecion = dataGridViewMedicamentos.Rows[e.RowIndex].Cells[(int)Col_Medicamento.IMP] as DataGridViewCheckBoxCell; SISTMEDEntities E = new SISTMEDEntities(); E.Configuration.ValidateOnSaveEnabled = false; int _suministroID = Convert.ToInt32(dataGridViewMedicamentos.Rows[e.RowIndex].Cells[(int)Col_Medicamento.ID].Value); MED_Historial_SuministroDeMedicacion _hist = new MED_Historial_SuministroDeMedicacion { suministroDeMedicacion_id = _suministroID, imprimeFactu = Convert.ToBoolean(cellSelecion.Value) }; E.MED_Historial_SuministroDeMedicacion.Attach(_hist); E.Entry(_hist).Property(f => f.imprimeFactu).IsModified = true; E.SaveChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Graba_Solicitud_Medicamento_Nuevo() { try { { CultureInfo culture = new CultureInfo("en-US"); SISTMEDEntities E = new SISTMEDEntities(); MED_Solicita_Medicamento_Nuevo _itemMedicamentoNuevo = new MED_Solicita_Medicamento_Nuevo(); _itemMedicamentoNuevo.medicamento = this.txtNombreMedicamento.Text.ToUpper(); _itemMedicamentoNuevo.presentacion_id = Convert.ToInt32(this.cboUnidadDeMedida.SelectedValue); _itemMedicamentoNuevo.unidadDeMedida_id = 1; _itemMedicamentoNuevo.fechaSolicita = System.DateTime.Now; _itemMedicamentoNuevo.Potencia = txtPotencia.Text; _itemMedicamentoNuevo.autoriza = false; _itemMedicamentoNuevo.pendiente = true; _itemMedicamentoNuevo.usuarioSolicita_id = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado; _itemMedicamentoNuevo.paciente_id = Clases.Paciente.PacienteIngresado; E.MED_Solicita_Medicamento_Nuevo.Add(_itemMedicamentoNuevo); E.SaveChanges(); MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { cmbBoxHorarioAdministracion.Enabled = true; // Obtengo los datos que voy a guardar en la bd SISTMEDEntities E = new SISTMEDEntities(); string observaciones = (txtObservacion.Text != null) ? txtObservacion.Text : ""; int idpaciente = Clases.Paciente.PacienteIngresado; int id_horarioadministracion_elegido = (from h in E.PRO_Alimento_Horarios_Administracion where h.descripcion.Equals(cmbBoxHorarioAdministracion.SelectedItem.ToString()) select h.id).Single(); // Guardo los que haya que guardar if (alimentosAAgregar.Count > 0) { var filas = E.PRO_Alimento_Paciente; for (int i = 0; i < alimentosAAgregar.Count; i++) { filas.Add(new PRO_Alimento_Paciente() { id_alimento = alimentosAAgregar.Keys.ElementAt(i), id_paciente = idpaciente, id_horario_administracion = id_horarioadministracion_elegido, observacion = observaciones }); } E.SaveChanges(); alimentosAAgregar.Clear(); } // Elimino los que haya que eliminar de los que ya estaban if (alimentosAEliminar.Count > 0) { var filas = E.PRO_Alimento_Paciente; for (int i = 0; i < alimentosAEliminar.Count; i++) { int id_alimentoAEliminar = Convert.ToInt32(alimentosAEliminar.Keys.ElementAt(i)); //Console.WriteLine("id alimento a eliminar: " + id_alimentoAEliminar); var filaAEliminar = filas.FirstOrDefault(x => x.id_paciente == idpaciente && x.id_horario_administracion == id_horarioadministracion_elegido && x.id_alimento == id_alimentoAEliminar); //Console.WriteLine("obtuve la fila"); if (filaAEliminar != null) { filas.Remove(filaAEliminar); //Console.WriteLine("Elimine la fila"); } } E.SaveChanges(); alimentosAEliminar.Clear(); //Console.WriteLine("Elimine los alimentos seleccionados"); } btnGuardar.Enabled = false; }
private void Login_Load(object sender, EventArgs e) { btnTest.Hide(); SISTMEDEntities E = new SISTMEDEntities(); CargarCboSede(); this.txtUsuario.Focus(); this.WindowState = System.Windows.Forms.FormWindowState.Normal; this.CenterToScreen(); CargarCboSede(); }
private bool AlreadyExistsSuministro() { SISTMEDEntities A = new SISTMEDEntities(); if (A.PRO_SuministroDeProcedimiento.Find(suministro_procedimiento_id) != null) { return(true); } else { return(false); } }
private bool AlreadyExists(int _IdUsuario) { SISTMEDEntities A = new SISTMEDEntities(); if (A.TBL_Usuarios.Find(_IdUsuario) != null) { return(true); } else { return(false); } }
private bool AlreadyExists() { SISTMEDEntities A = new SISTMEDEntities(); if (A.PRO_Posologia.Find(nutricion_id) != null) { return(true); } else { return(false); } }
public AgregarPlan formActual; // Referencia al form actual usada para recibir datos del siguiente form public AgregarPlan() { InitializeComponent(); formActual = this; //alimentosSeleccionados = new List<string>(); //ids_alimentosSeleccionados = new List<int>(); alimentosAAgregar = new Dictionary <int, string>(); alimentosAEliminar = new Dictionary <int, string>(); btnGuardar.Enabled = false; // Cargo el combo-box con los alimentos correspondientes al // horario de administracion por defecto SISTMEDEntities E = new SISTMEDEntities(); var horarios_administracion = from h in E.PRO_Alimento_Horarios_Administracion select new { h.id, h.descripcion }; // Obtengo el id del horario de administracion por defecto (es decir el primer elemento) int iteracion = 1; int primer_horario_administracion = -1; foreach (var ha in horarios_administracion) { if (iteracion == 1) { primer_horario_administracion = ha.id; } cmbBoxHorarioAdministracion.Items.Add(ha.descripcion); iteracion++; } cmbBoxHorarioAdministracion.SelectedIndex = 0; // Obtener los alimentos que consume el paciente en ese horario de administracion var alimentos = from x in E.PRO_Alimento join y in E.PRO_Alimento_Paciente on x.alimento_id equals y.id_alimento join z in E.PRO_Alimento_Horarios_Administracion on y.id_horario_administracion equals z.id where z.id == primer_horario_administracion select new { x.alimento_id, x.descripcion }; datagridAlimentosSeleccionados.Rows.Clear(); // Cargo los datos en el combo-box int indice; foreach (var alimento in alimentos) { indice = datagridAlimentosSeleccionados.Rows.Add(); datagridAlimentosSeleccionados.Rows[indice].Cells["Alimentos"].Value = alimento.descripcion; datagridAlimentosSeleccionados.Rows[indice].Cells["id"].Value = alimento.alimento_id; } }
private string traeMedico(int _idMedico) { try { SISTMEDEntities E = new SISTMEDEntities(); string _medico = E.TBL_Usuarios.Find(_idMedico).NombreUsuario.ToString(); return(_medico); } catch (Exception ex) { return(""); //MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click_1(object sender, EventArgs e) { try { { DialogResult dialogResult = MessageBox.Show("Desea guardar el procedimiento?", "Procedimiento - Nutrición", MessageBoxButtons.YesNo, MessageBoxIcon.Question); { if (dialogResult == DialogResult.Yes) { if (radioGastro.Checked == false && radioSNG.Checked == false && radioYeyu.Checked == false && radioOral.Checked == false) { MessageBox.Show("Debe seleccionar un tipo de nutricion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { SISTMEDEntities E = new SISTMEDEntities(); var q = from N in E.PRO_SuministroDeProcedimiento where N.paciente_id == paciente_id && N.tipoProcedimiento_id == 2 && N.fechaBaja == null select N; if (q.ToList().Count() > 0) { MessageBox.Show("Ya existe una nutricion para este paciente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Modifica_Suministro_Procedimiento_Nutricion(); Graba_Historial_Suministro_Procedimiento_Nutricion(); if (chboxAstringente.Checked == true) { int id_paciente = Clases.Paciente.PacienteIngresado; E.PRO_Posologia.SqlQuery("update PRO_Posologia set astringente=1 where paciente_id=" + id_paciente); //Console.WriteLine("Entré por aca"); } MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Opener.IActualiza(); this.Close(); } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private string traeMedicoMedicacion(string _idMedico) { try { SISTMEDEntities E = new SISTMEDEntities(); string _medico = E.TBL_Usuarios.Where(med => med.IdentificadorUsuario.Trim() == _idMedico).SingleOrDefault().NombreUsuario.ToString(); return(_medico); } catch (Exception ex) { return(""); MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarPacientes() { try { SISTMEDEntities E = new SISTMEDEntities(); foreach (var _item in E.Pacientes) { int _hab = _item.paciente_id; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarPerfiles() { try { SISTMEDEntities c = new SISTMEDEntities(); List <Sectores> _lista = c.Sectores.OrderBy(S => S.Descripcion).ToList(); cboPerfiles.DataSource = _lista; cboPerfiles.ValueMember = "sector_id"; cboPerfiles.DisplayMember = "Descripcion"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FrmAgregarAlimentos(AgregarPlan formAnterior) { InitializeComponent(); // Aca esta el problema this.formAnterior = formAnterior; SISTMEDEntities E = new SISTMEDEntities(); // Obtengo los alimentos disponibles var alimentos = from a in E.PRO_Alimento select new { a.alimento_id, a.descripcion }; // Los pongo en el datagridview int indice; foreach (var alimento in alimentos) { indice = datagridAlimentos.Rows.Add(); datagridAlimentos.Rows[indice].Cells["id"].Value = alimento.alimento_id; datagridAlimentos.Rows[indice].Cells["Alimento"].Value = alimento.descripcion; // habia un 1 en cells } }
private void Trae_Procedimientos() { try { SISTMEDEntities E = new SISTMEDEntities(); dataGridViewProcedimientos.Rows.Clear(); int indice; foreach (var _itemProcedimiento in E.PRO_SuministroDeProcedimiento.Where(p => p.paciente_id == Clases.Paciente.PacienteIngresado).ToList().Where(f => (f.fechaBaja >= dateDesde.Value && f.fechaBaja <= dateHasta.Value) || f.fechaBaja == null)) { indice = dataGridViewProcedimientos.Rows.Add(); dataGridViewProcedimientos.Rows[indice].Cells[(int)Col_Procedimiento.ID_PROC].Value = _itemProcedimiento.procedimiento_id; dataGridViewProcedimientos.Rows[indice].Cells[(int)Col_Procedimiento.PROCEDIMIENTO].Value = _itemProcedimiento.PRO_Procedimiento.descripcion + " " + (_itemProcedimiento.generico_id == null? "": _itemProcedimiento.PRO_Generico.observacion); dataGridViewProcedimientos.Rows[indice].Cells[(int)Col_Procedimiento.FECHA_INICIO].Value = _itemProcedimiento.fechaAltaSistema.Value.ToShortDateString(); dataGridViewProcedimientos.Rows[indice].Cells[(int)Col_Procedimiento.FECHA_BAJA].Value = _itemProcedimiento.fechaBaja == null? "" : _itemProcedimiento.fechaBaja.Value.ToShortDateString(); dataGridViewProcedimientos.Rows[indice].Cells[(int)Col_Procedimiento.MEDICO].Value = traeMedico(Convert.ToInt32(_itemProcedimiento.usuario_id)); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }