Ejemplo n.º 1
0
 public bool TieneDeudaPendiente(Prestamo prestamo)
 {
     string consultaSQL = "select estado from cuota where prestamoID ='" + prestamo.PrestamoID + "'";
     SqlDataReader resultadoSQL = gestorDAO.EjecutarConsulta(consultaSQL);
     string estado;
     bool tieneDeuda = true;
     while (resultadoSQL.Read())
     {
         estado = resultadoSQL["estado"].ToString();
         if (estado != "Pagado")
         {
             tieneDeuda = false;
         }
     }
     return tieneDeuda;
 }
Ejemplo n.º 2
0
        public Cliente Buscar(string dni)
        {
            Cliente cliente;
            string  consultaSQL = "select * from cliente where dni ='" + dni + "'";

            try
            {
                SqlDataReader resultadoSQL = gestorDAO.EjecutarConsulta(consultaSQL);
                if (resultadoSQL.Read())
                {
                    cliente = ObtenerCliente(resultadoSQL);
                }
                else
                {
                    throw new Exception("No existe el Cliente");
                }
            }
            catch (Exception err)
            {
                throw err;
            }
            return(cliente);
        }
Ejemplo n.º 3
0
        public string GenerarPagoID()
        {
            string pagoID = "";
            int    total  = 0;

            try
            {
                string        consultaSQL  = "Select count (*) from Pago";
                SqlDataReader resultadoSQL = gestorDAO.EjecutarConsulta(consultaSQL);
                if (resultadoSQL.Read())
                {
                    total = int.Parse(resultadoSQL.GetString(0));
                }
                resultadoSQL.Close();
                if (total < 10)
                {
                    pagoID = "PAGO-0000" + total;
                }
                if (total < 100)
                {
                    pagoID = "PAGO-000" + total;
                }
                if (total < 1000)
                {
                    pagoID = "PAGO-00" + total;
                }
                if (total < 10000)
                {
                    pagoID = "PAGO-0" + total;
                }
            }
            catch (Exception err)
            {
                throw new Exception("Hubo un error al generar el pagoID", err);
            }
            return(pagoID);
        }