Beispiel #1
0
        public int AgregarDieta(string CorreoCliente, string FechaDieta, string CodigoHarris, string Objetivo)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;

            int i;

            sql_command = method.GetCommand();



            sql_command.Parameters.Add("@CorreoCliente", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@FechaDieta", SqlDbType.DateTime);
            sql_command.Parameters.Add("@CodigoHarris", SqlDbType.Int);
            sql_command.Parameters.Add("@Objetivo", SqlDbType.NVarChar);



            sql_command.CommandText = "INSERT INTO Dieta Values(@CorreoCliente, @FechaDieta, @CodigoHarris, @Objetivo)";

            sql_command.Parameters[0].Value = CorreoCliente;
            sql_command.Parameters[1].Value = FechaDieta;
            sql_command.Parameters[2].Value = CodigoHarris;
            sql_command.Parameters[3].Value = Objetivo;


            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #2
0
        public int AgregarRegistroHarris(string FactorActividad, string TMB, string NivelCalorico, string fecha, string correo)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;

            int i;

            sql_command = method.GetCommand();



            sql_command.Parameters.Add("@FactorActividad", SqlDbType.Float);
            sql_command.Parameters.Add("@TMB", SqlDbType.Float);
            sql_command.Parameters.Add("@NivelCalorico", SqlDbType.Float);
            sql_command.Parameters.Add("@FechaHarris", SqlDbType.DateTime);
            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);



            sql_command.CommandText = "INSERT INTO HarrisBen Values(@FactorActividad, @TMB, @NivelCalorico, @FechaHarris, @Correo)";

            sql_command.Parameters[0].Value = FactorActividad;
            sql_command.Parameters[1].Value = TMB;
            sql_command.Parameters[2].Value = NivelCalorico;
            sql_command.Parameters[3].Value = fecha;
            sql_command.Parameters[4].Value = correo;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #3
0
        public int AgregarMedidas(string FechaMedida, string CorreoCliente, string BicepIzquierdo, string BicepDerecho, string Abdomen, string CuadricepIzquierdo, string CuadricepDerecho, string PantorrillaIzquierda, string PantorrillaDerecha)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;
            int          i;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@FechaMedida", SqlDbType.DateTime);
            sql_command.Parameters.Add("@CorreoCliente", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@BicepIzquierdo", SqlDbType.Float);
            sql_command.Parameters.Add("@BicepDerecho", SqlDbType.Float);
            sql_command.Parameters.Add("@Abdomen", SqlDbType.Float);
            sql_command.Parameters.Add("@CuadricepIzquierdo", SqlDbType.Float);
            sql_command.Parameters.Add("@CuadricepDerecho", SqlDbType.Float);
            sql_command.Parameters.Add("@PantorrillaIzquierda", SqlDbType.Float);
            sql_command.Parameters.Add("@PantorrillaDerecha", SqlDbType.Float);

            sql_command.CommandText = "INSERT INTO Medida Values(@FechaMedida,@CorreoCliente, @BicepIzquierdo, @BicepDerecho, @Abdomen, @CuadricepIzquierdo, @CuadricepDerecho, @PantorrillaIzquierda, @PantorrillaDerecha)";

            sql_command.Parameters[0].Value = FechaMedida;
            sql_command.Parameters[1].Value = CorreoCliente;
            sql_command.Parameters[2].Value = BicepIzquierdo;
            sql_command.Parameters[3].Value = BicepDerecho;
            sql_command.Parameters[4].Value = Abdomen;
            sql_command.Parameters[5].Value = CuadricepIzquierdo;
            sql_command.Parameters[6].Value = CuadricepDerecho;
            sql_command.Parameters[7].Value = PantorrillaIzquierda;
            sql_command.Parameters[8].Value = PantorrillaDerecha;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #4
0
        public int CrearUsuario(string correo, string cedula, string nombre, string apellido1, string apellido2, string genero, string contraseña)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;

            int i;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Cedula", SqlDbType.Int);
            sql_command.Parameters.Add("@Nombre", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Apellido1", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Apellido2", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Genero", SqlDbType.Bit);
            sql_command.Parameters.Add("@Contraseña", SqlDbType.NVarChar);

            sql_command.CommandText = "INSERT INTO Persona Values(@Correo,@Cedula,@Nombre,@Apellido1,@Apellido2,@Genero,@Contraseña)";

            sql_command.Parameters[0].Value = correo;
            sql_command.Parameters[1].Value = cedula;
            sql_command.Parameters[2].Value = nombre;
            sql_command.Parameters[3].Value = apellido1;
            sql_command.Parameters[4].Value = apellido2;
            sql_command.Parameters[5].Value = Convert.ToInt16(genero);
            sql_command.Parameters[6].Value = contraseña;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #5
0
        public int ActualizarDatosCliente(string Correo, string Peso, string Altura, string Edad, string IMC, string Agua, string Fecha)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;

            int i;

            sql_command = method.GetCommand();



            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Peso", SqlDbType.Float);
            sql_command.Parameters.Add("@Altura", SqlDbType.Int);
            sql_command.Parameters.Add("@Edad", SqlDbType.Int);
            sql_command.Parameters.Add("@IMC", SqlDbType.Float);
            sql_command.Parameters.Add("@Agua", SqlDbType.Int);
            sql_command.Parameters.Add("@Fecha", SqlDbType.DateTime);


            sql_command.CommandText = "UPDATE Cliente SET Peso = @Peso, Altura = @Altura, Edad = @Edad, IMC = @IMC, CantidadAgua = @Agua WHERE Correo = @Correo AND FechaDatos = @Fecha";

            sql_command.Parameters[0].Value = Correo;
            sql_command.Parameters[1].Value = Peso;
            sql_command.Parameters[2].Value = Altura;
            sql_command.Parameters[3].Value = Edad;
            sql_command.Parameters[4].Value = IMC;
            sql_command.Parameters[5].Value = Agua;
            sql_command.Parameters[6].Value = Fecha;


            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #6
0
        public int AgregarDatosCliente(string Correo, string Peso, string Altura, string Edad, string IMC, string Agua, string Fecha)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;

            int i;

            sql_command = method.GetCommand();



            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Peso", SqlDbType.Float);
            sql_command.Parameters.Add("@Altura", SqlDbType.Int);
            sql_command.Parameters.Add("@Edad", SqlDbType.Int);
            sql_command.Parameters.Add("@IMC", SqlDbType.Float);
            sql_command.Parameters.Add("@Agua", SqlDbType.Int);
            sql_command.Parameters.Add("@Fecha", SqlDbType.DateTime);


            sql_command.CommandText = "INSERT INTO Cliente Values(@Correo, @Peso, @Altura, @Edad, @IMC, @Agua, @Fecha)";

            sql_command.Parameters[0].Value = Correo;
            sql_command.Parameters[1].Value = Peso;
            sql_command.Parameters[2].Value = Altura;
            sql_command.Parameters[3].Value = Edad;
            sql_command.Parameters[4].Value = IMC;
            sql_command.Parameters[5].Value = Agua;
            sql_command.Parameters[6].Value = Fecha;


            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #7
0
        public DataTable ObtenerCatalogoAlimentos()
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.CommandText = "SELECT * FROM CatalogoAlimentos";

            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #8
0
        public int EliminarUsuario(string Correo)
        {
            metodo_datos method = new metodo_datos();
            int          i;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.CommandText         = "Delete from Persona Where Correo = @Correo";
            sql_command.Parameters[0].Value = Correo;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #9
0
        public DataTable ObtenerUltimaMedida(string CorreoCliente)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.CommandText         = "Select Max(FechaMedida) as UltimaMedida from Medida Where CorreoCliente = @Correo";
            sql_command.Parameters[0].Value = CorreoCliente;

            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #10
0
        public DataTable BuscarUsuarioTodo(string Correo)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.CommandText         = "SELECT * FROM Persona WHERE Correo = @Correo";
            sql_command.Parameters[0].Value = Correo;

            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #11
0
        public DataTable ObtenerMedicionCompleta(string CodigoMedida)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;
            DataTable    table;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@CodigoMedida", SqlDbType.Int);
            sql_command.CommandText = "SELECT medicion.BicepIzquierdo, medicion.BicepDerecho, medicion.Abdomen, medicion.CuadricepIzquierdo," +
                                      "medicion.CuadricepDerecho, medicion.PantorrillaIzquierda, " +
                                      "medicion.PantorrillaDerecha FROM Medida AS medicion WHERE CodigoMedida =  @CodigoMedida";
            sql_command.Parameters[0].Value = CodigoMedida;
            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #12
0
        public DataTable BuscarUltimoRegistroHarris(string correo)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.CommandText         = "Select Max(FechaHarris) as UltimoRegistro from HarrisBen Where Correo = @Correo";
            sql_command.Parameters[0].Value = correo;


            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #13
0
        public int CambiarContraseña(string Correo, string Contraseña)
        {
            metodo_datos method = new metodo_datos();
            int          i;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("Contraseña", SqlDbType.NVarChar);
            sql_command.CommandText         = "UPDATE Persona set Contraseña = @Contraseña WHERE Correo = @Correo";
            sql_command.Parameters[0].Value = Correo;
            sql_command.Parameters[0].Value = Contraseña;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #14
0
        public DataTable ObtenerMedida(string CorreoCliente, string FechaDieta)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Fecha", SqlDbType.DateTime);
            sql_command.CommandText         = "SELECT * FROM Medida WHERE CorreoCliente = @Correo AND FechaMedida = @Fecha";
            sql_command.Parameters[0].Value = CorreoCliente;
            sql_command.Parameters[1].Value = FechaDieta;

            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #15
0
        public DataTable ObtenerDietaCompleta(string CorreoCliente, string CodigoDieta)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@CorreoCliente", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@CodigoDieta", SqlDbType.Int);
            sql_command.CommandText = "EXEC GetDieta @CorreoCliente, @CodigoDieta";

            sql_command.Parameters[0].Value = CorreoCliente;
            sql_command.Parameters[1].Value = CodigoDieta;

            table = method.ExecSearch(sql_command);
            return(table);
        }
Beispiel #16
0
        public int AgregarRelacion(string CodigoDieta, string CodigoAlimento)
        {
            metodo_datos method = new metodo_datos();
            SqlCommand   sql_command;
            int          i;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@CodigoDieta", SqlDbType.Int);
            sql_command.Parameters.Add("@CodigoAlimento", SqlDbType.Int);

            sql_command.CommandText         = "INSERT INTO RelacionAlimentos Values(@CodigoDieta, @CodigoAlimento)";
            sql_command.Parameters[0].Value = CodigoDieta;
            sql_command.Parameters[1].Value = CodigoAlimento;

            i = method.ExecCommand(sql_command);
            return(i);
        }
Beispiel #17
0
        public DataTable BuscarRegistroHarris(string correo, string fecha)
        {
            metodo_datos method = new metodo_datos();
            DataTable    table;
            SqlCommand   sql_command;

            sql_command = method.GetCommand();

            sql_command.Parameters.Add("@Correo", SqlDbType.NVarChar);
            sql_command.Parameters.Add("@Fecha", SqlDbType.DateTime);

            sql_command.CommandText         = "SELECT * FROM HarrisBen where Correo = @Correo and FechaHarris = @Fecha";
            sql_command.Parameters[0].Value = correo;
            sql_command.Parameters[1].Value = fecha;


            table = method.ExecSearch(sql_command);
            return(table);
        }