Beispiel #1
0
        public static List <Profesional> ObtenerProfesionalesXEspecialidad(decimal codigoEspecialidad)
        {
            List <Profesional> listaProfesionales = new List <Profesional>();
            SqlConnection      conn      = BD.conectar();
            SqlCommand         MiComando = new SqlCommand();

            MiComando.Connection  = conn;
            MiComando.CommandText = " SELECT CONCAT(pers_nombre, ' ',pers_apellido) as nombre, CONCAT(pers_tipo_documento, ' ',pers_numero_documento) as documento,pers_direccion, pers_telefono, pers_mail, pers_fecha_nacimiento, pers_sexo,  prof_codigo_matricula, prof_codigo_persona FROM ESE_CU_ELE.Profesional, ESE_CU_ELE.Persona, ESE_CU_ELE.EspecialidadXProfesional  WHERE pers_codigo = prof_codigo_persona  AND prof_codigo_persona = espexp_codigo_profesional and espexp_codigo_especialidad = " + codigoEspecialidad;
            SqlDataReader reader = MiComando.ExecuteReader();

            while (reader.Read())
            {
                Profesional Profesional = new Profesional();
                Profesional.codigoPersona   = (decimal)reader["prof_codigo_persona"];
                Profesional.matricula       = (decimal)reader["prof_codigo_matricula"];
                Profesional.nombre          = (string)reader["nombre"];
                Profesional.documento       = (string)reader["documento"];
                Profesional.direccion       = (string)reader["pers_direccion"];
                Profesional.telefono        = (decimal)reader["pers_telefono"];
                Profesional.mail            = (string)reader["pers_mail"];
                Profesional.fechaNacimiento = (DateTime)reader["pers_fecha_nacimiento"];
                Profesional.sexo            = (string)reader["pers_sexo"];
                listaProfesionales.Add(Profesional);
            }
            reader.Close();
            conn.Close();
            return(listaProfesionales);
        }
Beispiel #2
0
 public RegAgendaMedico(Profesional profesional)
 {
     InitializeComponent();
     this.profesional = profesional;
     agendaDeTrabajo  = new List <AgendaDiaria>();
     cargarPantalla();
 }
        public Profesional getInfo(int userID)
        {
            Profesional           profesional = new Profesional();
            EspecialidadesManager espMan      = new EspecialidadesManager();
            var row = SqlDataAccess.ExecuteDataRowQuery(ConfigurationManager.ConnectionStrings["StringConexion"].ToString(),
                                                        "[SHARPS].GetProfesionalInfo", SqlDataAccessArgs
                                                        .CreateWith("@userId", userID)
                                                        .Arguments);

            //Devuelve la informacion del profesional
            if (row != null && row != null)
            {
                profesional.UserName       = row["UserName"].ToString();
                profesional.UserID         = userID;
                profesional.FaltanDatos    = bool.Parse(row["FaltanDatos"].ToString());
                profesional.Matricula      = row["matricula"].ToString();
                profesional.Especialidades = espMan.GetAllForUser(userID);
                //Pedir a parte?
                profesional.DetallesPersona = new DetallesPersona()
                {
                    Apellido        = row["Apellido"].ToString(),
                    Nombre          = row["Nombre"].ToString(),
                    FechaNacimiento = Convert.ToDateTime(row["FechaNacimiento"]),
                    DNI             = long.Parse(row["DNI"].ToString()),
                    Email           = row["Email"].ToString(),
                    Direccion       = row["Direccion"].ToString(),
                    Telefono        = long.Parse(row["Telefono"].ToString()),
                    Sexo            = (TipoSexo)Enum.Parse(typeof(TipoSexo), row["Sexo"].ToString()),
                    TipoDNI         = (TipoDoc)Enum.Parse(typeof(TipoDoc), row["TipoDoc"].ToString())
                };
            }
            return(profesional);
        }
        public async Task <IActionResult> Edit(string id, [Bind("IdProfesional,Nombres,Apellidos,IdTipoDocumento,NoDocumento,Correo,Telefono,IdProfesion,IdEstudio,IdCargo,IdProyecto,IdEje")] Profesional profesional)
        {
            if (id != profesional.IdProfesional)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profesional);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfesionalExists(profesional.IdProfesional))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCargo"]         = new SelectList(_context.Cargos, "IdCargo", "IdCargo", profesional.IdCargo);
            ViewData["IdEje"]           = new SelectList(_context.EjeSeleccionado, "IdEje", "IdEje", profesional.IdEje);
            ViewData["IdEstudio"]       = new SelectList(_context.Estudios, "IdEstudio", "IdEstudio", profesional.IdEstudio);
            ViewData["IdProfesion"]     = new SelectList(_context.Profesiones, "IdProfesion", "IdProfesion", profesional.IdProfesion);
            ViewData["IdProyecto"]      = new SelectList(_context.Proyecto, "IdProyecto", "IdProyecto", profesional.IdProyecto);
            ViewData["IdTipoDocumento"] = new SelectList(_context.TipoDocumento, "IdTipoDocumento", "IdTipoDocumento", profesional.IdTipoDocumento);
            return(View(profesional));
        }
        internal List <Dictionary <string, object> > top5ProfesionalesMenosHorasTRabajadas(int mes, int anio, Especialidad filtroEspecialidad)
        {
            object especialidadValue = filtroEspecialidad == null ? null : (object)filtroEspecialidad.id;

            List <SqlParameter> parametros = new List <SqlParameter>();

            DataBase.Instance.agregarParametro(parametros, "mes", mes);
            DataBase.Instance.agregarParametro(parametros, "anio", anio);
            DataBase.Instance.agregarParametro(parametros, "@especialidad", especialidadValue);

            List <Dictionary <string, object> > lista = new List <Dictionary <string, object> >();

            autoMapping = false;

            List <Dictionary <string, object> > result = (List <Dictionary <string, object> >)executeStored("BEMVINDO.st_top5_profesionales_menos_horas_trabajdas", parametros);

            autoMapping = true;

            foreach (Dictionary <string, object> item in result)
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                Profesional profesional = (Profesional)unSerialize(item);
                dictionary.Add("profesional", profesional);
                dictionary.Add("horas", item["cant_horas_trabajadas"]);
                lista.Add(dictionary);
            }

            return(lista);
        }
 public static void EliminarEspecialidades(Profesional pro, List<Especialidad> list)
 {
     foreach (Especialidad unaEsp in list)
     {
         Especialidades.EliminarEspecialidadEnProfesional(pro.Id, unaEsp);
     }
 }
        public static decimal AgregarProfesional(Profesional pro)
        {
            List<SqlParameter> ListaParametros = new List<SqlParameter>();
            ListaParametros.Add(new SqlParameter("@nombre", pro.Nombre));
            ListaParametros.Add(new SqlParameter("@apellido", pro.Apellido));
            ListaParametros.Add(new SqlParameter("@fecha_nac", pro.FechaNacimiento));
            ListaParametros.Add(new SqlParameter("@sexo", pro.Sexo));
            ListaParametros.Add(new SqlParameter("@tipo_doc", (int)pro.TipoDocumento));
            ListaParametros.Add(new SqlParameter("@documento", (int)pro.NumeroDocumento));
            ListaParametros.Add(new SqlParameter("@direccion", pro.Direccion));
            ListaParametros.Add(new SqlParameter("@telefono", (int)pro.Telefono));
            ListaParametros.Add(new SqlParameter("@mail", pro.Mail));
            ListaParametros.Add(new SqlParameter("@matricula", (int)pro.Matricula));

            SqlParameter paramRet = new SqlParameter("@ret", System.Data.SqlDbType.Decimal);
            paramRet.Direction = System.Data.ParameterDirection.Output;

            ListaParametros.Add(paramRet);
            decimal ret = Clases.BaseDeDatosSQL.ExecStoredProcedure("mario_killers.agregarProfesional", ListaParametros);

            if (ret == 0)
            {
                return 0;
            }
            else
            {
                foreach (Especialidad unaEsp in pro.Especialidades)
                {
                    Especialidades.AgregarEspecialidadEnProfesional(ret, unaEsp);
                }
                return ret;
            }
        }
Beispiel #8
0
 private void CancelacionProfesional_Load(object sender, EventArgs e)
 {
     matricula = Profesional.matriculaPorUsuario(id_usuario);
     if (matricula == -1)
     {
         MessageBox.Show("Error, el profesional con el que ingresó no cuenta con numero de matricula.", "Clinica-FRBA Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
     else if (Rango_Atencion.rangosPorProfesional(matricula).Count == 0)
     {
         MessageBox.Show("Error, el profesional no tiene establecida una agenda.", "Clinica-FRBA Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
     else
     {
         List <Rango_Atencion> rangos = Rango_Atencion.rangosPorProfesional(matricula);
         rangos.ForEach(rango => dias.AddRange(Rango_Atencion.generarDiasRango(rango)));
         dias.RemoveAll(dia => dia.Date <= ClinicaFrba.Utils.Fechas.getCurrentDateTime().Date);
         actualizarDias();
         if (dias.Count == 0)
         {
             cb_anio_desde.Enabled = false;
             cb_mes_desde.Enabled  = false;
             cb_dia_desde.Enabled  = false;
             cb_anio_hasta.Enabled = false;
             cb_mes_hasta.Enabled  = false;
             cb_dia_hasta.Enabled  = false;
             btn_cancelar.Enabled  = false;
             tb_motivo.Enabled     = false;
             MessageBox.Show("No hay ninguna franja para cancelar.", "Clinica-FRBA ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.Close();
         }
     }
     actualizarDesde();
 }
 private void CargarProfesional(Profesional profesional)
 {
     _profesional                 = profesional;
     tbProfesional.Text           = _profesional.NombreCompleto;
     btnBuscarProfesional.Enabled = false;
     btnBuscarTurno.Enabled       = true;
 }
        public async Task <IActionResult> Edit(int id, [Bind("PrestacionId,CentroId,Id,Nombre,Apellido,Dni,Rol,Username")] Profesional profesional)
        {
            if (id != profesional.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profesional);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfesionalExists(profesional.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CentroId"]     = new SelectList(_context.Centros, "Id", "Nombre", profesional.CentroId);
            ViewData["PrestacionId"] = new SelectList(_context.Prestaciones, "Id", "Nombre", profesional.PrestacionId);
            return(View(profesional));
        }
Beispiel #11
0
 public RegistroResultado(String id_usuario, int id_rol)
 {
     InitializeComponent();
     matricula      = Profesional.matriculaPorUsuario(id_usuario);
     dt_dia.MinDate = ClinicaFrba.Utils.Fechas.getCurrentDateTime().Date.Subtract(new TimeSpan(24, 0, 0));
     ActualizarHora();
 }
Beispiel #12
0
        public async Task <IActionResult> Edit(int id, [Bind("ProfesionalId,Email,Estado,Nombres,ProfesionalTipoId,Telefonos")] Profesional profesional)
        {
            if (id != profesional.ProfesionalId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profesional);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfesionalExists(profesional.ProfesionalId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ProfesionalTipoId"] = new SelectList(_context.ProfesionalTipo, "ProfesionalTipoId", "Descripcion", profesional.ProfesionalTipoId);
            return(View(profesional));
        }
Beispiel #13
0
        public List <Profesional> getProfesionales(Int32 codigoEpecialidad)
        {
            SqlCommand func = armarFuncionTabla("OBTENER_PROFESIONALES_ESPECIALIDAD");

            func = addStringParamFuncion(func, codigoEpecialidad.ToString());

            List <Profesional> lista = new List <Profesional>();
            SqlDataReader      reader;

            func.CommandText = func.CommandText + ")";
            using (func)
            {
                reader = func.ExecuteReader();
                while (reader.Read())
                {
                    Profesional profesional = new Profesional();
                    profesional.detalle = new DetallePersona();

                    profesional.codigo           = (Int32)reader.GetValue(0);
                    profesional.Matricula        = reader.GetString(1);
                    profesional.detalle.Nombre   = reader.GetString(2);
                    profesional.detalle.Apellido = reader.GetString(3);

                    lista.Add(profesional);
                }
            }
            return(lista);
        }
        private Profesional obtenerProfesionalPorUsername()
        {
            StringBuilder query = new StringBuilder(ConfigurationManager.AppSettings["query.obtener.profesionales.select"].ToString());

            query.Append(" AND u.usu_username='******'");
            Profesional pro = new Profesional();

            using (SqlConnection cx = Connection.getConnection())
            {
                try
                {
                    SqlCommand sqlCmd = new SqlCommand(query.ToString(), cx);
                    cx.Open();
                    SqlDataReader sqlReader = sqlCmd.ExecuteReader();
                    while (sqlReader.Read())
                    {
                        pro.Apellido  = (sqlReader["Apellido"].ToString());
                        pro.Nombre    = (sqlReader["Nombre"].ToString());
                        pro.NroDoc    = Int32.Parse(sqlReader["Nro Documento"].ToString());
                        pro.Matricula = Int32.Parse(sqlReader["Matrícula"].ToString());
                    }
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    throw ex;
                }

                return(pro);
            }
        }
Beispiel #15
0
        public async Task <IActionResult> AgendaDiaria()
        {
            DateTime fechaDeHoy    = DateTime.Now;
            int      profesionalId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            Profesional profesional = await _context.Profesionales
                                      .Include(p => p.Centro)
                                      .Include(p => p.Prestacion)
                                      .Include(p => p.Turnos)
                                      .ThenInclude(t => t.Paciente)
                                      .Where(p => p.Id == profesionalId).SingleOrDefaultAsync();

            var listTurnosHoy = new List <Turno>();

            foreach (Turno t in profesional.Turnos)
            {
                DateTime rangoHasta = fechaDeHoy.AddMinutes(RANGO_TOLERANCIA_TURNO_MINUTOS);
                DateTime rangoDesde = fechaDeHoy.AddMinutes(RANGO_TOLERANCIA_TURNO_MINUTOS * -1);

                if (t.Fecha.Day == fechaDeHoy.Day)
                {
                    if (t.Fecha >= rangoDesde && t.Fecha <= rangoHasta && t.Estado != EstadoTurnoEnum.FINALIZADO)
                    {
                        //CAMBIO EL ESTADO PARA QUE DESDE EL FRONT SE PUEDA REALIZAR LA CONSULTA
                        t.Estado = EstadoTurnoEnum.ACTUAL;
                    }
                    listTurnosHoy.Add(t);
                }
            }
            if (listTurnosHoy.Count == 0)
            {
                ViewBag.MENSAJE = "No posee turnos reservados para el dia de hoy";
            }
            return(View(listTurnosHoy));
        }
Beispiel #16
0
        public async Task <IActionResult> MiAgenda()
        {
            int         mesActual     = DateTime.Now.Month;
            int         montoTotal    = 0;
            int         profesionalId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
            Profesional profesional   = await _context.Profesionales
                                        .Include(p => p.Turnos)
                                        .ThenInclude(t => t.Paciente)
                                        .Include(p => p.Prestacion)
                                        .Include(p => p.Centro)
                                        .SingleOrDefaultAsync(p => p.Id == profesionalId);

            List <Turno> turnosDelMesActual = new List <Turno>();

            foreach (Turno t in profesional.Turnos)
            {
                if (t.Fecha.Month == mesActual)
                {
                    turnosDelMesActual.Add(t);
                }
            }
            if (profesional != null && turnosDelMesActual.Count > 0)
            {
                foreach (Turno t in turnosDelMesActual)
                {
                    if (t.Estado == EstadoTurnoEnum.FINALIZADO)
                    {
                        montoTotal = turnosDelMesActual.Count * profesional.Prestacion.Monto;
                    }
                }
            }
            ViewBag.Bienvenida = "Turnos para el mes de " + DateUtil.getMesPorNumero(mesActual);
            ViewBag.Monto      = montoTotal;
            return(View(turnosDelMesActual));
        }
 public void Delete(Profesional profesional)
 {
     SqlDataAccess.ExecuteNonQuery(ConfigurationManager.ConnectionStrings["StringConexion"].ToString(),
                                   "[SHARPS].DeleteProfesional", SqlDataAccessArgs
                                   .CreateWith("@ID", profesional.UserID)
                                   .Arguments);
 }
        public void cargarPacientesADiagnosticarDe(Profesional unProfesional)
        {
            List <Turno> turnosADiagnosticar = new List <Turno>();

            turnosADiagnosticar = new TurnoRepository().obtenerTurnosADiagnosticarDe(unProfesional);
            if (turnosADiagnosticar.Count > 0)
            {
                cmbPacientes.DataSource    = turnosADiagnosticar;
                cmbPacientes.DisplayMember = "nombreAfiliadoCompleto";
                cmbPacientes.Enabled       = true;
                rtxtSintomas.Enabled       = true;
                rtxtDiagnostico.Enabled    = true;
                lblDatoFecha.Text          = DataBase.Instance.getDate().ToString("dddd dd/MM/yyyy");
                lblDatoHora.Text           = DataBase.Instance.getDate().ToString("HH:mm");
                lblDatoAfiliado.Text       = ((Turno)cmbPacientes.SelectedItem).nombreAfiliadoCompleto;
            }
            else
            {
                MessageBox.Show("ERROR: No hay turnos que se hayan registrado su llegada. Fecha: " + DataBase.Instance.getDate().ToString("dd/MM/yyyy HH:mm"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbPacientes.Enabled    = false;
                rtxtSintomas.Enabled    = false;
                rtxtDiagnostico.Enabled = false;
                btnConfirmar.Enabled    = false;
            }
        }
Beispiel #19
0
 internal BajaProfesional(Form padre, Profesional profesional)
 {
     InitializeComponent();
     this.padre = padre;
     this.profesional = profesional;
     this.idBox.Text = profesional.id.ToString();
 }
 private void Modificacion_Load(object sender, System.EventArgs e)
 {
     profesional = (Profesional)HomeProfesionales.Instance.seleccionar();
     if (profesional == null)
         Close();
     updateForm();
 }
Beispiel #21
0
 /// <summary>
 /// Cierra la sesion actual
 /// </summary>
 public static void Salir()
 {
     User        = null;//Limpia la info del usuario
     Profesional = null;
     Afiliado    = null;
     ViewsManager.BorrarMenu();
 }
Beispiel #22
0
        private void cboFechas_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboHorariosDisponibles.Items.Clear();
            if (cboFechas.SelectedIndex <= 0)
            {
                cboHorariosDisponibles.Enabled = false;
                return;
            }

            Especialidad especialidad = (Especialidad)cboEspecialidades.SelectedItem;
            Profesional  profesional  = (Profesional)cboProfesionales.SelectedItem;
            String       fecha        = (String)cboFechas.SelectedItem;

            cboHorariosDisponibles.Enabled = true;
            cboHorariosDisponibles.Items.Add("-- Seleccione horario --");

            using (ProfesionalDAO dao = new ProfesionalDAO())
            {
                List <Turno> horas = dao.getHorasConTurno(profesional.codigo, especialidad.EspecialidadId, fecha);

                foreach (Turno hora in horas)
                {
                    cboHorariosDisponibles.Items.Add(hora);
                }
                cboHorariosDisponibles.SelectedIndex = 0;
            }
        }
 void profesionalesForm_OnProfesionalSelected(object sender, ProfesionalSelectedEventArgs e)
 {
     _profesional        = e.Profesional;
     txtProfesional.Text = _profesional.ToString();
     _profesionalesForm.Hide();
     panelAfiliado.Visible = true;
 }
Beispiel #24
0
        private void cboProfesionales_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboFechas.Items.Clear();
            if (cboProfesionales.SelectedIndex <= 0)
            {
                cboFechas.Enabled = false;
                return;
            }

            Especialidad especialidad = (Especialidad)cboEspecialidades.SelectedItem;
            Profesional  profesional  = (Profesional)cboProfesionales.SelectedItem;

            cboFechas.Enabled = true;
            cboFechas.Items.Add("-- Seleccione una fecha --");

            using (ProfesionalDAO dao = new ProfesionalDAO())
            {
                List <String> fechas = dao.getFechasConTurno(profesional.codigo, especialidad.EspecialidadId);

                foreach (String fecha in fechas)
                {
                    cboFechas.Items.Add(fecha);
                }
                cboFechas.SelectedIndex = 0;
            }
        }
 void profesionalesForm_OnProfesionalSelected(object sender, ProfesionalSelectedEventArgs e)
 {
     _profesional        = e.Profesional;
     txtProfesional.Text = _profesional.ToString();
     _profesionalesForm.Close();
     panelAcciones.Show();
 }
Beispiel #26
0
        protected override void AccionAceptar()
        {
            try
            {
                Profesional prof = this.ObtenerProfesional();
                IResultado <Profesional> resultado = _profesionalDomain.Modificar(prof);
                if (!resultado.Correcto)
                {
                    throw new ResultadoIncorrectoException <Profesional>(resultado);
                }

                var resultadoLimpiarEspecialidades = _profesionalDomain.LimpiarEspecialidades(prof);
                if (!resultadoLimpiarEspecialidades.Correcto)
                {
                    throw new ResultadoIncorrectoException <bool>(resultadoLimpiarEspecialidades);
                }

                foreach (Especialidad especialidad in lstEspecialidades.Items.Cast <Especialidad>())
                {
                    var resultadoAsociar = _profesionalDomain.AsociarProfesionalEspecialidad(prof, especialidad);
                    if (!resultadoAsociar.Correcto)
                    {
                        throw new ResultadoIncorrectoException <bool>(resultadoAsociar);
                    }
                }
                MensajePorPantalla.MensajeInformativo(this, "Modificado con éxito");
                this.Close();
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(ex.Message);
            }
        }
        public static decimal AgregarProfesionalSinPersona(Profesional pro)
        {
            List<SqlParameter> ListaParametros = new List<SqlParameter>();
            ListaParametros.Add(new SqlParameter("@tipo_doc", (int)pro.TipoDocumento));
            ListaParametros.Add(new SqlParameter("@documento", (int)pro.NumeroDocumento));
            ListaParametros.Add(new SqlParameter("@matricula", (int)pro.Matricula));

            SqlParameter paramRet = new SqlParameter("@ret", System.Data.SqlDbType.Decimal);
            paramRet.Direction = System.Data.ParameterDirection.Output;

            ListaParametros.Add(paramRet);
            decimal ret = Clases.BaseDeDatosSQL.ExecStoredProcedure("mario_killers.agregarProfesionalSinPersona", ListaParametros);

            if (ret == 0)
            {
                return 0;
            }
            else
            {
                foreach (Especialidad unaEsp in pro.Especialidades)
                {
                    Especialidades.AgregarEspecialidadEnProfesional(ret, unaEsp);
                }
                return ret;
            }
        }
        private void btnBuscarProfesionalEmail_Click(object sender, EventArgs e)
        {
            var list = proC.buscarProfesional(txtBuscador.Text.ToLower());
            List <Profesional> listaProf = new List <Profesional>();

            foreach (var pro in list)
            {
                Profesional prof = new Profesional();
                //ListViewItem item = new ListViewItem(pro.idProfesional.ToString());
                prof.idProfesional  = pro.idProfesional;
                prof.rutProfesional = pro.rutProfesional;
                prof.pnombre        = pro.pnombre;
                prof.snombre        = pro.snombre;
                prof.appaterno      = pro.appaterno;
                prof.apmaterno      = pro.apmaterno;
                prof.direccion      = pro.direccion;
                prof.telefono       = pro.telefono;
                //prof.fechaNacimientoPro = pro.fechaNacimientoPro.ToString("dd/MM/yyyy");
                listaProf.Add(prof);
                limpiarBuscadorProfesional();
            }

            grdListarProf.DataSource = listaProf;
            grdListarProf.Columns["idProfesional"].Visible = false;
            grdListarProf.Columns["rutProfesional"].Width  = 80;
            grdListarProf.Columns["pnombre"].Width         = 80;
        }
        //Accedió un profesional
        public RegistrarAgenda(String nroDocProfesional)
        {
            StringBuilder sqlProfesional = new StringBuilder(ConfigurationManager.AppSettings["query.obtener.profesionales.select"]);

            sqlProfesional.Append(" WHERE");
            sqlProfesional.Append(ConfigurationManager.AppSettings["query.obtener.profesionales.where.nro.doc"].Replace("{2}", nroDocProfesional));
            using (SqlConnection cx = Connection.getConnection())
            {
                try
                {
                    SqlCommand sqlCmd = new SqlCommand(sqlProfesional.ToString(), cx);
                    cx.Open();
                    SqlDataReader sqlReader = sqlCmd.ExecuteReader();
                    while (sqlReader.Read())
                    {
                        //Al buscar por nro de documento, devuelve un resultado
                        this.profesional = new Profesional(sqlReader["Apellido"].ToString(),
                                                           sqlReader["Nombre"].ToString(),
                                                           sqlReader["Tipo Documento"].ToString(),
                                                           int.Parse(sqlReader["Nro Documento"].ToString()),
                                                           int.Parse(sqlReader["Matrícula"].ToString()));
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    MessageBox.Show("Se produjo un error al cargar el profesional", "Error al cargar profesional", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            InitializeComponent();
            this.btn_buscar_profesional.Enabled = false;
            this.txt_profesional.Text           = this.profesional.Apellido + ", " + this.profesional.Nombre;
            this.especialidades = obtenerEspecialidadesProfesional(this.profesional.NroDoc);
        }
Beispiel #30
0
        public object EditaProfesional(Profesional profesional, int id)
        {
            object result = null;

            try
            {
                var dyParam = new OracleDynamicParameters();

                dyParam.Add("p_id", OracleDbType.Int32, ParameterDirection.Input, id);
                dyParam.Add("p_nombre", OracleDbType.Varchar2, ParameterDirection.Input, profesional.profesional_nombre);
                dyParam.Add("p_apellido", OracleDbType.Varchar2, ParameterDirection.Input, profesional.profesional_apellido);
                dyParam.Add("p_rut", OracleDbType.Varchar2, ParameterDirection.Input, profesional.profesional_rut);
                dyParam.Add("p_activo", OracleDbType.Int32, ParameterDirection.Input, profesional.profesional_activo);


                var conn = this.GetConnection();
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                if (conn.State == ConnectionState.Open)
                {
                    var query = "SP_EDITA_PROFESIONAL";

                    result = SqlMapper.Query(conn, query, param: dyParam, commandType: CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Beispiel #31
0
        private void Guardar(Profesional oRegistro)
        {
            Usuario oUser = new Usuario();

            oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString()));

            oRegistro.IdEfector = oUser.IdEfector.IdEfector;


            oRegistro.Apellido        = txtApellido.Text;
            oRegistro.Nombre          = txtNombre.Text;
            oRegistro.IdTipoDocumento = 1;
            if (txtNumeroDocumento.Value.Trim() != "")
            {
                oRegistro.NumeroDocumento = int.Parse(txtNumeroDocumento.Value);
            }
            else
            {
                oRegistro.NumeroDocumento = 0;
            }

            oRegistro.Matricula         = txtMatricula.Text;
            oRegistro.Activo            = chkActivo.Checked;
            oRegistro.IdUsuario         = int.Parse(Session["idUsuario"].ToString());
            oRegistro.FechaModificacion = DateTime.Now;

            oRegistro.Save();
        }
        public IResultado <Profesional> Modificar(Profesional profesional)
        {
            Resultado <Profesional> resultado = new Resultado <Profesional>();

            try
            {
                resultado.Retorno = _domain.Modificar(profesional);
            }
            catch (SqlException ex)
            {
                resultado.Correcto = false;
                if (ex.Errors.Count > 0)
                {
                    // Violación de constraint UNIQUE
                    if (ex.Class == 14 && (ex.Number == 2627 || ex.Number == 50000))
                    {
                        resultado.Mensajes.Add("No se permite valores repetidos para los campos 'Nro de Documento' o 'Matricula'.");
                    }
                }
                resultado.Mensajes.Add(ex.Message);
            }
            catch (Exception ex)
            {
                resultado.Correcto = false;
                resultado.Mensajes.Add(ex.Message);
            }

            return(resultado);
        }
        internal List <Dictionary <string, object> > top5ProfesionalesMasConsultas(int mes, int anio, PlanMedico filtroPlan)
        {
            object planValue = filtroPlan == null ? null : (object)filtroPlan.id;

            List <SqlParameter> parametros = new List <SqlParameter>();

            DataBase.Instance.agregarParametro(parametros, "mes", mes);
            DataBase.Instance.agregarParametro(parametros, "anio", anio);
            DataBase.Instance.agregarParametro(parametros, "@plan_medico", planValue);

            List <Dictionary <string, object> > lista = new List <Dictionary <string, object> >();

            autoMapping = false;

            List <Dictionary <string, object> > result = (List <Dictionary <string, object> >)executeStored("BEMVINDO.st_top5_profesionales_mas_consultados", parametros);

            autoMapping = true;

            foreach (Dictionary <string, object> item in result)
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                Profesional profesional = (Profesional)unSerialize(item);
                dictionary.Add("profesional", profesional);
                dictionary.Add("consultas", item["cant_de_consultas"]);
                lista.Add(dictionary);
            }

            return(lista);
        }
Beispiel #34
0
    public void RaiseCallbackEvent(string eventArg)
    {
        string sResultado = "";

        //1º Si hubiera argumentos, se recogen y tratan.
        //string MisArg = eventArg;
        string[] aArgs = Regex.Split(eventArg, "@#@");
        sResultado = aArgs[0] + @"@#@"; if (Session["GVT_IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;

        //2º Aquí realizaríamos el acceso a BD, etc,...
        switch (aArgs[0])
        {
        case ("buscar"):
            try
            {
                sResultado += "OK@#@" + Profesional.ObtenerBeneficiariosConsulta(Utilidades.unescape(aArgs[1]), Utilidades.unescape(aArgs[2]), Utilidades.unescape(aArgs[3]), Utilidades.unescape(aArgs[4]));
            }
            catch (Exception ex)
            {
                sResultado += "Error@#@" + Errores.mostrarError("Error al obtener los beneficiarios.", ex);
            }
            break;
        }

        //3º Damos contenido a la variable que se envía de vuelta al cliente.
        _callbackResultado = sResultado;
    }
Beispiel #35
0
        protected void ButtonGuardar_Click(object sender, EventArgs e)
        {
            UsuarioBLL     usuarioBLL = new UsuarioBLL();
            Profesional    profesional;
            ProfesionalBLL profesionalBLL = new ProfesionalBLL();

            try
            {
                string email = Session["Usuario"].ToString();

                profesional = new Profesional();
                profesional.IdProfesional = profesionalBLL.obtenerIdProfesional(email);
                profesional.CuitCuil      = Convert.ToInt64(TextBoxCuit.Text);
                profesionalBLL.editarProfesional(profesional);

                profesional.UsuarioP = new Usuario();
                TextBoxEmail.Text    = email;
                profesional.UsuarioP.NombreUsuario = TextBoxNombre.Text;
                profesional.UsuarioP.Email         = TextBoxEmail.Text;
                profesional.UsuarioP.Contrasenia   = TextBoxContrasenia.Text;
                profesional.UsuarioP.Telefono      = Convert.ToInt32(TextBoxTelefono.Text);

                usuarioBLL.editarUsuario(profesional.UsuarioP); //GUARDO EL REGISTRO EN LAS TABLAS USUARIO Y PROFESIONAL
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 internal ModificarProfesional(Form padre, Profesional profesional)
 {
     InitializeComponent();
     this.padre = padre;
     this.profesional = profesional;
     cargarCampos();
     validarCampos();
 }
Beispiel #37
0
 private void Listado_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (dataGridView.SelectedRows.Count > 0)
     {
         profesional = new Profesional();
         HomeProfesionales.Instance.mapear(profesional, dataGridView);
     }
     if (profesional == null)
         return;
     if (profesional.id == 0)
         profesional = null;
     else DialogResult = DialogResult.OK;
 }
 //Se realiza el alta de un profesional dado
 public bool altaProfesional(Profesional profesional)
 {
     using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
     using (TransactionScope ts = new TransactionScope())
     {
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "BONDIOLA.altaProfesional";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@nombre", profesional.nombre);
         cmd.Parameters.AddWithValue("@apellido", profesional.apellido);
         cmd.Parameters.AddWithValue("@tipoDocumento", profesional.tipoDeDocumento);
         cmd.Parameters.AddWithValue("@numeroDocumento", profesional.numeroDeDocumento);
         cmd.Parameters.AddWithValue("@fechaNacimiento", profesional.fechaDeNacimiento);
         cmd.Parameters.AddWithValue("@direccion", profesional.direccion);
         cmd.Parameters.AddWithValue("@mail", profesional.mail);
         cmd.Parameters.AddWithValue("@telefono", profesional.telefono);
         cmd.Parameters.AddWithValue("@sexo", profesional.sexo);
         cmd.Parameters.AddWithValue("@matricula", profesional.matricula);
         cmd.Parameters.AddWithValue("@nombreUsuario", profesional.usuario);
         cmd.Parameters.AddWithValue("@hashContrasenia", Utils.hashearSHA256(profesional.contraseña));
         try
         {
             conn.Open();
             int idGenerado = Convert.ToInt32(cmd.ExecuteScalar());
             foreach (var especialidad in profesional.especialidades)
             {
                 SqlCommand cmdEsp = conn.CreateCommand();
                 cmdEsp.CommandType = CommandType.StoredProcedure;
                 cmdEsp.CommandText = "BONDIOLA.altaProfesionalEspecialidad";
                 cmdEsp.Parameters.AddWithValue("@idProfesional", idGenerado);
                 cmdEsp.Parameters.AddWithValue("@especialidad", especialidad);
                 cmdEsp.ExecuteNonQuery();
             }
             MessageBox.Show("Operación realizada con éxito.");
             ts.Complete();
         }
         catch (SqlException ex)
         {
             string error = "";
             if (ex.Message.Contains("Constraint_Documento"))
                 error = "Ya existe un profesional con el número de documento " + profesional.numeroDeDocumento;
             else if (ex.Message.Contains("Constraint_Matricula"))
                 error = "Ya existe un profesional con la matrícula " + profesional.matricula;
             MessageBox.Show(error+Environment.NewLine+ex.Message);
             return false;
         }
     }
     return true;
 }
Beispiel #39
0
 private Profesional crearProfesional()
 {
     Profesional profesional = new Profesional();
     profesional.nombre = nombreBox.Text;
     profesional.apellido = apellidoBox.Text;
     profesional.tipoDoc = tipoDocBox.Text;
     profesional.nroDoc = Convert.ToInt32(nroDocBox.Text);
     profesional.direccion = direcBox.Text;
     profesional.mail = mailBox.Text;
     profesional.nroMatricula = Convert.ToInt32(matriculaBox.Text);
     profesional.telefono = Convert.ToInt64(telBox.Text);
     profesional.sexo = sexo;
     profesional.fechaNac = fechaNacBox.Value;
     return profesional;
 }
        private void ProcesarAgendas(PersonaEditModel editModel, Profesional personaProfesional)
        {
            var session = SessionFactory.GetCurrentSession();
            //Veo el tema de las agendas
            if (editModel.Profesional.Agendas == null || !editModel.Profesional.Agendas.Any())
            {
                personaProfesional.Agendas.Clear();
            }
            else
            {
                //Agendas a eliminar
                var agendasAEliminar =
                    personaProfesional.Agendas.Where(m => !editModel.Profesional.Agendas.Select(x => x.Id).Contains(m.Id)).ToList();
                foreach (var agenda in agendasAEliminar)
                {
                    personaProfesional.QuitarAgenda(agenda);
                }
                //Agendas a agregar
                var agendasAAgregar = editModel.Profesional.Agendas.Where(x => !x.Id.HasValue);
                foreach (var agendaEditModel in agendasAAgregar)
                {
                    var agendaModel = _mappingEngine.Map<Agenda>(agendaEditModel);

                    if (agendaEditModel.EspecialidadesSeleccionadas != null)
                    {
                        foreach (var especialidadId in agendaEditModel.EspecialidadesSeleccionadas)
                        {
                            var especialidad = session.Load<Especialidad>(especialidadId);
                            agendaModel.AgregarEspecialidad(especialidad);
                        }
                    }
                    agendaModel.Consultorio = session.Load<Consultorio>(agendaEditModel.ConsultorioId);

                    personaProfesional.AgregarAgenda(agendaModel);
                }
                //Agendas a actualizar
                var agendasActualizar =
                    personaProfesional.Agendas.Where(m => editModel.Profesional.Agendas.Select(x => x.Id).Contains(m.Id)).ToList();
                foreach (var agenda in agendasActualizar)
                {
                    var agendaEditModel = editModel.Profesional.Agendas.Single(v => v.Id == agenda.Id);
                    _mappingEngine.Map(agendaEditModel, agenda);
                    ProcesarEspecialidades(agendaEditModel, agenda);
                    agenda.Consultorio = session.Load<Consultorio>(agendaEditModel.ConsultorioId);
                }
            }

            //Limpio el cache de turnos, para que procese a partir de la nueva agenda
            var query = QueryFactory.Create<IObtenerTurnosProfesionalQuery>();
            query.ProfesionalId = personaProfesional.Id;
            query.ClearCache();
        }
 private void ProcesarEspecialidades(PersonaEditModel editModel, Profesional personaProfesional)
 {
     var session = SessionFactory.GetCurrentSession();
     //Especialidades a eliminar
     var especialidadesAEliminar =
         personaProfesional.Especialidades.Where(
             x => !editModel.Profesional.EspecialidadesSeleccionadas.Contains(x.Id)).ToList();
     foreach (var especialidadAEliminar in especialidadesAEliminar)
     {
         personaProfesional.QuitarEspecialidad(especialidadAEliminar);
     }
     //Especialidades a agregar
     var especialidadesAAgregar =
         editModel.Profesional.EspecialidadesSeleccionadas.Where(
             x => !personaProfesional.Especialidades.Select(p => p.Id).Contains(x)).ToList();
     foreach (var especialidadAAgregar in especialidadesAAgregar)
     {
         var especialidad = session.Load<Especialidad>(especialidadAAgregar);
         personaProfesional.AgregarEspecialidad(especialidad);
     }
 }
 //Hace baja lógica de un profesional
 public void darDeBaja(Profesional profesional)
 {
     if (profesional.id.Equals(null))
     {
         throw new Exception("Seleccione un profesional para dar de baja.");
     }
     using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
     {
         SqlCommand cmd = SQL.Instance.crearSP("BONDIOLA.bajaProfesional",
             conn,
             new SqlParameter("@id", profesional.id));
         SQL.Instance.ejecutarNonQuery(cmd);
     }
 }
 //Busca la información de un profesional según su id y la mapea a un objeto
 public Profesional getFromId(int id)
 {
     Profesional profesional = new Profesional();
     SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString);
     SqlCommand cmd = new SqlCommand("SELECT * FROM BONDIOLA.VistaProfesionalesActivos WHERE Id = @id", conn);
     cmd.Parameters.AddWithValue("@id", id);
     conn.Open();
     SqlDataReader rdr = cmd.ExecuteReader();
     rdr.Read();
     profesional.id = id;
     profesional.apellido = rdr["Apellido"].ToString();
     profesional.fechaDeNacimiento = (DateTime)rdr["Fecha de Nacimiento"];
     profesional.matricula = rdr["Matricula"].ToString();
     profesional.mail = rdr["Mail"].ToString();
     profesional.direccion = rdr["Direccion"].ToString();
     profesional.nombre = rdr["Nombre"].ToString();
     profesional.sexo = rdr["Sexo"].ToString()[0];
     profesional.telefono = rdr["Telefono"].ToString();
     profesional.tipoDeDocumento = rdr["Tipo De Documento"].ToString();
     conn.Close();
     return profesional;
 }
 private void volverAVistaPedirTurno(Profesional profesional, EspecialidadMedica especialidad)
 {
     (padre as PedirTurno).setearProfesional(profesional, especialidad);
     AsistenteVistas.volverAPadreYCerrar(padre, this);
 }
Beispiel #45
0
 private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView.SelectedRows.Count == 0) return;
     profesional = new Profesional();
     HomeProfesionales.Instance.mapear(profesional, dataGridView);
 }
Beispiel #46
0
        public int DameEspecialidadDelTurno(DateTime fecha, Afiliado afiliado, Profesional profesional)
        {
            int i = -1;
            List<SqlParameter> ListaParametros = new List<SqlParameter>();
            ListaParametros.Add(new SqlParameter("@profesional", profesional.Id));
            ListaParametros.Add(new SqlParameter("@persona", afiliado.Codigo_Persona));
            ListaParametros.Add(new SqlParameter("@horario", fecha));

            SqlDataReader lector = Clases.BaseDeDatosSQL.ObtenerDataReader("SELECT * FROM mario_killers.Turno where (profesional=@profesional and persona=@persona and horario=@horario)", "T", ListaParametros);

            if (lector.HasRows)
            {
                lector.Read();
                i= (int)(decimal)lector["especialidad"];
            }
            return i;
        }
        public static List<Profesional> ObtenerProfesionales(String nombre, String apellido, String dni, String numeroMatricula, decimal especialidad)
        {
            List<Profesional> Lista = new List<Profesional>();

            List<SqlParameter> ListaParametros = new List<SqlParameter>();
            if (nombre != "") ListaParametros.Add(new SqlParameter("@nombre", "%" + nombre + "%")); else ListaParametros.Add(new SqlParameter("@nombre", "%%"));
            if (apellido != "") ListaParametros.Add(new SqlParameter("@apellido", "%" + apellido + "%")); else ListaParametros.Add(new SqlParameter("@apellido", "%%"));
            if (dni != "") ListaParametros.Add(new SqlParameter("@dni", "%" + dni + "%")); else ListaParametros.Add(new SqlParameter("@dni", "%%"));
            if (numeroMatricula != "") ListaParametros.Add(new SqlParameter("@matricula", "%" + numeroMatricula + "%")); else ListaParametros.Add(new SqlParameter("@matricula", "%%"));
            if (especialidad != 0) ListaParametros.Add(new SqlParameter("@especialidad", especialidad)); else ListaParametros.Add(new SqlParameter("@especialidad", 0));

            String query = @"SELECT PRO.persona AS persona, PRO.matricula AS matricula, P.nombre AS nombre, P.apellido AS apellido,
                   P.documento AS documento, p.direccion AS direccion, P.fecha_nac AS fecha_nac, P.mail AS mail, TD.id AS tipo_doc,
                   P.sexo AS sexo, P.telefono AS telefono
                   FROM mario_killers.Profesional PRO JOIN mario_killers.Persona P ON PRO.persona = P.id
                                                      JOIN mario_killers.Especialidad_Profesional EP ON EP.profesional = PRO.persona
                                                      JOIN mario_killers.Especialidad E ON E.codigo = EP.especialidad
                                                      JOIN mario_killers.Tipo_Documento TD ON TD.id = P.tipo_doc
                   WHERE PRO.activo = 1 AND apellido LIKE @apellido AND nombre LIKE @nombre AND documento LIKE @dni AND
                         (matricula LIKE @matricula OR matricula IS NULL) AND E.codigo LIKE @especialidad
                   GROUP BY PRO.persona, PRO.matricula, P.nombre, P.apellido, P.documento, P.direccion, P.fecha_nac, P.mail,
                            TD.id, P.sexo, P.telefono";

            SqlDataReader lector = Clases.BaseDeDatosSQL.ObtenerDataReader(query, "T", ListaParametros);

            if (lector.HasRows)
            {
                while (lector.Read())
                {
                    Profesional unProfesional = new Profesional();
                    unProfesional.Id = (int)(decimal)lector["persona"];
                    unProfesional.Apellido = (string)lector["apellido"];
                    unProfesional.Nombre = (string)lector["nombre"];
                    if (DBNull.Value != lector["matricula"])
                    {
                        unProfesional.Matricula = (int)(decimal)lector["matricula"];
                    }
                    else
                    {
                        unProfesional.Matricula = -1;
                    }
                    unProfesional.NumeroDocumento = (decimal)lector["documento"];
                    unProfesional.FechaNacimiento = (DateTime)lector["fecha_nac"];
                    unProfesional.Direccion = (String)lector["direccion"];
                    unProfesional.TipoDocumento = (decimal)lector["tipo_doc"];
                    unProfesional.Sexo = (string)lector["sexo"];
                    unProfesional.Mail = (String)lector["mail"];
                    unProfesional.Telefono = (decimal)lector["telefono"];

                    //ARMO LA LISTA DE ESPECIALIDADES
                    List<SqlParameter> ListaParametros2 = new List<SqlParameter>();
                    ListaParametros2.Add(new SqlParameter("@nombre", "%" + unProfesional.Nombre + "%"));
                    ListaParametros2.Add(new SqlParameter("@apellido", "%" + unProfesional.Apellido + "%"));
                    ListaParametros2.Add(new SqlParameter("@dni", "%" + unProfesional.NumeroDocumento + "%"));
                    ListaParametros2.Add(new SqlParameter("@matricula", "%" + unProfesional.Matricula + "%"));
                    //if (especialidad != 0) ListaParametros2.Add(new SqlParameter("@especialidad", "%" + especialidad + "%")); else ListaParametros2.Add(new SqlParameter("@especialidad", 0));

                    String queryEsp = @"SELECT E.codigo AS codigo, E.descripcion AS descripcion, E.tipo AS tipo
                                        FROM mario_killers.Profesional PRO JOIN mario_killers.Persona P ON PRO.persona = P.id
                                                      JOIN mario_killers.Especialidad_Profesional EP ON EP.profesional = PRO.persona
                                                      JOIN mario_killers.Especialidad E ON E.codigo = EP.especialidad
                                        WHERE PRO.activo = 1 AND apellido LIKE @apellido AND nombre LIKE @nombre AND documento LIKE @dni AND
                                                (matricula LIKE @matricula OR matricula IS NULL)
                                        GROUP BY E.codigo, E.descripcion, E.tipo";
                    SqlDataReader lectorEsp = Clases.BaseDeDatosSQL.ObtenerDataReader(queryEsp, "T", ListaParametros2);

                    while (lectorEsp.Read())
                    {
                        Especialidad unaEspecialidad = new Especialidad();
                        unaEspecialidad.Codigo = (decimal)lectorEsp["codigo"];
                        unaEspecialidad.Descripcion = (string)lectorEsp["descripcion"];
                        unaEspecialidad.Tipo_Especialidad = (decimal)lectorEsp["tipo"];

                        //MessageBox.Show("Profesional: "+ unProfesional.Apellido + ", Especialidad: " + unaEspecialidad.Descripcion, "Prueba", MessageBoxButtons.OK);

                        unProfesional.Especialidades.Add(unaEspecialidad);
                    }

                    Lista.Add(unProfesional);
                }
            }

            return Lista;
        }
        public static void ModificarProfesional(Profesional pro)
        {
            List<SqlParameter> ListaParametros = new List<SqlParameter>();
            ListaParametros.Add(new SqlParameter("@id", pro.Id));
            ListaParametros.Add(new SqlParameter("@sexo", pro.Sexo));
            ListaParametros.Add(new SqlParameter("@direccion", pro.Direccion));
            ListaParametros.Add(new SqlParameter("@telefono", (int)pro.Telefono));
            ListaParametros.Add(new SqlParameter("@mail", pro.Mail));
            ListaParametros.Add(new SqlParameter("@matricula", (int)pro.Matricula));

            SqlParameter paramRet = new SqlParameter("@ret", System.Data.SqlDbType.Decimal);
            paramRet.Direction = System.Data.ParameterDirection.Output;
            ListaParametros.Add(paramRet);

            decimal ret = Clases.BaseDeDatosSQL.ExecStoredProcedure("mario_killers.modificarProfesional", ListaParametros);

            foreach (Especialidad unaEsp in pro.Especialidades)
            {
                Especialidades.AgregarEspecialidadEnProfesional(pro.Id, unaEsp);
            }
        }
 //Mapea las especialidades de un profesional dado en la db al objeto
 private void mapearEspecialidades(Profesional profesional)
 {
     profesional.especialidades.Clear();
     using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
     {
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "SELECT Descripcion FROM BONDIOLA.Especialidad e " +
                           "INNER JOIN BONDIOLA.ProfesionalEspecialidad pe " +
                           "ON e.Id = pe.Especialidad_Id " +
                           "WHERE pe.Profesional_Id = @id";
         cmd.Parameters.AddWithValue("@id", profesional.id);
         conn.Open();
         SqlDataReader rdr = cmd.ExecuteReader();
         while (rdr.Read())
         {
             profesional.especialidades.Add(rdr[0].ToString());
         }
     }
 }
Beispiel #50
0
 public virtual Turno RegistrarAtencion(Profesional profesional, string nota = null)
 {
     MoverEstado(EventoTurno.Atender, profesional.Persona);
     Nota = nota;
     return this;
 }
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                unProfesional = (Profesional)grillaProfesionales.CurrentRow.DataBoundItem;

                if (Operacion == "Baja")
                {
                    Profesionales.EliminarProfesional(unProfesional.Id);
                    Limpiar();
                    MessageBox.Show("El profesional ha sido dado de baja correctamente", "Aviso", MessageBoxButtons.OK);
                }
                else
                {
                    if (Operacion == "Modificacion")
                    {
                        frmProfesional formProf = new frmProfesional();
                        formProf.Operacion = this.Operacion;
                        formProf.unProfesional = unProfesional;
                        formProf.listaVieja = unProfesional.Especialidades;
                        formProf.Show();
                    }
                    if (Operacion == "Seleccion")
                    {
                        try
                        {
                            Profesional profesional = (Profesional)grillaProfesionales.CurrentRow.DataBoundItem;
                            formLlegada.profesional = profesional;
                            formLlegada.especialidad = especialidad;
                            if (formLlegada.cargarGrilla())
                            {
                                formLlegada.Show();
                                this.Close();
                            }
                        }
                        catch { MessageBox.Show("Debe seleccionar algun profesional", "Error!", MessageBoxButtons.OK); }
                    }
                    if (Operacion == "Registrar Agenda")
                    {
                        frmRegistrarAgenda formAgenda = new frmRegistrarAgenda();
                        formAgenda.unProfesional = unProfesional;
                        formAgenda.Show();
                        this.Close();
                    }
                    if (Operacion == "Consultar Agenda")
                    {
                        lstSeleccionAgenda formAgenda = new lstSeleccionAgenda();
                        formAgenda.unProfesional = unProfesional;
                        formAgenda.Show();
                        this.Close();
                    }
                    if (Operacion == "Cancelar Dias")
                    {
                        frmCancelarDias frmCancel = new frmCancelarDias();
                        frmCancel.unProfesional = unProfesional;
                        frmCancel.Show();
                        this.Close();
                    }
                    if (Operacion == "Registrar Atencion")
                    {
                        lstSeleccionAfiliado formAfil = new lstSeleccionAfiliado();
                        formAfil.Operacion = "Seleccion";
                        formAfil.profesional = unProfesional;
                        formAfil.Show();
                        this.Close();
                    }
                }
            }
            catch
            {
                MessageBox.Show("No se selecciono ningun profesional", "Error!", MessageBoxButtons.OK);
            }
        }
 private void volvarAVistaRegistroLlegada(Profesional profesional)
 {
     (padre as RegistroLlegada).setearProfesional(profesional);
     AsistenteVistas.volverAPadreYCerrar(padre, this);
 }
 public static void modificarEspecialidades(Profesional profesional)
 {
     var form = new SelectorEspecialidades(profesional.especialidades);
     form.ShowDialog();
     profesional.especialidades = form.especialidades;
 }
        public static List<Profesional> ObtenerTodos()
        {
            List<Profesional> listaDeProfesionales = new List<Profesional>();

            List<SqlParameter> ListaParametros = new List<SqlParameter>();

            SqlDataReader lector = Clases.BaseDeDatosSQL.ObtenerDataReader("SELECT * FROM mario_killers.ProfesionalesABM", "T", ListaParametros);

            if (lector.HasRows)
            {
                while (lector.Read())
                {
                    Profesional unProfesional = new Profesional();
                    unProfesional.Id = (int)(decimal)lector["persona"];
                    unProfesional.Apellido = (string)lector["apellido"];
                    unProfesional.Nombre = (string)lector["nombre"];
                    unProfesional.Matricula = (int)(decimal)lector["matricula"];
                    unProfesional.NumeroDocumento = (decimal)lector["documento"];
                    unProfesional.FechaNacimiento = (DateTime)lector["fecha_nac"];
                    unProfesional.Direccion = (String)lector["direccion"];
                    unProfesional.TipoDocumento = (decimal)lector["tipo_doc"];
                    unProfesional.Sexo = (string)lector["sexo"];
                    unProfesional.Mail = (String)lector["mail"];
                    unProfesional.Telefono = (decimal)lector["telefono"];
                    listaDeProfesionales.Add(unProfesional);
                }
            }
            return listaDeProfesionales;
        }
Beispiel #55
0
 public virtual Turno RegistrarNota(Profesional profesional, string nota = null)
 {
     Nota += Environment.NewLine
         + new string('-', 32)
         + Environment.NewLine + nota;
     return this;
 }
        public bool updateProfesional(Profesional profesional)
        {
            using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
            using (TransactionScope ts = new TransactionScope())
            {
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = "BONDIOLA.updateProfesional";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id", profesional.id);
                cmd.Parameters.AddWithValue("@direccion", profesional.direccion);
                cmd.Parameters.AddWithValue("@mail", profesional.mail);
                cmd.Parameters.AddWithValue("@telefono", profesional.telefono);
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();

                    //Borrar especialidades viejas
                    SqlCommand cmdDel = conn.CreateCommand();
                    cmdDel.CommandText = "DELETE FROM BONDIOLA.ProfesionalEspecialidad WHERE Profesional_Id = @id";
                    cmdDel.Parameters.AddWithValue("@id", profesional.id);
                    cmdDel.ExecuteNonQuery();

                    foreach (var especialidad in profesional.especialidades)
                    {
                        SqlCommand cmdEsp = conn.CreateCommand();
                        cmdEsp.CommandType = CommandType.StoredProcedure;
                        cmdEsp.CommandText = "BONDIOLA.altaProfesionalEspecialidad";
                        cmdEsp.Parameters.AddWithValue("@idProfesional", profesional.id);
                        cmdEsp.Parameters.AddWithValue("@especialidad", especialidad);
                        cmdEsp.ExecuteNonQuery();
                    }
                    MessageBox.Show("Operación realizada con éxito.");
                    ts.Complete();
                }
                catch (SqlException ex)
                {
                    //TODO error mas copado
                    MessageBox.Show(ex.Message);
                    return false;
                }
            }
            return true;
        }
 //Mapea el profesional seleccionado a un objeto
 public void mapear(Profesional profesional, DataGridView dataGridView)
 {
     profesional.id = SQL.Instance.getSelectedIntParaColumna("Id", dataGridView);
     profesional.apellido = SQL.Instance.getSelectedStringParaColumna("Apellido", dataGridView);
     profesional.fechaDeNacimiento = SQL.Instance.getSelectedDateParaColumna("Fecha de Nacimiento", dataGridView);
     profesional.mail = SQL.Instance.getSelectedStringParaColumna("Mail", dataGridView);
     profesional.nombre = SQL.Instance.getSelectedStringParaColumna("Nombre", dataGridView);
     profesional.sexo = SQL.Instance.getSelectedStringParaColumna("Sexo", dataGridView)[0];
     profesional.telefono = SQL.Instance.getSelectedStringParaColumna("Telefono", dataGridView);
     profesional.tipoDeDocumento = SQL.Instance.getSelectedStringParaColumna("Tipo De Documento", dataGridView);
     profesional.numeroDeDocumento = SQL.Instance.getSelectedStringParaColumna("Numero De Documento", dataGridView);
     profesional.matricula = SQL.Instance.getSelectedStringParaColumna("Matricula", dataGridView);
     profesional.direccion = SQL.Instance.getSelectedStringParaColumna("Direccion", dataGridView);
     profesional.usuario = "XXX";
     profesional.contraseña = "XXX";
     mapearEspecialidades(profesional);
 }
 private void volverAVistaRegistrarResultado(Profesional profesional)
 {
     (padre as ListadoConsultas).setearProfesional(profesional);
     AsistenteVistas.volverAPadreYCerrar(padre, this);
 }
 private Profesional crearProfesional(int fila)
 {
     Profesional profesional = new Profesional();
     int index = grillaProfesionales.Columns["ID Medico"].Index;
     profesional.id = Convert.ToInt32(grillaProfesionales.Rows.SharedRow(fila).Cells[index].Value.ToString());
     index = grillaProfesionales.Columns["Direccion"].Index;
     profesional.direccion = grillaProfesionales.Rows.SharedRow(fila).Cells[index].Value.ToString();
     index = grillaProfesionales.Columns["Telefono"].Index;
     profesional.telefono = Convert.ToInt64(grillaProfesionales.Rows.SharedRow(fila).Cells[index].Value.ToString());
     index = grillaProfesionales.Columns["Mail"].Index;
     profesional.mail = grillaProfesionales.Rows.SharedRow(fila).Cells[index].Value.ToString();
     return profesional;
 }
Beispiel #60
0
        public static Turno CreateSobreTurno(DateTime fechaTurno, TimeSpan duracionTurno, Paciente paciente, Profesional profesional, Especialidad especialidad, Secretaria secretariaReservadoraTurno, Consultorio consultorio, Plan plan,String numeroAfiliado,Decimal coseguro, bool esTelefonico)
        {
            if (paciente == null) throw new ArgumentNullException("paciente");
            if (profesional == null) throw new ArgumentNullException("profesional");
            if (especialidad == null) throw new ArgumentNullException("especialidad");
            if (secretariaReservadoraTurno == null) throw new ArgumentNullException("secretariaReservadoraTurno");

            if (!profesional.Especialidades.Contains(especialidad))
                throw new ArgumentException(@"El Profesional seleccionado para el turno no atiende la Especialidad seleccionada", "especialidad");

            var turno = new Turno(secretariaReservadoraTurno.Persona)
            {
                FechaTurno = fechaTurno,
                DuracionTurno = duracionTurno,
                Paciente = paciente,
                Profesional = profesional,
                Especialidad = especialidad,
            //RM SE AGREGA DATOS DE LA FORMA DE PAGO AL TURNO
                Consultorio=consultorio,
                Plan = plan,
                NumeroAfiliado = numeroAfiliado,
                Coseguro = coseguro,
                EsTelefonico = esTelefonico,
                EsSobreTurno = true,
                EsObtenidoWeb = false
            };

            return turno;
        }