Esempio n. 1
0
        public int InscribirSocioAlCategoria(Socio soc, Categoria Categoria)
        {
            var k = BdCategoria.ListarIdSocios(Categoria);

            if (k.Contains(soc.IdSocio))
            {
                return(-2);
            }


            BdCategoria.InscribirSocio(soc, Categoria);

            BDSocio bdSocio           = new BDSocio();
            var     valorcuotainicial = bdSocio.ValorInicialClub();
            var     cuota             = new CuotaSocio
            {
                FechaEmision      = DateTime.Now,
                Estado            = EnumEstadoCuotaSocio.NoPagado,
                Importe           = Categoria.Costo,
                ValorCuotaInicial = valorcuotainicial,
                Socio             = soc,
                Categoria         = Categoria
            };

            bdSocio.CrearCupon(cuota);

            return(1);
        }
        public void MostrarFormulario(int id)
        {
            if (id == 0)
            {
                this.btnBorrar.Enabled = false;
                this.Socio             = new Socio();
                this.dtAlta.Value      = DateTime.Now;
                this.dtBaja.Visible    = false;
            }
            else
            {
                this.btnBorrar.Enabled = true;
                this.Socio             = BDSocio.BuscarPorId(id);
                if (this.Socio.Activo == false)
                {
                    this.tbNombre.Enabled   = false;
                    this.tbApellido.Enabled = false;
                    this.labelBaja.Visible  = true;
                    this.dtBaja.Visible     = true;
                    this.dtBaja.Value       = this.Socio.FechaDeBaja;
                    this.btnBorrar.Enabled  = false;
                    this.btnGuardar.Enabled = false;
                }
                this.tbNombre.Text   = this.Socio.Nombre;
                this.tbApellido.Text = this.Socio.Apellido;
                this.dtAlta.Value    = this.Socio.FechaDeAlta;
            }

            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.ShowDialog();
        }
        private void ListaSocio_Load(object sender, EventArgs e)
        {
            DataTable tabla;

            tabla = BDSocio.CargarTabla();
            dgSocio.DataSource = tabla;
        }
Esempio n. 4
0
        // Métodos que cargan los combos.
        private void CargarComboSocio()
        {
            // Para que el combo me devuelva el apellido y nombre tengo que hacer una modificación en el To String () de la clase Socio.

            // Obtengo una lista con los Socios Activos.
            List <Socio> lista;

            lista = BDSocio.BuscarPorActivo(true);

            // Cargo la lista al combo.
            for (int i = 0; i < lista.Count; i++)
            {
                this.cbSocio.Items.Add(lista [i]);
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (this.tbNombre.Text == "")
            {
                MessageBox.Show("Faltan completar campos");
                return;
            }
            else if (this.tbApellido.Text == "")
            {
                MessageBox.Show("Faltan completar Campos");
                return;
            }
            else if (this.tbNombre.Text.IndexOf("'") >= 0 || this.tbApellido.Text.IndexOf("'") >= 0)
            {
                MessageBox.Show("No se pueden ingresar ', ;");
                return;
            }

            this.Socio.Nombre      = this.tbNombre.Text;
            this.Socio.Apellido    = this.tbApellido.Text;
            this.Socio.FechaDeAlta = DateTime.Now;
            BDSocio.Guardar(Socio);
            this.Close();
        }
 private void btnBorrar_Click(object sender, EventArgs e)
 {
     this.Socio.FechaDeBaja = DateTime.Now;
     BDSocio.Borrar(this.Socio.SocioId);
     this.Close();
 }