Exemple #1
0
        public int DiasAtrasoUltimaSolicitud(int idEjemplar)
        {
            try
            {
                Biblioteca.DALC.PRESTAMO pres = CommonBC.ModeloBiblioteca.PRESTAMO.Where
                                                    (e => e.EJEMPLAR_IDEJEMPLAR == idEjemplar).OrderByDescending(p => p.FECHADEVOLUCIONREALPRESTAMO).First();

                if (pres.FECHADEVOLUCIONREALPRESTAMO > pres.FECHADEVOLUCIONPRESTAMO)
                {
                    DateTime fechaFinal  = (DateTime)pres.FECHADEVOLUCIONREALPRESTAMO;
                    DateTime fechaInicio = (DateTime)pres.FECHADEVOLUCIONPRESTAMO;

                    int dias = (int)(fechaFinal - fechaInicio).TotalDays;
                    return(dias);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Exemple #2
0
 public bool Existe(int Id)
 {
     try
     {
         Biblioteca.DALC.PRESTAMO doc = CommonBC.ModeloBiblioteca.PRESTAMO.First
                                            (p => p.IDPRESTAMO == Id);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
        public bool Delete(int Id)
        {
            try
            {
                Biblioteca.DALC.PRESTAMO pres = CommonBC.ModeloBiblioteca.PRESTAMO.First
                                                    (p => p.IDPRESTAMO == Id);

                CommonBC.ModeloBiblioteca.DeleteObject(pres);
                CommonBC.ModeloBiblioteca.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #4
0
        public bool Update(int id, string tipoPrestamo, DateTime fechaPrestamo, DateTime horaPrestamo,
                           DateTime fechaDevolucion, DateTime horaDevolucion, DateTime fechaRealPrestamo,
                           DateTime horaRealPrestamo)
        {
            try
            {
                Biblioteca.DALC.PRESTAMO pres = CommonBC.ModeloBiblioteca.PRESTAMO.First
                                                    (p => p.IDPRESTAMO == id);
                pres.TIPOPRESTAMO = tipoPrestamo;
                // pres.HORAPRESTAMO = horaPrestamo;
                pres.FECHAPRESTAMO           = fechaPrestamo;
                pres.FECHADEVOLUCIONPRESTAMO = fechaDevolucion;
                //pres.HORADEVOLUCIONPRESTAMO = horaDevolucion;
                pres.FECHADEVOLUCIONREALPRESTAMO = fechaRealPrestamo;
                //pres.HORADEVOLUCIONREALPRESTAMO = horaRealPrestamo;
                CommonBC.ModeloBiblioteca.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }