Esempio n. 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            var datosSello = new SelloDiscografico();

            datosSello.Nombre   = txtSello.Text.Trim();
            datosSello.Telefono = txtTelefono.Text.Trim();
            datosSello.Email    = txtEmail.Text.Trim();
            datosSello.Id       = _id;

            if (!datosSello.NombreValido())
            {
                MessageBox.Show("Nombre Inválido!");
                txtSello.Text = "";
                txtSello.Focus();
                return;
            }
            if (datosSello.Nombre != sello.Nombre)
            {
                if (datosSello.NombreRepetido(datosSello.Nombre))
                {
                    MessageBox.Show("Nombre ya existente!");
                    txtSello.Text = "";
                    txtSello.Focus();
                    return;
                }
            }

            if (!datosSello.TelefonoValido(datosSello.Telefono))
            {
                MessageBox.Show("Telefono Inválido!");
                txtTelefono.Text = "";
                txtTelefono.Focus();
                return;
            }
            if (!datosSello.EmailValido(datosSello.Email))
            {
                MessageBox.Show("Email Inválido!");
                txtEmail.Text = "";
                txtEmail.Focus();
                return;
            }

            if (sellosRepositorio.Editar(datosSello))
            {
                MessageBox.Show("La edicion ha finalizado correctamente.");
                this.Dispose();
            }
        }
Esempio n. 2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            var sello = new SelloDiscografico();

            sello.Nombre   = txtSello.Text.Trim();
            sello.Telefono = txtTelefono.Text.Trim();
            sello.Email    = txtEmail.Text.Trim();

            if (!sello.NombreValido())
            {
                MessageBox.Show("Nombre Inválido!");
                txtSello.Text = "";
                txtSello.Focus();
                return;
            }
            if (sello.NombreRepetido(sello.Nombre))
            {
                MessageBox.Show("Nombre ya existe!");
                txtSello.Text = "";
                txtSello.Focus();
                return;
            }

            if (!sello.TelefonoValido(sello.Telefono))
            {
                MessageBox.Show("Telefono Inválido!");
                txtTelefono.Text = "";
                txtTelefono.Focus();
                return;
            }

            if (!sello.EmailValido(sello.Email))
            {
                MessageBox.Show("Email Inválido!");
                txtEmail.Text = "";
                txtEmail.Focus();
                return;
            }

            if (sellosRepositorios.Guardar(sello))
            {
                MessageBox.Show("Se agrego sello discografico con exito!");
                this.Dispose();
            }
        }