public void Update(FamiliaDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <FamiliaDTO, Familia>(obj);

                _serviceFamilia.Update(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task AddAsync(FamiliaDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <FamiliaDTO, Familia>(obj);

                await _serviceFamilia.AddAsync(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public void Update(CondominioDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <CondominioDTO, Condominio>(obj);

                _serviceCondominio.Update(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public async Task AddAsync(CondominioDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <CondominioDTO, Condominio>(obj);

                await _serviceCondominio.AddAsync(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public void Update(SeguroDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <SeguroDTO, Seguro>(obj);

                _serviceSeguro.Update(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public async Task AddAsync(SeguroDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <SeguroDTO, Seguro>(obj);

                await _serviceSeguro.AddAsync(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public async Task AddAsync(MoradorDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <MoradorDTO, Morador>(obj);

                await _serviceMorador.AddAsync(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 8
0
        public static List <DtoCliente> Pesquisa(cliente cliente)
        {
            using (var db = new bancoviagemEntities())
            {
                var clientes = db.cliente.Where(a => a.Status == 0)
                               .Where(a => cliente.Nome.Equals(string.Empty) ? true : a.Nome.ToUpper().Contains(cliente.Nome.ToUpper()))
                               .Where(a => cliente.Cpf.Equals(string.Empty) ? true : a.Cpf.Contains(cliente.Cpf))
                               .Where(a => cliente.Telefone.Equals(string.Empty) ? true : a.Telefone.Contains(cliente.Telefone))
                               .Where(c => cliente.DataNascimento.Equals(DateTime.MinValue) ? true : c.DataNascimento.Equals(cliente.DataNascimento));

                return(Mapeador.ListaDeCliente(clientes.ToList()));
            }
        }
Esempio n. 9
0
        public void Update(MoradorDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <MoradorDTO, Morador>(obj);

                _serviceMorador.Update(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult Create(ItemValorViewModel itemValorViewModel)
        {
            try
            {
                var itemValor = Mapeador.Mapear <ItemValorViewModel, ItemValor>(itemValorViewModel);
                _gerenciadorDeItemValor.Salvar(itemValor);

                return(RedirectToAction("Index", new { id = itemValorViewModel.Orcamento.Id }));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 11
0
        public IActionResult VerPermiso(int permisoId)
        {
            var permisoEntidad = UnidadDeTrabajo.Repositorio <Permiso>()
                                 .Buscar(permisoId);

            if (permisoEntidad is null)
            {
                return(RedirectToAction(nameof(PáginaNoEncontrada)));
            }

            var permisoModelo = Mapeador.Map <PermisoDto>(permisoEntidad);

            return(View(permisoModelo));
        }
Esempio n. 12
0
        public ActionResult Edit(int id, OrcamentoViewModel orcamentoViewModel)
        {
            try
            {
                var orcamento = Mapeador.Mapear <OrcamentoViewModel, Orcamento>(orcamentoViewModel);
                _gerenciadorDeOrcamento.Editar(orcamento);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 13
0
        public override IDbCommand CargarParametros(ref IDbCommand comando)
        {
            if (comando == null)
            {
                throw new NullReferenceException("¡El comando no puede ser nulo!");
            }

            try
            {
                foreach (ParametroSql parametro in Parametros.Parametros)
                {
                    IDbDataParameter param = comando.CreateParameter();

                    if (!parametro.Tipo.HasValue)
                    {
                        if (parametro.Valor != null)
                        {
                            if (parametro.Valor.GetType() != typeof(DataTable))
                            {
                                parametro.Tipo = Mapeador.ObtenerTipoDestino(parametro.Valor.GetType());
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (parametro.Valor.GetType() != typeof(DataTable))
                    {
                        param.DbType = parametro.Tipo.Value;
                    }
                    else
                    {
                        (param as SqlParameter).SqlDbType = SqlDbType.Structured;
                    }
                    param.Direction     = ParameterDirection.Input;
                    param.Value         = parametro.Valor;
                    param.ParameterName = parametro.Nombre;

                    comando.Parameters.Add(param);
                }
                Consulta = CreadorQuery.ObtenerQuery(this);
                return(comando);
            }
            catch (Exception e)
            {
                throw new EjecutarException("¡Error al cargar los parámetros de entrada del SP!", e);
            }
        }
Esempio n. 14
0
        public ActionResult Create(OrcamentoViewModel orcamentoViewModel, decimal Valor)
        {
            try
            {
                var orcamento = Mapeador.Mapear <OrcamentoViewModel, Orcamento>(orcamentoViewModel);
                _gerenciadorDeOrcamento.Salvar(orcamento);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 15
0
        public DireccionEntidad TraerDireccionPorIdSucursal(int elIdSucursal)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@elIdSucursal", elIdSucursal)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "TraerDireccionPorIdSucursal", parameters))
            {
                DireccionEntidad DireccionEntidad = new DireccionEntidad();
                DireccionEntidad = Mapeador.MapearFirst <DireccionEntidad>(dt);
                return(DireccionEntidad);
            }
        }
        public ActionResult Edit(int id, ItemSubValorViewModel itemSubValorViewModel)
        {
            try
            {
                var itemSubValor = Mapeador.Mapear <ItemSubValorViewModel, ItemSubValor>(itemSubValorViewModel);
                _gerenciadorDeItemSubValor.Editar(itemSubValor);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public bool Existe(AlumnoEditDto alumnoEditDto)
        {
            var alumno = Mapeador.CrearMapper().Map <AlumnoEditDto, Alumno>(alumnoEditDto);

            if (alumno.AlumnoId > 0)
            {
                //fue editado
                return(_dbContext.Alumnos.Any(a =>
                                              a.Nombre == alumno.Nombre && a.Apellido == alumno.Apellido &&
                                              a.AlumnoId != alumno.AlumnoId));
            }
            //fue agregado
            return(_dbContext.Alumnos.Any(a => a.Nombre == alumno.Nombre &&
                                          a.Apellido == alumno.Apellido));
        }
Esempio n. 18
0
        public List <UsuarioEntidad> EmpresasConMasPedidos(string CUIT)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CUIT", CUIT)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "rankingEmpresas", parameters))
            {
                List <UsuarioEntidad> lista = new List <UsuarioEntidad>();
                lista = Mapeador.Mapear <UsuarioEntidad>(dt);

                return(lista);
            }
        }
        /// <summary>
        /// Selects all records from the Producto table by a foreign key.
        /// </summary>
        public List <ProductoEntidad> SelectAllByIdMarca(int idMarca)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdMarca", idMarca)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "ProductoSelectAllByIdMarca", parameters))
            {
                List <ProductoEntidad> productoEntidadList = new List <ProductoEntidad>();

                productoEntidadList = Mapeador.Mapear <ProductoEntidad>(dt);
                return(productoEntidadList);
            }
        }
        public void Borrar(int inscripcionId)
        {
            var inscripcion = _repositorio.GetInscripcionPorId(inscripcionId);

            using (var scope = new TransactionScope(TransactionScopeOption.Required))
            {
                _repositorio.Borrar(inscripcionId);
                var cursoDto = _repositorioCursos.GetCursoPorId(inscripcion.CursoListDto.CursoId);
                var curso    = Mapeador.CrearMapper().Map <CursoEditDto, Curso>(cursoDto);
                curso.Vacantes++;
                _repositorioCursos.Guardar(curso);
                _unitOfWork.SaveChanges();
                scope.Complete();
            }
        }
        /// <summary>
        /// Selects all records from the UsuarioFamilia table by a foreign key.
        /// </summary>
        public List <UsuarioFamiliaEntidad> SelectAllByIdFamilia(int idFamilia)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdFamilia", idFamilia)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "UsuarioFamiliaSelectAllByIdFamilia", parameters))
            {
                List <UsuarioFamiliaEntidad> lista = new List <UsuarioFamiliaEntidad>();
                lista = Mapeador.Mapear <UsuarioFamiliaEntidad>(dt);

                return(lista);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Selects all records from the Telefono table by a foreign key.
        /// </summary>
        public List <TelefonoEntidad> SelectAllByIdTipoTel(int idTipoTel)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdTipoTel", idTipoTel)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "TelefonoSelectAllByIdTipoTel", parameters))
            {
                List <TelefonoEntidad> lista = new List <TelefonoEntidad>();
                lista = Mapeador.Mapear <TelefonoEntidad>(dt);

                return(lista);
            }
        }
        /// <summary>
        /// Selects all records from the Sucursal table by a foreign key.
        /// </summary>
        public List <SucursalEntidad> SelectAllByCUIT(int cUIT)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CUIT", cUIT)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "SucursalSelectAllByCUIT", parameters))
            {
                List <SucursalEntidad> lista = new List <SucursalEntidad>();
                lista = Mapeador.Mapear <SucursalEntidad>(dt);

                return(lista);
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Selects all records from the Reserva table by a foreign key.
        /// </summary>
        public List <ReservaEntidad> SelectAllByIdSucursal(int idSucursal)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdSucursal", idSucursal)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "ReservaSelectAllByIdSucursal", parameters))
            {
                List <ReservaEntidad> reservas = new List <ReservaEntidad>();
                reservas = Mapeador.Mapear <ReservaEntidad>(dt);

                return(reservas);
            }
        }
        /// <summary>
        /// Selects all records from the MonedaEmpresa table by a foreign key.
        /// </summary>
        public List <MonedaEmpresaEntidad> SelectAllByIdMoneda(int idMoneda)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdMoneda", idMoneda)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "MonedaEmpresaSelectAllByIdMoneda", parameters))
            {
                List <MonedaEmpresaEntidad> monedaEmpresaEntidadList = new List <MonedaEmpresaEntidad>();

                monedaEmpresaEntidadList = Mapeador.Mapear <MonedaEmpresaEntidad>(dt);

                return(monedaEmpresaEntidadList);
            }
        }
		/// <summary>
		/// Selects all records from the PatenteFamilia table by a foreign key.
		/// </summary>
		public List<PatenteFamiliaEntidad> SelectAllByIdPatente(int idPatente)
		{
			SqlParameter[] parameters = new SqlParameter[]
			{
				new SqlParameter("@IdPatente", idPatente)
			};

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "PatenteFamiliaSelectAllByIdPatente", parameters))
			{
				List<PatenteFamiliaEntidad> patenteFamiliaEntidadList = new List<PatenteFamiliaEntidad>();

                patenteFamiliaEntidadList = Mapeador.Mapear<PatenteFamiliaEntidad>(dt);

				return patenteFamiliaEntidadList;
			}
		}
Esempio n. 27
0
        /// <summary>
        /// Selects all records from the Telefono table by a foreign key.
        /// </summary>
        public List <TelefonoEntidad> SelectAllByCUIT_NombreUsuario(string cuit, string nombreUsuario)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@cuit", cuit),
                new SqlParameter("@NombreUsuario", nombreUsuario)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "TelefonoSelectAllByCUIT_NombreUsuario", parameters))
            {
                List <TelefonoEntidad> lista = new List <TelefonoEntidad>();
                lista = Mapeador.Mapear <TelefonoEntidad>(dt);

                return(lista);
            }
        }
        /// <summary>
        /// Selects all records from the ComprobanteDetalle table by a foreign key.
        /// </summary>
        public List <ComprobanteDetalleEntidad> SelectAllByIdProducto(int idProducto)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdProducto", idProducto)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "ComprobanteDetalleSelectAllByIdProducto", parameters))
            {
                List <ComprobanteDetalleEntidad> comprobanteDetalleEntidadList = new List <ComprobanteDetalleEntidad>();

                comprobanteDetalleEntidadList = Mapeador.Mapear <ComprobanteDetalleEntidad>(dt);

                return(comprobanteDetalleEntidadList);
            }
        }
        /// <summary>
        /// Selects a single record from the IvaProducto table.
        /// </summary>
        public IvaProductoEntidad Select(int idIvaProducto)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdIvaProducto", idIvaProducto)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "IvaProductoSelect", parameters))
            {
                IvaProductoEntidad IvaProductoEntidad = new IvaProductoEntidad();

                IvaProductoEntidad = Mapeador.MapearFirst <IvaProductoEntidad>(dt);

                return(IvaProductoEntidad);
            }
        }
        /// <summary>
        /// Selects a single record from the FormaPago table.
        /// </summary>
        public FormaPagoEntidad Select(int idFormaPago)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@IdFormaPago", idFormaPago)
            };

            using (DataTable dt = SqlClientUtility.ExecuteDataTable(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "FormaPagoSelect", parameters))
            {
                FormaPagoEntidad FormaPagoEntidad = new FormaPagoEntidad();

                FormaPagoEntidad = Mapeador.MapearFirst <FormaPagoEntidad>(dt);

                return(FormaPagoEntidad);
            }
        }