Example #1
0
        public override bool Delete(BaseEntity entity)
        {
            try
            {
                var operation = _mapper.GetDeleteStatement(entity);
                var instance  = SqlDao.GetInstance();
                instance.ExecuteProcedure(operation);
            }
            catch (Exception ex)
            {
                _exMan.ManageException(ex);
            }

            return(true);
        }
Example #2
0
 public void Create2(UsuarioChat fkHotel)
 {
     try
     {
         InfoChatBotMapper mapper = new InfoChatBotMapper();
         var lstResult            = SqlDao.GetInstance()
                                    .ExecuteQueryProcedure(
             mapper.CreateUser(fkHotel)
             );
     }
     catch (Exception e)
     {
         ManageException(e);
     }
 }
Example #3
0
 public void deleteCar(int fkCarrito)
 {
     try
     {
         CheckMapper mapper    = new CheckMapper();
         var         lstResult = SqlDao.GetInstance().ExecuteQueryProcedure
                                 (
             mapper.GetDeleteCarStatement(fkCarrito)
                                 );
     }
     catch (Exception e)
     {
         ManageException(e);
     }
 }
Example #4
0
        public bool Delete(BaseEntity entity)
        {
            try {
                var operation = EntityMapperGeneric.GetDeleteStatement(entity);
                var instance  = SqlDao.GetInstance();
                instance.ExecuteProcedure(operation);

                return(true);
            }
            catch (Exception e) {
                ManageException(e);
            }

            return(false);
        }
Example #5
0
 public void DoCheck(ActionCheck action)
 {
     try
     {
         CheckMapper checkMapper = new CheckMapper();
         var         lstResult   = SqlDao.GetInstance().ExecuteQueryProcedure
                                   (
             checkMapper.GetActionCheckStatement(action)
                                   );
     }
     catch (Exception e)
     {
         ManageException(e);
     }
 }
        public bool AsociarHotelAdmin(int fkHotel, string correo)
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = hotelMapper.GetAsociarHotelAdminStatement(fkHotel, correo);
                instance.ExecuteProcedure(operation);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(true);
        }
Example #7
0
 public void changeOut(int fkSubReservacion)
 {
     try
     {
         CheckMapper mapper    = new CheckMapper();
         var         lstResult = SqlDao.GetInstance().ExecuteQueryProcedure
                                 (
             mapper.GetChangeOutStatement(fkSubReservacion)
                                 );
     }
     catch (Exception e)
     {
         ManageException(e);
     }
 }
Example #8
0
        public bool DeleteRol(Rol rol)
        {
            try
            {
                var operation = rolMapper.GetDeleteRolStatement(rol);
                var instance  = SqlDao.GetInstance();
                instance.ExecuteProcedure(operation);

                return(true);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(false);
        }
Example #9
0
        public override T Retrieve <T>(BaseEntity entity)
        {
            var operation = _mapper.GetRetriveStatement(entity);
            var instance  = SqlDao.GetInstance();
            var ltsSqldao = instance.ExecuteQueryProcedure(operation);

            // revisa que el dato sea o no nulo
            if (ltsSqldao.Count <= 0)
            {
                return(default(T));
            }

            var lista        = ltsSqldao[0];
            var patrocinador = _mapper.BuildObject(lista);

            return((T)Convert.ChangeType(patrocinador, typeof(T)));
        }
Example #10
0
        public override List <T> RetrieveAll <T>()
        {
            var lst = new List <T>();

            var instance  = SqlDao.GetInstance();
            var lstResult = instance.ExecuteQueryProcedure(_mapper.GetRetriveAllStatement());

            if (lstResult.Count > 0)
            {
                var objs = _mapper.BuildObjects(lstResult);

                foreach (var obj in objs)
                {
                    lst.Add((T)Convert.ChangeType(obj, typeof(T)));
                }
            }

            return(lst);
        }
Example #11
0
        public override T Retrieve <T>(BaseEntity entity)
        {
            var instance  = SqlDao.GetInstance();                //verifica si hay algun registro coincidente en la BD
            var operation = _mapper.GetRetriveStatement(entity); //le indica al método qué tipo de operación se va a ejecutar
            //o sea qué tipo de SP es el que se requiere para la operacion
            var lstResult = instance.ExecuteQueryProcedure(operation);

            //invoca el procedimiento para la busqueda del registro y almacena el objeto
            //retornado en la variable lstResult

            if (lstResult.Count <= 0)
            {
                return(default(T));
            }
            //si lstResutl es nulo significa que es menos que 0 por lo tanto no hay registros coincidentes
            //en la BD y retornar null

            var list = lstResult[0];//de lo contrario retorna lo que encuentra en la lista y que lo trae
            //en la posicion 0 que es donde trae guardado el dato conicidente del registro que encontró
            //en la BD
            var rankingEncontrado = _mapper.BuildObject(list);

            //contruye el objeto pasandole los datos
            //a cada atributo
            try
            {
                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }
                list = lstResult[0];
                rankingEncontrado = _mapper.BuildObject(list);
            }
            catch (Exception ex)
            {
                _exMan.ManageException(ex);
            }
            //devuelte el tipo de dato generico T parametrizado, casteando el objeto
            //userEncontrado para que se devuelva a la UI el tipo de dato de la entidad
            //adecuada
            return((T)Convert.ChangeType(rankingEncontrado, typeof(T)));
        }
Example #12
0
        public T Retrieve <T>(BaseEntity entity)
        {
            try {
                var instance  = SqlDao.GetInstance();
                var operation = EntityMapperGeneric.GetRetriveStatement(entity);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            } catch (Exception e) {
                ManageException(e);
            }

            return(default(T));
        }
Example #13
0
        public List <Rol> RetrieveAllPermisos()
        {
            try
            {
                var lstResult = SqlDao.GetInstance().ExecuteQueryProcedure(rolMapper.GetRetriveAllPermisosStatement());

                if (lstResult.Count <= 0)
                {
                    return(default(List <Rol>));
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <Rol>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(null);
        }
Example #14
0
        public List <CantVentasByDayStats> RetrieveCantVentasByDayStats()
        {
            try
            {
                CantVentasByDayStatsMapper mapper = new CantVentasByDayStatsMapper();
                var lstResult = SqlDao.GetInstance().ExecuteQueryProcedure(mapper.GetCantVentasByDayStats());

                if (lstResult.Count <= 0)
                {
                    return(default(List <CantVentasByDayStats>));
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <CantVentasByDayStats>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(null);
        }
        public T RetrieveByReservationId <T>(int idReservation)
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = qrCodeMapper.GetRetrieveByReservationIdStatement(idReservation);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(default(T));
        }
Example #16
0
        public List <Producto> GetRetriveAllByHotelServicioStatement(int idHotel, int idService)
        {
            try
            {
                var lstResult = SqlDao.GetInstance()
                                .ExecuteQueryProcedure(
                    productoMapper.GetRetriveAllByHotelServicioStatement(idHotel, idService)
                    );

                if (lstResult.Count <= 0)
                {
                    return(default(List <Producto>));
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <Producto>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }
            return(null);
        }
        public T CreateSubreservation <T>(Reservation reservation, User user)
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = reservationMapper.GetCreateSubreservation(reservation, user);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(default(T));
        }
Example #18
0
        public T Validate <T>(Rol rol)
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = rolMapper.Validate(rol);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(default(T));
        }
        public List <User> RetrieveAllSubAdministradorByHotel(int idHotel)
        {
            try
            {
                var lstResult = SqlDao.GetInstance()
                                .ExecuteQueryProcedure(
                    userMapper.GetRetriveAllSubAdministradorByHotelStatement(idHotel)
                    );

                if (lstResult.Count <= 0)
                {
                    return(default(List <User>));
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <User>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }
            return(null);
        }
        public Code getCodeConfirmation(string correo)
        {
            try
            {
                var lstResult = SqlDao.GetInstance()
                                .ExecuteQueryProcedure(
                    codeMapper.GetCodeStatement(correo)
                    );

                if (lstResult.Count <= 0)
                {
                    return(default(Code));
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <Code>().ToList().FirstOrDefault());
            }
            catch (Exception e)
            {
                ManageException(e);
            }
            return(null);
        }
Example #21
0
        public Commission IsAdminHotelRegistered(int fkHotel)
        {
            try
            {
                var lstResult = SqlDao.GetInstance()
                                .ExecuteQueryProcedure(
                    commisionMapper.IsAdminHotelRegistered(fkHotel)
                    );

                if (lstResult.Count <= 0)
                {
                    return(null);
                }

                var obj = EntityObjectMapper.BuildObjects(lstResult);

                return(obj.Cast <Commission>().ToList().FirstOrDefault());
            }
            catch (Exception e)
            {
                ManageException(e);
            }
            return(null);
        }
        public List <Reservation> RetrieveAllById(int usuario)
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = reservationMapper.GetRetAllByIdStatement(usuario);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(List <Reservation>));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <Reservation>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(null);
        }
Example #23
0
        public InfoChatBot RetrieveAllById(int fkSubreserva)
        {
            try
            {
                var infoMapper = new InfoChatBotMapper();
                var instance   = SqlDao.GetInstance();
                var op         = infoMapper.GetRetrieveAllByIdStatement(fkSubreserva);
                var lstResult  = instance.ExecuteQueryProcedure(op);

                var objts = EntityObjectMapper.BuildObjects(lstResult);

                if (lstResult.Count <= 0)
                {
                    return(null);
                }

                return(objts.Cast <InfoChatBot>().ToList().FirstOrDefault());
            }
            catch (Exception e)
            {
                ManageException(e);
            }
            return(null);
        }
Example #24
0
        public T RetAllGanaciasMembresia <T>()
        {
            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = platStatsMapper.GetRetAllGanaciasMembresia();
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(default(T));
        }
Example #25
0
        public List <HotelAnualTotalIncome> RetrieveHotelAnualTotalIncome(int fkHotel)
        {
            try
            {
                var lstResult = SqlDao.GetInstance().ExecuteQueryProcedure(
                    (EntityMapperGeneric as HotelAnualIncomeMapper)?.GetHotelAnualTotalIncome(fkHotel)
                    );

                if (lstResult.Count <= 0)
                {
                    return(default(List <HotelAnualTotalIncome>));
                }

                var obj = new HotelAnualTotalIncomeObjectMapper().BuildObjects(lstResult);

                return(obj.Cast <HotelAnualTotalIncome>().ToList());
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(null);
        }
Example #26
0
 public StoreAdministratorCrudFactory() : base()
 {
     mapper = new StoreAdministratorMapper();
     dao    = SqlDao.GetInstance();
 }
Example #27
0
 public UserPasswordCrud()
 {
     Mapper = new UserPasswordMapper();
     Dao    = SqlDao.GetInstance();
 }
 public CalificacionCrudFactory() : base()
 {
     mapper = new CalificacionMapper();
     dao    = SqlDao.GetInstance();
 }
Example #29
0
 public UsuarioCrudFactory() : base()
 {
     mapper = new UsuarioMapper();
     dao    = SqlDao.GetInstance();
 }
 public ParametrizablesHotelCrudFactory() : base()
 {
     mapper = new ParametrizablesHotelMapper();
     dao    = SqlDao.GetInstance();
 }