Esempio n. 1
0
        public DataTable mostrarcitasdoc(Ucitas datos)
        {
            Udatatable datatable = new Udatatable();
            DateTime   thisDay   = DateTime.Today;
            DataTable  data      = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            var cita = (from c in conect.Citas
                        join p in conect.Usuarios/*tengo que preguntarle al profe no se porque join error*/
                        on c.PacienteId equals p.IdUsuario
                        where (c.HoraInicio >= thisDay) &&
                        (c.HoraFin >= thisDay) &&
                        (c.Estado == 1) &&
                        (c.DoctorId == int.Parse(datos.Iddoctor))
                        orderby c.HoraInicio
                        select new
            {
                c.HoraInicio,
                c.HoraFin,
                p.Nombre,
                p.Apellido,
                c.DoctorId,
                c.IdCita,
            }).ToList();

            data = datatable.ToDataTable(cita);
            return(data);
        }
Esempio n. 2
0
        public void insertar_doctor(Udoctor data)
        {
            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario user = new Medicapp13Context.Usuario();
            user.Username     = data.Username;
            user.Clave        = data.Clave;
            user.Nombre       = data.Nombre;
            user.Apellido     = data.Apellido;
            user.Edad         = data.Edad;
            user.Especialidad = data.Especialidad;
            user.Estudios     = data.Estudios;
            user.Estado       = int.Parse(data.Estado);
            user.Correo       = data.Correo;
            user.Documento    = Convert.ToString(data.Documento);
            user.Imagen       = data.Foto;
            conect.Usuarios.InsertOnSubmit(user);
            conect.SubmitChanges();

            List <Medicapp13Context.Usuario> us = conect.Usuarios.Where(x => x.Username == data.Username).ToList <Medicapp13Context.Usuario>();
            DataTable  datat     = new DataTable();
            Udatatable datatable = new Udatatable();

            datat = datatable.ToDataTable(us);

            Medicapp13Context.Sessione sesion = new Medicapp13Context.Sessione();
            sesion.Iduser = int.Parse(datat.Rows[0]["IdUsuario"].ToString());
            conect.Sessiones.InsertOnSubmit(sesion);
            conect.SubmitChanges();
        }
Esempio n. 3
0
        public DataTable buscarcitasD(Ucitas datos)
        {
            DataTable  datatable = new DataTable();
            Udatatable data      = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            var cita = (from c in conect.Citas
                        join u in conect.Usuarios
                        on c.DoctorId equals u.IdUsuario
                        where (c.HoraInicio.Value.Date == datos.Fechacita.Date) &&
                        (c.Estado == 0) &&
                        (datos.Fechacita.Date > DateTime.Today)
                        select new
            {
                c.IdCita,
                c.Tipo,
                u.Nombre,
                u.Apellido,
                c.HoraInicio,
                c.HoraFin
            }).ToList();

            datatable = data.ToDataTable(cita);
            return(datatable);
        }
Esempio n. 4
0
        public void guarda_paciente(UUsuario datos)
        /*carga los datos del paciente en la base de datos*/
        {
            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario user = new Medicapp13Context.Usuario();
            user.Username            = datos.Username;
            user.Clave               = datos.Clave;
            user.Nombre              = datos.Nombre;
            user.Apellido            = datos.Apellido;
            user.Edad                = datos.Edad;
            user.TipoDeSangre        = datos.Tipo_de_sangre;
            user.Correo              = datos.Correo;
            user.Documento           = datos.Documento;
            user.FechaDeUltimoExamen = Convert.ToDateTime(datos.Fechaexamen);
            user.Imagen              = datos.Foto;
            conect.Usuarios.InsertOnSubmit(user);
            conect.SubmitChanges();

            List <Medicapp13Context.Usuario> us = conect.Usuarios.Where(x => x.Username == datos.Username).ToList <Medicapp13Context.Usuario>();
            DataTable  data      = new DataTable();
            Udatatable datatable = new Udatatable();

            data = datatable.ToDataTable(us);

            Medicapp13Context.Sessione sesion = new Medicapp13Context.Sessione();
            sesion.Iduser = int.Parse(data.Rows[0]["IdUsuario"].ToString());
            conect.Sessiones.InsertOnSubmit(sesion);
            conect.SubmitChanges();
        }
Esempio n. 5
0
        public DataTable mostrarcitasseparadas(Ucitas datos)
        {
            Udatatable data      = new Udatatable();
            DataTable  datatable = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            DateTime hoy            = DateTime.Today;
            DateTime masdos         = hoy.AddDays(2);
            var      citasseparadas = (from c in conect.Citas
                                       join u in conect.Usuarios
                                       on c.DoctorId equals u.IdUsuario
                                       where (c.PacienteId == datos.Idpaciente) && (c.Estado == 1) && (c.HoraInicio.Value.Date > masdos)
                                       select new
            {
                c.IdCita,
                c.Tipo,
                c.HoraInicio,
                c.HoraFin,
                c.Diagnostico,
                u.Nombre,
                u.Apellido
            }).ToList();

            datatable = data.ToDataTable(citasseparadas);
            return(datatable);
        }
Esempio n. 6
0
        public DataTable verificarCita(Ucitas datos)
        {
            DataTable  datatable = new DataTable();
            Udatatable data      = new Udatatable();

            Medicapp13Context.Medicapp13DataContext   conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.VerificacitaView> cita   = conect.FVerificarCita(int.Parse(datos.Idcita), datos.Idpaciente).ToList <Medicapp13Context.VerificacitaView>();

            datatable = data.ToDataTable(cita);
            return(datatable);
        }
Esempio n. 7
0
        public DataTable verificarusuario(Udoctor datos)
        {
            DataTable  data      = new DataTable();
            Udatatable datatable = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.Usuario>        doc    = conect.Usuarios.Where(x => x.Username == datos.Username).ToList <Medicapp13Context.Usuario>();

            data = datatable.ToDataTable(doc);
            return(data);
        }
Esempio n. 8
0
        public DataTable obtenerDoctores()
        {
            Udatatable data     = new Udatatable();
            DataTable  doctores = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.Usuario>        doctor = conect.Usuarios.Where(x => x.IdRol == 3 && x.Estado == 1).ToList <Medicapp13Context.Usuario>();

            doctores = data.ToDataTable(doctor);
            return(doctores);
        }
Esempio n. 9
0
        public DataTable obtenerdoc(Udoctor datos)
        {
            Udatatable datatable = new Udatatable();
            DataTable  data      = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.Usuario>        user   = conect.Usuarios.Where(x => x.IdUsuario == datos.Id_usuario).ToList <Medicapp13Context.Usuario>();

            data = datatable.ToDataTable(user);
            return(data);
        }
Esempio n. 10
0
        public DataTable mostrarhorario(Uhorario datos)
        {
            DataTable  data      = new DataTable();
            Udatatable datatable = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            var horario = conect.FBuscaHorario(int.Parse(datos.Iddoctor)).ToList();

            data = datatable.ToDataTable(horario);
            return(data);
        }
Esempio n. 11
0
        public DataTable allusuarios()
        {
            Udatatable data = new Udatatable();
            DataTable  user = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario        usuarios      = new Medicapp13Context.Usuario();
            List <Medicapp13Context.Usuario> users         = conect.Usuarios.ToList <Medicapp13Context.Usuario>();

            user = data.ToDataTable(users);
            return(user);
        }
Esempio n. 12
0
        public DataTable mostrarDoctoresPrincipal()
        //metodo para mostrar doctores en la pagina principal esto es para el datalist
        {
            Udatatable data     = new Udatatable();
            DataTable  doctores = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.Usuario>        doctor = conect.Usuarios.Where(x => x.IdRol == 3 && x.Estado == 1).ToList <Medicapp13Context.Usuario>();

            doctores = data.ToDataTable(doctor);
            return(doctores);
        }
Esempio n. 13
0
        public DataTable mostrarparametrizacion()
        {
            DataTable parametriza = new DataTable();

            Medicapp13Context.Medicapp13DataContext  conect    = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Parametrizacion        para      = new Medicapp13Context.Parametrizacion();
            List <Medicapp13Context.Parametrizacion> paramelis = conect.Parametrizacions.ToList <Medicapp13Context.Parametrizacion>();
            Udatatable data = new Udatatable();

            parametriza = data.ToDataTable(paramelis);
            return(parametriza);
        }
Esempio n. 14
0
        public DataTable buscarUsuariosid(UUsuario datos)
        {
            Udatatable data = new Udatatable();
            DataTable  user = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario        usuario       = new Medicapp13Context.Usuario();
            List <Medicapp13Context.Usuario> userid        = conect.Usuarios.Where(x => x.IdUsuario == datos.Id_usuario).ToList <Medicapp13Context.Usuario>();

            user = data.ToDataTable(userid);
            return(user);
        }
Esempio n. 15
0
        public DataTable login(UUsuario datos)
        {
            DataTable  data      = new DataTable();
            Udatatable datatable = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            List <Medicapp13Context.UserLogginView> user   = conect.FLoggin(datos.Username, datos.Clave, datos.Ip, datos.Mac).ToList <Medicapp13Context.UserLogginView>();

            data = datatable.ToDataTable(user);
            conect.SubmitChanges();
            return(data);
        }
Esempio n. 16
0
        public DataTable buscarhojavida(Uhojavida datos)
        {
            DataTable hv = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect   = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.HojaDeVida            hojavida = new Medicapp13Context.HojaDeVida();
            List <Medicapp13Context.HojaDeVida>     hoja     = conect.HojaDeVidas.Where(x => x.IdDoctor == int.Parse(datos.Id_doctor)).ToList <Medicapp13Context.HojaDeVida>();
            Udatatable data = new Udatatable();

            hv = data.ToDataTable(hoja);
            return(hv);
        }
Esempio n. 17
0
        public DataTable verificarusuario(UUsuario encap)
        /* verifica que no exista el nombre de usuario en base de datos para que no s e presenten problemas de usernames duplicadod*/
        {
            Udatatable data     = new Udatatable();
            DataTable  verifica = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario        user          = new Medicapp13Context.Usuario();
            List <Medicapp13Context.Usuario> usuario       = conect.Usuarios.Where(x => x.Username == encap.Username).ToList <Medicapp13Context.Usuario>();

            verifica = data.ToDataTable(usuario);
            return(verifica);
        }
Esempio n. 18
0
        public DataTable mostrarmedicinas()
        {
            DataTable medicina = new DataTable();

            Medicapp13Context.Medicapp13DataContext conec = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Medicina        medicinas   = new Medicapp13Context.Medicina();
            List <Medicapp13Context.Medicina> med         = conec.Medicinas.ToList <Medicapp13Context.Medicina>();
            Udatatable data = new Udatatable();

            medicina = data.ToDataTable(med);

            return(medicina);
        }
Esempio n. 19
0
        public DataTable mostrarHV(int id_doctor)
        /*metodo de victor que tengo que saber  de que es porque nose y lo tenia en otra clase a la que no pertencia*/
        {
            Udatatable data = new Udatatable();
            DataTable  hoja = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect   = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.HojaDeVida            hojavida = new Medicapp13Context.HojaDeVida();
            List <Medicapp13Context.HojaDeVida>     hv       = conect.HojaDeVidas.Where(x => x.IdDoctor == id_doctor).ToList <Medicapp13Context.HojaDeVida>();

            hoja = data.ToDataTable(hv);
            return(hoja);
        }
Esempio n. 20
0
        public DataTable mostraralergiasAdmon()
        {
            DataTable alergias = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Alergia        alergia       = new Medicapp13Context.Alergia();
            List <Medicapp13Context.Alergia> aler          = conect.Alergias.ToList <Medicapp13Context.Alergia>();
            Udatatable data = new Udatatable();

            alergias = data.ToDataTable(aler);

            return(alergias);
        }
Esempio n. 21
0
        public DataTable obtenerfechas()
        {
            DataTable  data      = new DataTable();
            Udatatable datatable = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            var fecha = (from c in conect.Citas
                         where (c.Estado == 0) &&
                         (c.HoraInicio > DateTime.Today.Date)
                         select c.HoraInicio).ToList();

            data = datatable.ToDataTable(fecha);
            return(data);
        }
Esempio n. 22
0
        public DataTable modificarUsuariosid(UUsuario datos)
        {
            DataTable  user = new DataTable();
            Udatatable data = new Udatatable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            Medicapp13Context.Usuario usuario = conect.Usuarios.Single(x => x.IdUsuario == datos.Id_usuario);
            usuario.Nombre   = datos.Nombre;
            usuario.Apellido = datos.Apellido;
            usuario.Clave    = datos.Clave;
            usuario.Edad     = datos.Edad;
            conect.SubmitChanges();
            List <Medicapp13Context.Usuario> lista = conect.Usuarios.Where(x => x.IdUsuario == datos.Id_usuario).ToList <Medicapp13Context.Usuario>();

            user = data.ToDataTable(lista);
            return(user);
        }
Esempio n. 23
0
        public DataTable buscarcitaid(Ucitas datos)
        {
            Udatatable data = new Udatatable();
            DataTable  cita = new DataTable();

            Medicapp13Context.Medicapp13DataContext conect = new Medicapp13Context.Medicapp13DataContext();
            var citasseparadas = (from c in conect.Citas
                                  join u in conect.Usuarios
                                  on c.DoctorId equals u.IdUsuario
                                  where (c.PacienteId == datos.Idpaciente)
                                  select new
            {
                c.IdCita,
                c.Tipo,
                c.HoraInicio,
                c.HoraFin,
                c.Diagnostico,
                u.Nombre,
                u.Apellido
            }).ToList();

            cita = data.ToDataTable(citasseparadas);
            return(cita);
        }