Example #1
0
        public async Task <IActionResult> RegistarPesoSocio(string SocioEscolhido, float Peso)
        {
            Socio socio = _context.Socios.SingleOrDefault(s => s.NumCC == SocioEscolhido);


            if (ModelState.IsValid)
            {
                socio.Peso             = Peso;
                socio.DataRegisto_Peso = DateTime.Now.Date;
                socio.NumProfessor     = HttpContext.Session.GetString("UserId");

                _context.Socios.Update(socio);

                //--------------------------------------------------------------------------------------------------------------------------------------
                // Adicionar à string json do professor
                Professor professor = _context.Professores.Include(p => p.Socio).SingleOrDefault(p => p.NumCC == HttpContext.Session.GetString("UserId"));
                professor.RegistarPesoSocio(Peso, DateTime.Now.ToShortDateString(), SocioEscolhido);

                _context.Professores.Update(professor);

                // --------------------------------------------------------------------------------------------------------------------------------------
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(RegistarPesoSocio)));
            }
            List <Socio> Lista = _context.Socios.Include(s => s.NumSocioNavigation).Where(s => s.DataSuspensao == null && s.Motivo == null).ToList();

            ViewBag.Socios = Lista.Select(s => new SelectListItem()
            {
                Text  = "CC: " + s.NumCC + " | " + s.NumSocioNavigation.Nome,
                Value = s.NumCC
            });

            return(View(socio));
        }
Example #2
0
        public IActionResult PedidoProf_Aprovado(int id)
        {
            SolicitacaoProfessor solicitacao = _context.SolicitacaoProfessores.Include(s => s.Socio).ThenInclude(s => s.NumSocioNavigation).Include(s => s.Professor).ThenInclude(p => p.NumProfessorNavigation).Include(a => a.NumAdminNavigation).ThenInclude(x => x.NumAdminNavigation).FirstOrDefault(s => s.IdSolicitacao == id);

            // Atribuir o ID do admin a esta solicitacao
            solicitacao.NumAdmin = HttpContext.Session.GetString("UserId");
            Socio     socio = solicitacao.Socio.SingleOrDefault();
            Professor prof  = solicitacao.Professor.SingleOrDefault();

            socio.NumProfessor   = prof.NumCC;
            socio.ID_Solicitacao = null;

            prof.IdSolicitacao = null;
            prof.Socio.Add(socio);
            _context.Socios.Update(socio);
            _context.Professores.Update(prof);

            // --------------------------------------------------------------------------------------------------------------------------------------
            // Adicionar na tabela de solicitacoes do admin
            Admin admin = _context.Admins.Include(x => x.SolicitacaoProfessor).Include(x => x.NumAdminNavigation).SingleOrDefault(x => x.NumCC == HttpContext.Session.GetString("UserId"));

            admin.SolicitacaoProfessor.Add(solicitacao);
            _context.Admins.Update(admin);
            // --------------------------------------------------------------------------------------------------------------------------------------
            _context.SaveChanges();

            return(RedirectToAction(nameof(AprovarPedidoProf)));
        }
Example #3
0
        public IActionResult LevantarSuspensao_Selecionado(string id)
        {
            Pessoa Pessoa = _context.Pessoas.Include(p => p.Socio).Include(p => p.Professor).SingleOrDefault(p => p.NumCC == id);

            if (Pessoa == null)
            {
                return(RedirectToAction(nameof(SuspenderUtilizador)));
            }
            Admin admin = _context.Admins.SingleOrDefault(a => a.NumCC == HttpContext.Session.GetString("UserId"));

            if (HelperFunctions.IsSocio(_context, id))
            {
                Socio socio = _context.Socios.SingleOrDefault(s => s.NumCC == id);
                socio.DataSuspensao = null;
                socio.Motivo        = null;
                socio.NumAdmin      = null;
                _context.Socios.Update(socio);
                admin.SociosSuspensos.Add(socio);
            }
            if (HelperFunctions.IsProfessor(_context, id))
            {
                Professor professor = _context.Professores.SingleOrDefault(p => p.NumCC == id);
                professor.DataSuspensao = null;
                professor.Motivo        = null;
                professor.NumAdmin      = null;
                _context.Professores.Update(professor);
                admin.ProfessoresSuspensos.Add(professor);
            }
            _context.Admins.Update(admin);
            _context.SaveChanges();
            return(RedirectToAction(nameof(LevantarSuspensao)));
        }
Example #4
0
        public Notificacion <RequestRegistrarSocioAsamblea> RegitrarSocioAsambleaDesdeAPP(RequestRegistrarSocioAsamblea request)
        {
            Notificacion <RequestRegistrarSocioAsamblea> notificacion = null;

            try
            {
                notificacion = new Notificacion <RequestRegistrarSocioAsamblea>();
                using (db = new DBManager(ConfigurationManager.AppSettings["conexionString"].ToString()))
                {
                    db.Open();
                    db.CreateParameters(2);
                    db.AddParameters(0, "@idSocio", request.IdSocio);
                    db.AddParameters(1, "@idAsamblea", request.IdAsamblea);
                    db.ExecuteReader(System.Data.CommandType.StoredProcedure, "SP_REGISTRAR_SOCIO_EN_ASAMBLEA_DESDE_APP");
                    if (db.DataReader.Read())
                    {
                        Socio s = null;;
                        notificacion.Model   = request;
                        notificacion.Estatus = Convert.ToInt32(db.DataReader["estatus"].ToString());
                        notificacion.Mensaje = db.DataReader["mensaje"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(notificacion);
        }
Example #5
0
        public IActionResult CriarProfessor(string id)
        {
            Pessoa pessoa = _context.Pessoas.Include(p => p.Admin).Include(p => p.Socio).Include(p => p.Professor).FirstOrDefault(x => x.NumCC == id);

            if (pessoa.Socio != null)
            {
                Socio socio = _context.Socios.Include(s => s.Inscreve).Include(s => s.PlanoTreino).Include(s => s.Cotas).FirstOrDefault(x => x.NumCC == id);
                socio.DeleteEntities(_context);
                pessoa.Socio = null;
                _context.Socios.Remove(socio);
                _context.SaveChanges();
            }
            if (pessoa.Admin != null)
            {
                Admin admin = _context.Admins.Include(a => a.SolicitacaoProfessor).Include(a => a.PedidosSocio).Include(a => a.Exercicio).Include(a => a.Aula).FirstOrDefault(x => x.NumCC == id);
                admin.DeleteEntities(_context);

                pessoa.Admin = null;
                _context.Admins.Remove(admin);

                _context.SaveChanges();
            }


            pessoa.Professor = new Professor(pessoa);

            _context.Professores.Add(pessoa.Professor);
            _context.Pessoas.Update(pessoa);
            _context.SaveChanges();


            return(RedirectToAction(nameof(GerirPessoas)));
        }
Example #6
0
        public Socio seleccionarSocio(int id)
        {
            AccesoDatos datos = new AccesoDatos();
            Socio       aux   = new Socio();

            aux.subscripcionTipo = new SubscripcionTipo();
            try
            {
                datos.setearQuery("select * from socios as s " +
                                  "inner join tiposSubscripcion as ts on ts.id_subscripcion = s.id_tiposSubscripcion " +
                                  "where s.id = @id");
                datos.agregarParametro("@id", id);
                datos.ejecutarLector();
                datos.lector.Read();
                aux.subscripcionTipo = new SubscripcionTipo();
                aux.id                           = datos.lector.GetInt32(0);
                aux.dni                          = datos.lector.GetString(2);
                aux.nombre                       = datos.lector.GetString(3);
                aux.apellido                     = datos.lector.GetString(4);
                aux.telefono                     = datos.lector.GetString(5);
                aux.email                        = datos.lector.GetString(6);
                aux.pwd                          = datos.lector.GetString(7);
                aux.subscripcionTipo.id          = datos.lector.GetInt32(8);
                aux.subscripcionTipo.descripcion = datos.lector.GetString(9);
                datos.cerrarConexion();
            }
            catch (Exception)
            {
                datos.cerrarConexion();
                throw;
            }
            return(aux);
        }
Example #7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,NumSocio,FechaIngresoClub,Categoria,ActivoOno, persona")] Socio socio)
        {
            if (id != socio.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(socio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SocioExists(socio.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(socio));
        }
Example #8
0
        public async Task <IActionResult> PutSocio(int id, Socio socio)
        {
            if (id != socio.Id)
            {
                return(BadRequest());
            }

            _context.Entry(socio).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SocioExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #9
0
        public async Task <ActionResult <Socio> > PostSocio(Socio socio)
        {
            _context.Socios.Add(socio);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSocio", new { id = socio.Id }, socio));
        }
Example #10
0
        public void IncluirSocio()
        {
            // Arrange
            Socio socio = new Socio
            {
                AlteradoPor   = 2,
                Bairro        = "MIRANDOPOLIS",
                Cep           = "04043012",
                Cidade        = "SAO PAULO",
                Cpf           = "12557634859",
                Email         = "*****@*****.**",
                Endereco      = "RUA LUIS GOIS 1850 AP 12",
                IdEmpresa     = 2,
                IdEstado      = 1,
                IdEstadoCivil = 6,
                Nascimento    = new DateTime(1972, 6, 6),
                Nacionalidade = "BRASILEIRA",
                Nome          = "JOSE ALESSANDRO",
                Profissao     = "ANALISTA DE SISTEMAS",
                Telefone      = "997218670"
            };

            // Act
            socio.Id = service.Gravar(socio);

            // Assert
            Assert.IsTrue(socio.Id > 0);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Nombre,Apellido,Cedula,Imagen,Direccion,Telefono,Celular,Fax,Sexo,Edad,FechaNac,TipoMembresia,LugarTrabajo,DireccionOficina,TelefonoOficina,Estado,FechaIngreso,FechaSalida")] Socio socio)
        {
            if (id != socio.SocioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(socio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SocioExists(socio.SocioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(socio));
        }
        private void alquilarButton_Click(object sender, EventArgs e)
        {
            EstadoPedido estadoPedido;

            if (ValidarNIF())
            {
                Socio    socio    = (Socio)socioBindingSource.Current;
                Pelicula pelicula = (Pelicula)peliculasBindingSource.Current;

                estadoPedido = ConnectionHelper.ServiceClient.AlquilarPelicula(socio.NIF, pelicula.CodBarras);
                if (estadoPedido == EstadoPedido.Realizado)
                {
                    if (clienteRecogeChkBox.Checked)
                    {
                        ConnectionHelper.ServiceClient.RecogerPelicula(socio.NIF, pelicula.CodBarras);
                    }

                    MessageBox.Show("Se realizó el alquiler correctamente", "MSDN Video", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    Refrescar();
                }
            }
            else
            {
                MessageBox.Show("Corrija la información no válida antes de guardar", "MSDN Video", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #13
0
        // ************************ BOTONES ************************

        private void btnBuscarSocio_Click(object sender, EventArgs e)
        {
            if (txtBuscarSocio.Text.Trim() == "")
            {
                MessageBox.Show("Ingrese el DNI ó el N° del socio para buscar");
            }
            else
            {
                socio = gs.obtenerSocioPorId(Convert.ToInt32(txtBuscarSocio.Text));
                if (socio == null)
                {
                    socio = gs.obtenerSocioPorDNI(txtBuscarSocio.Text);
                    if (socio == null)
                    {
                        MessageBox.Show("No se encuentra el socio");
                    }
                    else
                    {
                        lstSocios.SelectedValue = socio.Id;
                    }
                }
                else
                {
                    lstSocios.SelectedValue = socio.Id;
                }
            }
        }
        public OperationResult <Socio> UpdateSocios(Socio socioModel)
        {
            var fullname = $"{socioModel.Nombre} {socioModel.Apellido}";

            var operationResult = new OperationResult <Socio>();
            var result          = _DBContext.Socios
                                  .Find(socioModel.Id);

            result.IdSocio        = socioModel.IdSocio;
            result.Nombre         = socioModel.Nombre;
            result.Apellido       = socioModel.Apellido;
            result.NombreCompleto = fullname;
            result.Sexo           = socioModel.Sexo;
            result.Cedula         = socioModel.Cedula;
            result.Dirreccion     = socioModel.Dirreccion;
            result.Telefono       = socioModel.Telefono;
            result.Celular        = socioModel.Celular;
            result.Email          = socioModel.Email;

            try
            {
                _DBContext.Socios.Attach(result);
                _DBContext.Entry(result).State = EntityState.Modified;
                _DBContext.SaveChanges();
                operationResult = OperationResultOperation(result, true);
            }
            catch (Exception ex)
            {
                operationResult = OperationResultOperation(result, true);
            }

            return(operationResult);
        }
Example #15
0
        public void Guardar()
        {
            try
            {
                if (!_vista.DatosSocioControl.Valido)
                {
                    throw new DatosSocioInvalidosException(_vista.DatosSocioControl);
                }

                var nro      = NroSocio.Of(_vista.NroSocio);
                var nombre   = Nombre.Of(_vista.Nombre);
                var apellido = Apellido.Of(_vista.Apellido);
                var activo   = Estado.Of(_vista.Activo);
                var socio    = new Socio(
                    nroSocio: nro,
                    nombre: nombre,
                    apellido: apellido,
                    activo: activo
                    );
                if (_servicio.VerificarDuplicados(socio))
                {
                    throw new SocioDuplicadoException(socio);
                }

                _servicio.Guardar(socio);
                MostrarSocios();
            }
            catch (Exception e)
            {
                MostrarMensaje(e);
            }
        }
Example #16
0
        public void actualizarSocioPagoMatricula(Socio _socio)
        {
            using (var db = new ModeloRenacer())
            {
                _socio.estado          = "Activo";
                db.Entry(_socio).State = System.Data.Entity.EntityState.Modified;
                db.socio.AddOrUpdate(_socio);
                //ControlMatriculaXSocio.devolverInstacia().
                Matricula matricula = ControlMatricula.devolverInstacia().devolverMatriculaActiva();
                if (matricula == null)
                {
                    return;
                }

                db.Entry(matricula).State = System.Data.Entity.EntityState.Modified;
                MatriculaXSocio matriculaxsocio = new MatriculaXSocio()
                {
                    matricula = matricula,
                    socio     = _socio,
                    fechaPago = DateTime.Now,
                    pago      = matricula.valor
                };
                db.matriculaXSocio.Add(matriculaxsocio);

                db.SaveChanges();
            }
        }
        public IActionResult Index_Filtered(IFormCollection data)
        {
            Socio socio = _context.Socios.Include(x => x.PlanoTreino).ThenInclude(p => p.Contem).Include(p => p.PlanoTreino).ThenInclude(x => x.NumProfessorNavigation).ThenInclude(x => x.NumProfessorNavigation).SingleOrDefault(s => s.NumCC == data["SocioEscolhido"].ToString());

            ViewBag.Socio = socio;
            return(PartialView(nameof(Index_Filtered), socio.PlanoTreino.OrderBy(x => x.Descricao).ToList()));
        }
Example #18
0
        static (List <FuncionarioPadrao>, List <CargoAcessoPermitido>) CriarFuncionarios()
        {
            List <FuncionarioPadrao>    funcionarios = new List <FuncionarioPadrao>();
            List <CargoAcessoPermitido> superiores   = new List <CargoAcessoPermitido>();

            try
            {
                var fun1 = new Estagiario("Rodrigo", 1);
                var fun2 = new Trainee("Sergio", 2);
                var fun3 = new Junior("Soely", 3);
                var fun4 = new Senior("Marina", 4);
                var fun5 = new Socio("José", 5);
                var fun6 = new Diretor("Rosa", 6);
                var fun7 = new ChefeDepartamento("Luke", 7);

                funcionarios.AddRange(new FuncionarioPadrao[] { fun1, fun2, fun3, fun4, fun5 });
                superiores.AddRange(new CargoAcessoPermitido[] { fun6, fun7 });

                foreach (var funcioanrio in funcionarios)
                {
                    funcioanrio.ImprimirInformacoesFuncionario();
                }

                foreach (var superior in superiores)
                {
                    superior.ImprimirInformacoesFuncionario();
                }
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }

            return(funcionarios, superiores);
        }
Example #19
0
        }//fin del metodo agregar

        public static int modificar(DateTime f_Asociacion, string identificacion, string nombres, string apellidos, string direccion,
                                    string telefono, string correo, bool activo)
        {
            int   res = -1;
            Socio so  = new Socio
            {
                FechaAsociacion = f_Asociacion,
                Personas        = new Personas
                {
                    Identificacion = identificacion,
                    Nombres        = nombres,
                    Apellidos      = apellidos,
                    Direccion      = direccion,
                    Telefono       = telefono,
                    Correo         = correo,
                    Activo         = activo
                }
            };

            try
            {
                var db = new _Socio(so);
                res = db.modificar();
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR " + e.Message);
            }
            return(res);
        }//fin del metodo  modificar
Example #20
0
        // ************************ BOTONES ************************

        private void btnBuscarSocio_Click(object sender, EventArgs e)
        {
            if (txtBuscarSocio.Text.Trim() == "")
            {
                MessageBox.Show("Ingrese el DNI ó el N° del socio para buscar");
            }
            else
            {
                Socio s = gs.obtenerSocioPorId(Convert.ToInt32(txtBuscarSocio.Text));
                if (s == null)
                {
                    s = gs.obtenerSocioPorDNI(txtBuscarSocio.Text);
                    if (s == null)
                    {
                        MessageBox.Show("No se encuentra el socio");
                        limpiarCampos();
                    }

                    else
                    {
                        lblIdSocioSeleccionado.Text     = Convert.ToString(s.Id);
                        lblDniSocioSeleccionado.Text    = s.Dni;
                        lblNombreSocioSeleccionado.Text = s.Apellido + " " + s.Nombre;
                        txtNombre.Text = lblNombreSocioSeleccionado.Text;
                        if (s.Tutor == null)
                        {
                            lblDniTutorSeleccionado.Text    = "-";
                            lblNombreTutorSeleccionado.Text = "-";
                        }
                        else
                        {
                            lblDniTutorSeleccionado.Text    = s.Tutor.Dni;
                            lblNombreTutorSeleccionado.Text = s.Tutor.Apellido + " " + s.Tutor.Nombre;
                        }
                        cargarComboInscripcion(s.Id);
                    }
                }
                else
                {
                    lblIdSocioSeleccionado.Text     = Convert.ToString(s.Id);
                    lblDniSocioSeleccionado.Text    = s.Dni;
                    lblNombreSocioSeleccionado.Text = s.Apellido + " " + s.Nombre;
                    lblNombreSocioSeleccionado.Text = s.Apellido + " " + s.Nombre;
                    txtNombre.Text = lblNombreSocioSeleccionado.Text;
                    if (s.Tutor == null)
                    {
                        lblDniTutorSeleccionado.Text    = "-";
                        lblNombreTutorSeleccionado.Text = "-";
                    }
                    else
                    {
                        lblDniTutorSeleccionado.Text    = s.Tutor.Dni;
                        lblNombreTutorSeleccionado.Text = s.Tutor.Apellido + " " + s.Tutor.Nombre;
                    }

                    cargarComboInscripcion(s.Id);
                }
            }
        }
Example #21
0
        private void cumpleañosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            tmrCumpleaños.Enabled = false;
            Socio c = new Socio(DateTime.Now);

            c.Cumpleaños(this);
            System.Threading.Thread.Sleep(1000);
        }
Example #22
0
        public ActionResult DeleteConfirmed(int id)
        {
            Socio socio = db.Socio.Single(s => s.idSocio == id);

            db.Socio.DeleteObject(socio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #23
0
        public ActionResult DeleteConfirmed(int id)
        {
            Socio socio = db.Socios.Find(id);

            db.Socios.Remove(socio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #24
0
        public ABMSocios(int ID, ModoForm modo) : this()
        {
            SociosLogic soc = new SociosLogic();

            Modo        = modo;
            Socioactual = soc.GetOne(ID);
            MapearDeDatos();
        }
    public static bool InsertarNuevoSocio(Socio soc)
    {
        bool resultado = false;



        return(resultado);
    }
Example #26
0
 public Socio ActualizarDatosDelSocio(
     Socio socio)
 {
     return(ObtenerRespuesta <Socio>(
                servicio: ServiciosNombres.SOCIOS,
                operacion: ServiciosOperacionesNombres.Socio.ACTUALIZAR_SOCIO,
                parametros: socio));
 }
Example #27
0
 public Prestamo(NroPrestamo numero, Socio socio, Libro libro, Fecha fechaPrestamo, Fecha fechaDevolucion) : base(EntidadId.Vacia)
 {
     Numero          = numero;
     Socio           = socio;
     Libro           = libro;
     FechaPrestamo   = fechaPrestamo;
     FechaDevolucion = fechaDevolucion;
 }
Example #28
0
        public ActionResult <IEnumerable <Cobranca> > BuscarCobrancasSocio(Socio socio)
        {
            var assId  = _context.Assinaturas.First(x => x.IDSOCIO_FK == socio.ID).ID;
            var result = _context.Cobrancas.Where(y => y.IDASSINATURA_FK == assId).ToList();

            result.ForEach(c => c.ASSINATURA_FK = null);
            return(result);
        }
 public static SocioDto FromEntity(Socio socio)
 => new SocioDto(
     id: socio.Id,
     nro: socio.NroSocio.AsInt(),
     nombre: socio.Nombre.ToString(),
     apellido: socio.Apellido.ToString(),
     activo: socio.Activo.ToBool()
     );
Example #30
0
 public Inscripcion(int id, Socio socio, Entrenamiento entrenamiento, DateTime fecha, bool estaSaldado)
 {
     this.id            = id;
     this.socio         = socio;
     this.entrenamiento = entrenamiento;
     this.fecha         = fecha;
     this.estaSaldado   = estaSaldado;
 }