public static object registraSintoma(List<registros> sintomas, List<registros> catalizadore, String fechaRegistro, int minutos, int intensidad)
    {
        PacienteDao pd = new PacienteDao();
        SintomasDao sd = new SintomasDao();
        string usuarioActual = "";
         string userid ="";
        if (Thread.CurrentPrincipal.Identity.IsAuthenticated)
        {
            usuarioActual = Thread.CurrentPrincipal.Identity.Name;
            MembershipUser u = Membership.GetUser(usuarioActual);
            userid = u.ProviderUserKey.ToString();

        }
        //retorna el iddel episodio
        List<int> nuevo = new List<int>();
        foreach(var data in sintomas){
        nuevo.Add(data.ID);

        }
        var x = pd.sp_registrar_episodio_paciente(userid, intensidad, minutos);
        sd.registrarSintomasEpisodioPaciente(x, nuevo);
               return new
               {
                   status ="OK",

               };
    }
Ejemplo n.º 2
0
        private static void crearUsuario()
        {
            Paciente newP = new Paciente();
            newP.nombres_paciente = "fernando";
            newP.apellidos_paciente = "Pruebas Calima";
            newP.ident_paciente = "10889";
            newP.tipo_id = 1;
            newP.telefono_paciente = "318788545";
            newP.movil_paciente = "318788545";
            newP.direccion_paciente = "av siempre viva calle falsa 124";
            newP.genero_paciente = 2;

            newP.fecha_nacimiento = new DateTime(1987, 03, 6);
            PacienteDao pd = new PacienteDao();
            pd.registrarPacienteNuevo(newP);
        }
Ejemplo n.º 3
0
 private static void ObtenerPacientesIdentificacion()
 {
     PacienteDao pd = new PacienteDao();
     int totalregistros = 0;
     var re = pd.obtenerPacientes(0, 10, ref totalregistros,"1077845378");
 }
Ejemplo n.º 4
0
 private static void ObtenerPacientes()
 {
     PacienteDao pd = new PacienteDao();
     int totalregistros = 0;
     var re = pd.obtenerPacientes(0, 10, ref totalregistros);
 }
    public static object CrearUsuario(string Nombres, string Apellidos, int TIPO_IDENTIFICACION, string NUMERO_IDENTIFICACION,
        string Direccion, string telefono,
       string userName, string Email, string passwordQuestion, string SecurityAnswer)
    {
        string PERFILP = "PACIENTE";
        string Retorno = "";
        string status = "";
        MembershipUser a = Membership.GetUser(userName);

        string porEmail = string.Empty;
        porEmail = Membership.GetUserNameByEmail(Email);
        if (a == null && string.IsNullOrEmpty(porEmail))
        {
            #region ("Creacion")
            MembershipCreateStatus createStatus;
            MembershipUser newUser =
                       Membership.CreateUser(userName, NUMERO_IDENTIFICACION,
                                             Email, passwordQuestion,
                                             SecurityAnswer, true,
                                             out createStatus);

            switch (createStatus)
            {
                case MembershipCreateStatus.Success:
                    Roles.AddUserToRole(userName, PERFILP);

                    Paciente nuevoPaciente = new Paciente();
                    nuevoPaciente.nombres_paciente = Nombres;
                    nuevoPaciente.apellidos_paciente = Apellidos;
                    nuevoPaciente.ident_paciente = NUMERO_IDENTIFICACION;
                    nuevoPaciente.tipo_id = TIPO_IDENTIFICACION;
                    nuevoPaciente.genero_paciente = 2;

                    nuevoPaciente.direccion_paciente = Direccion;
                    nuevoPaciente.telefono_paciente = telefono;
                    nuevoPaciente.movil_paciente = telefono;
                    nuevoPaciente.mail_paciente = Email;
                    nuevoPaciente.userId = newUser.ProviderUserKey.ToString();
                    nuevoPaciente.fecha_nacimiento = DateTime.Now;

                    PacienteDao pd = new PacienteDao();
                    var nuevo = pd.registrarPacienteNuevo(nuevoPaciente);

                    var enviar = new Correos().EnviarEmailCreacionDeUsuario(Email);

                    status = "OK";
                    Retorno = "La cuenta del usuario, ha sido creada con exito";

                    break;

                case MembershipCreateStatus.DuplicateUserName:
                    status = "Existe";
                    Retorno = "Ya existe un usuario con ese nombre de usuario";
                    //CreateAccountResults.Text = "Ya existe un usuario con ese nombre de usuario";//"There already exists a user with this username.";
                    break;

                case MembershipCreateStatus.DuplicateEmail:
                    status = "Duplicado";
                    Retorno = "Ya existe un usuario con este email.";// "There already exists a user with this email address.";
                    break;

                case MembershipCreateStatus.InvalidEmail:
                    status = "email";
                    Retorno = "La dirección de correo electrónico que nos ha facilitado en inválida.";//"There email address you provided in invalid.";
                    break;

                case MembershipCreateStatus.InvalidPassword:
                    status = "password";
                    Retorno = "La contraseña que ha proporcionado no es válido. Debe ser de siete caracteres y tener al menos un carácter no alfanumérico.";//"The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character.";
                    break;

                default:
                    status = "Error";
                    Retorno = "Hubo un error desconocido, la cuenta de usuario no fue creado.";//"There was an unknown error; the user account was NOT created.";
                    break;
            }
            #endregion
        }
        else
        {
            if (a != null)
            {
                status = "Existe";
                Retorno = "El nombre de usuario ya existe.";
            }
            //        CreateAccountResults.Text = "El usuario ya existe";

            if (!string.IsNullOrEmpty(porEmail))
            {
                status = "EmailCambiar";
                Retorno = "Ingrese por favor una dirección de correo electrónico diferente.";
            }
        }
        return new
        {
            status = status,
            mensaje = Retorno
        };
    }
 public int registrarPacienteNuevo(Entity.Paciente pacienteNuevo)
 {
     PacienteDao pd = new PacienteDao();
     return pd.registrarPacienteNuevo(pacienteNuevo);
 }
        public List<Entity.Paciente> obtenerPacientes(int paginaActual, int TamanioPagina, ref int TotalRegistros, string NumeroIdentificacion)
        {
            PacienteDao pd = new PacienteDao();

            return pd.obtenerPacientes(paginaActual, TamanioPagina, ref TotalRegistros, NumeroIdentificacion);
        }
        public List<Entity.Paciente> obtenerPacientes(int paginaActual, int TamanioPagina, ref int TotalRegistros)
        {
            PacienteDao pd = new PacienteDao();

            return pd.obtenerPacientes(paginaActual, TamanioPagina, ref TotalRegistros);
        }
    private static GridData _getListListConPaginacion(int pageIndex, int pageSize, int pageCount, bool isSearch, string searchField, string searchString, string searchOper, string NumeroIdentificacion)
    {
        try
        {
            int totalRecords = 0;

            DaoPerfil perfilDao = new DaoPerfil();

            List<Paciente> resultado = new List<Paciente>();
            PacienteDao pd = new PacienteDao();
            if (string.IsNullOrWhiteSpace(NumeroIdentificacion))
            {
                resultado = pd.obtenerPacientes(pageIndex - 1, pageSize, ref totalRecords); ;
            }
            else
            {
                resultado = pd.obtenerPacientes(pageIndex - 1, pageSize, ref totalRecords, NumeroIdentificacion);

            }

            List<GridRow> listProcesos = new List<GridRow>();

            #region ("TOTAL==0")
            if (totalRecords == 0)
            {
                return new GridData
                {
                    page = pageIndex,
                    total = (int)Math.Ceiling((double)totalRecords / (double)pageSize),
                    records = totalRecords,
                    rows = new List<GridRow>(),
                    userMessage = "Se han cargado los datos con éxito.",
                    logMessage = "Carga satisfactoria...",
                    status = Status.OK
                };
            }
            #endregion
            else
            {
                //pageIndex,
                //pageSize, ref totalRecords, estado, banda, UID, plan, cliente);
                int id = 0;

                //foreach (var user in resultado)
                //{
                //    userList.Add(user);
                //}
                foreach (var proceso in resultado)
                {
                    id++;
                    listProcesos.Add(

          new GridRow()
          {
          id = proceso.id_paciente.ToString(),
          cell = new List<object>(){
                        proceso.id_paciente.ToString(),
                        proceso.nombres_paciente.ToString().ToUpper()+ " " + proceso.apellidos_paciente.ToString().ToUpper(),
                        proceso.ident_paciente,
                        proceso.mail_paciente,
                        proceso.movil_paciente,
                        }
          });
                }

            }

            /// Con la información de los procesos y de la consulta se ensambla el objeto GridData de respuesta.
            ///
            return new GridData
            {
                page = pageIndex,
                total = (int)Math.Ceiling((double)totalRecords / (double)pageSize),
                records = totalRecords,
                rows = listProcesos,
                userMessage = "Se han cargado los datos con éxito.",
                logMessage = "Carga satisfactoria...",
                status = Status.OK
            };

        }
        catch (Exception ex)
        {
            AppLog.Write(" Error consultando la informacion de Cities ", AppLog.LogMessageType.Error, ex, "IbMallsLog");

            return new GridData
            {
                page = pageIndex,
                total = default(int),
                records = default(int),
                rows = new List<GridRow>(),
                userMessage = "Se han cargado los datos con éxito.",
                logMessage = "Carga satisfactoria...",
                status = Status.OK_WITH_MESSAGES
            };
        }
    }
Ejemplo n.º 10
0
    private static GridData _getListListConPaginacion(int pageIndex, int pageSize, int pageCount, bool isSearch, string searchField, string searchString, string searchOper, string NumeroIdentificacion)
    {
        try
        {
            int totalRecords = 0;

            DaoPerfil perfilDao = new DaoPerfil();

            List<Paciente> resultado = new List<Paciente>();
            PacienteDao pd = new PacienteDao();

            WebRequest req = WebRequest.Create(@"https://lab-desplieguescc1.herokuapp.com/competitors");

            req.Method = "GET";

            string a = string.Empty;
            string[] arra;
            string[] arradatos;
            List<GridRow> listProcesos = new List<GridRow>();

            try
            {
                HttpWebRequest request = WebRequest.Create(@"https://lab-desplieguescc1.herokuapp.com/competitors") as HttpWebRequest;
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(List<Response>));
                    object objResponse = jsonSerializer.ReadObject(response.GetResponseStream());
                    List<Response> jsonResponse = objResponse as List<Response>;

                    foreach (var proceso in jsonResponse)
                    {

                        listProcesos.Add(

                        new GridRow()
                        {
                        id = proceso.id.ToString(),
                        cell = new List<object>(){
                        proceso.id.ToString(),
                        proceso.surname.ToString().ToUpper(),
                        proceso.telephone,
                        proceso.winner,
                        proceso.country,
                        }
                        });
                    }

                    totalRecords =jsonResponse.Count();

                    ///
                        return new GridData
                        {
                            page = pageIndex,
                            total = (int)Math.Ceiling((double)totalRecords / (double)pageSize),
                            records = totalRecords,
                            rows = listProcesos,
                            userMessage = "Se han cargado los datos con éxito.",
                            logMessage = "Carga satisfactoria...",
                            status = Status.OK
                        };

                }
            }

            catch (Exception e)
            {

            }

                //DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(Response));
                //var objResponse = jsonSerializer.ReadObject(resp.GetResponseStream());
                //Response jsonResponse                 = objResponse as Response;

                //using (var respStream = resp.GetResponseStream())
                //{
                //    StreamReader reader = new StreamReader(respStream, Encoding.UTF8);

                //    a = reader.ReadToEnd();

                //    arra = a.Split('}');

                //}
                //foreach (var data in arra)
                //{

            if (string.IsNullOrWhiteSpace(NumeroIdentificacion))
            {
                resultado = pd.obtenerPacientes(pageIndex - 1, pageSize, ref totalRecords); ;
            }
            else
            {
                resultado = pd.obtenerPacientes(pageIndex - 1, pageSize, ref totalRecords, NumeroIdentificacion);

            }

            #region ("TOTAL==0")
            if (totalRecords == 0)
            {
                return new GridData
                {
                    page = pageIndex,
                    total = (int)Math.Ceiling((double)totalRecords / (double)pageSize),
                    records = totalRecords,
                    rows = new List<GridRow>(),
                    userMessage = "Se han cargado los datos con éxito.",
                    logMessage = "Carga satisfactoria...",
                    status = Status.OK
                };
            }
            #endregion
            else
            {
                //pageIndex,
                //pageSize, ref totalRecords, estado, banda, UID, plan, cliente);
                int id = 0;

                //foreach (var user in resultado)
                //{
                //    userList.Add(user);
                //}
                foreach (var proceso in resultado)
                {
                    id++;
                    listProcesos.Add(

          new GridRow()
          {
          id = proceso.id_paciente.ToString(),
          cell = new List<object>(){
                        proceso.id_paciente.ToString(),
                        proceso.nombres_paciente.ToString().ToUpper()+ " " + proceso.apellidos_paciente.ToString().ToUpper(),
                        proceso.ident_paciente,
                        proceso.mail_paciente,
                        proceso.movil_paciente,
                        }
          });
                }

            }

            /// Con la información de los procesos y de la consulta se ensambla el objeto GridData de respuesta.
            ///
            return new GridData
            {
                page = pageIndex,
                total = (int)Math.Ceiling((double)totalRecords / (double)pageSize),
                records = totalRecords,
                rows = listProcesos,
                userMessage = "Se han cargado los datos con éxito.",
                logMessage = "Carga satisfactoria...",
                status = Status.OK
            };

        }
        catch (Exception ex)
        {
            AppLog.Write(" Error consultando la informacion de Cities ", AppLog.LogMessageType.Error, ex, "IbMallsLog");

            return new GridData
            {
                page = pageIndex,
                total = default(int),
                records = default(int),
                rows = new List<GridRow>(),
                userMessage = "Se han cargado los datos con éxito.",
                logMessage = "Carga satisfactoria...",
                status = Status.OK_WITH_MESSAGES
            };
        }
    }