Exemplo n.º 1
0
 public DataTable GetTable(int id)
 {
     try
     {
         var modelodc = new ModeloDatosxCita();
         return(modelodc.GetTable(id));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 2
0
 public int ObtenerId(int id, DateTime date)
 {
     try
     {
         var modelodc = new ModeloDatosxCita();
         return(modelodc.ObtenerId(id, date));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 3
0
 public void EliminarDatosCita(int id, int idCita)
 {
     try
     {
         var modelodc = new ModeloDatosxCita();
         modelodc.EliminarDatosCita(id, idCita);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 4
0
        public void AgregarDatosCita(string grasaVis, string CMB, string cirCad, string bodyAge, string cirCin, string musculoPorc, string grasaPorc, string IMC, string peso, DateTime fecha, int id)
        {
            var validac = new Validacion();

            if (validac.Longitud(grasaVis, 1, 5) && validac.Longitud(CMB, 1, 5) && validac.Longitud(cirCad, 1, 5) && validac.Longitud(bodyAge, 1, 3) && validac.Longitud(cirCin, 1, 5) && validac.Longitud(musculoPorc, 1, 3) && validac.Longitud(grasaPorc, 1, 3) && validac.Longitud(IMC, 1, 5) && validac.Longitud(peso, 1, 5))
            {
                if (validac.MayorA(Convert.ToInt32(grasaVis), 0) && validac.MayorA(Convert.ToInt32(CMB), 0) && validac.MayorA(Convert.ToInt32(cirCad), 0) && validac.MayorA(Convert.ToInt32(bodyAge), 0) && validac.MayorA(Convert.ToInt32(cirCin), 0) && validac.MayorA(Convert.ToInt32(musculoPorc), 0) && validac.MayorA(Convert.ToInt32(grasaPorc), 0) && validac.MayorA(Convert.ToInt32(IMC), 0) && validac.MayorA(Convert.ToInt32(peso), 0))
                {
                    if (validac.MenorA(Convert.ToInt32(peso), 801) && validac.MenorA(Convert.ToInt32(grasaPorc), 101) && validac.MenorA(Convert.ToInt32(musculoPorc), 101) && validac.MenorA(Convert.ToInt32(bodyAge), 101))
                    {
                        if (validac.FechaMayorIgualA(fecha, DateTime.Today))
                        {
                            try
                            {
                                var modelodc = new ModeloDatosxCita();
                                modelodc.AgregarDatosCita(grasaVis, CMB, cirCad, bodyAge, cirCin, musculoPorc, grasaPorc, IMC, peso, fecha, id);
                            }
                            catch (Exception ex)
                            {
                                throw new Exception(ex.Message);
                            }
                        }
                        else
                        {
                            error = "Fecha invalida";
                            return;
                        }
                    }
                    else
                    {
                        error = "Alguna cantidad paso el rango establecido";
                        return;
                    }
                }
                else
                {
                    error = "Las cantidades deben ser mayor a cero";
                    return;
                }
            }
            else
            {
                error = "Los campos con * no deben estar vacios";
                return;
            }
        }