Exemple #1
0
        private bool elUserTieneTarjeta(int user)
        {
            String    query     = "SELECT cliente_datos_tarjeta AS 'DATOS', cliente_usuario FROM SQLEADOS.Cliente WHERE cliente_usuario = " + user;
            DataTable dt        = DBConsulta.AbrirCerrarObtenerConsulta(query);
            String    cellValue = dt.Rows[0][0].ToString();

            return(!AyudaExtra.esStringVacio(cellValue));
        }
 private void camposConAlgunaModificacion()
 {
     reiniciarBooleanos();
     if (!AyudaExtra.esStringVacio(textBoxApellido.Text.Trim()))
     {
         apellido = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxNombre.Text.Trim()))
     {
         nombre = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxTelefono.Text.Trim()))
     {
         telefono = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxTarjeta.Text.Trim()))
     {
         tarjeta = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxCalle.Text.Trim()))
     {
         calle = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxNroCalle.Text.Trim()))
     {
         nrocalle = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxLocalidad.Text.Trim()))
     {
         localidad = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxPiso.Text.Trim()))
     {
         piso = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxDto.Text.Trim()))
     {
         departamento = true;
     }
     if (!AyudaExtra.esStringVacio(textBoxCodigoPostal.Text.Trim()))
     {
         codigopostal = true;
     }
     if (txtHabilitado.Text.Trim() == "0")
     {
         estado = true;
     }
     if (txtHabilitado.Text.Trim() == "1")
     {
         estado = true;
     }
 }
        //MODIFICAR DATOS
        private void button1_Click(object sender, EventArgs e)
        {
            // O = BORRRADOR = NO HACER NADA , 1 = PUBLICADA o 2 = FINALIZADA = CAMBIAR
//            String update = "UPDATE SQLEADOS.Publicacion SET ";
            String estado = "";

            if (radioButtonBorrador.Checked == true)
            {
                estado = "Borrador";
            }
            else
            if (radioButtonFinalizada.Checked == true)
            {
                estado = "Finalizada";
            }
            else if (radioButtonPublicada.Checked == true)
            {
                estado = "Publicada";
            }

            String fecha_publicacion = "";
            String fecha_estreno     = "";
            String error             = "";

            if (AyudaExtra.fechaMenorQueActual(dateTimePicker1.Value))
            {
                error += "La fecha del espectáculo debe ser mayor que la fecha del sistema\n";
            }
            if (AyudaExtra.fechaIgualQueActual(dateTimePicker1.Value))
            {
                error += "La fecha del espectáculo debe ser mayor que la fecha del sistema\n";
            }
            if (AyudaExtra.fechaMenorQueActual(dateTimePickerFechaFinal.Value))
            {
                error += "La fecha del espectáculo debe ser mayor que la fecha del sistema\n";
            }
            if (AyudaExtra.fechaIgualQueActual(dateTimePickerFechaFinal.Value))
            {
                error += "La fecha del espectáculo debe ser mayor que la fecha del sistema\n";
            }
            if (error != "")
            {
                MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DateTime fechaInicial = dateTimePicker1.Value;

            fechaFinal = dateTimePickerFechaFinal.Value;

            if (todosLosHorariosSonValidos())
            {
                //ARMAR FECHA CON HORA

                //EMPIEZO POR FECHA DE PUBLICACION
                fecha_publicacion = fechaInicial.Year + "-" + fechaInicial.Month + "-" + fechaInicial.Day + " " + textBoxHoraInicial.Text + ":" + textBoxMinutoInicial.Text + ":00.000";
                //PASO POR FECHA DE ESTRENO DE OBRA
                fecha_estreno = fechaFinal.Year + "-" + fechaFinal.Month + "-" + fechaFinal.Day + " " + textBoxHoraFinal.Text + ":" + textBoxMinutoFinal.Text + ":00.000";
            }
            else
            {
                return;
            }
            bool problemaConFechas = false;

            if (Convert.ToInt32(fechaFinal.Year) > Convert.ToInt32(fechaInicial.Year))
            {
                //NO HAY PROBLEMA
            }
            else if (Convert.ToInt32(fechaFinal.Year) == Convert.ToInt32(fechaInicial.Year))
            {
                if (Convert.ToInt32(fechaFinal.Month) > Convert.ToInt32(fechaInicial.Month))
                {
                    //NO HAY PROBLEMA
                }
                else
                {
                    if (Convert.ToInt32(fechaFinal.Month) == Convert.ToInt32(fechaInicial.Month))
                    {
                        if (Convert.ToInt32(fechaFinal.Day) > Convert.ToInt32(fechaInicial.Day))
                        {
                            //NO HAY PROBLEMA ALGUNO
                        }
                        else
                        {
                            //PROBLEMA CON EL DIA
                            problemaConFechas = true;
                        }
                    }
                    else
                    {
                        //PROBLEMA CON EL MES
                        problemaConFechas = true;
                    }
                }
            }
            else
            {
                //PROBLEMA CON EL AÑO
                problemaConFechas = true;
            }

            if (problemaConFechas)
            {
                MessageBox.Show("La fecha de estreno es inferior o\nigual que la fecha de publicación", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            //AGREGAR AHORA CATEGORÍA

            int idCategoria = buscarCategoriaYAgregar();

            if (!AyudaExtra.esStringVacio(textPuntaje.Text))
            {
                if (!AyudaExtra.esStringNumerico(textPuntaje.Text))
                {
                    MessageBox.Show("El puntaje ingresado no es un número", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("El puntaje no fue ingresado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            //   DBConsulta.ConectarConsulta(update);
            if (noHayProblemaConLaFechaYHora(fecha_estreno))
            {
                int idGrado = buscarIDGrado(gradoDePublicacion);
                hacerUpdateDePublicacionEspecifica(publicacionID, estado, idCategoria, idGrado, fecha_estreno, fecha_publicacion, Convert.ToInt32(textPuntaje.Text));

                /*
                 * DBConsulta.conexionAbrir();
                 * DBConsulta.actualizarPublicidad(publicacionID, estado, idCategoria, comboBoxGrados.SelectedIndex + 1, armarFechaYHoraYAgregarAUpdate(), Convert.ToInt32(textPuntaje.Text));
                 * DBConsulta.conexionCerrar();
                 * */
                MessageBox.Show("Se ha actualizado la publicación");
                ed.recargar();
                ed.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("A la fecha que se quiere indicar ya existe otra función,\nSeleccione otra fecha", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private bool todosLosHorariosSonValidos()
        {
            if (AyudaExtra.esStringVacio(textBoxHoraInicial.Text) == true)
            {
                MessageBox.Show("En la sección HORARIOS, algunos campos están vacíos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (AyudaExtra.esStringVacio(textBoxMinutoInicial.Text) == true)
            {
                MessageBox.Show("En la sección HORARIOS, algunos campos están vacíos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (AyudaExtra.esStringVacio(textBoxHoraFinal.Text) == true)
            {
                MessageBox.Show("En la sección HORARIOS, algunos campos están vacíos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (AyudaExtra.esStringVacio(textBoxMinutoFinal.Text) == true)
            {
                MessageBox.Show("En la sección HORARIOS, algunos campos están vacíos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!AyudaExtra.esStringNumerico(textBoxHoraInicial.Text))
            {
                MessageBox.Show("El campo hora no es numérico", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (!AyudaExtra.esStringNumerico(textBoxMinutoInicial.Text))
            {
                MessageBox.Show("El campo minuto no es numérico", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (!AyudaExtra.esStringNumerico(textBoxHoraFinal.Text))
            {
                MessageBox.Show("El campo hora no es numérico", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (!AyudaExtra.esStringNumerico(textBoxMinutoFinal.Text))
            {
                MessageBox.Show("El campo minuto no es numérico", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (Convert.ToInt32(textBoxMinutoInicial.Text) >= 60)
            {
                MessageBox.Show("En el campo minuto de publicación, número no es válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (Convert.ToInt32(textBoxHoraInicial.Text) >= 24)
            {
                MessageBox.Show("En el campo hora de publicación, número no es válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (Convert.ToInt32(textBoxMinutoFinal.Text) >= 60)
            {
                MessageBox.Show("En el campo minuto de estreno, número no es válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (Convert.ToInt32(textBoxHoraFinal.Text) >= 24)
            {
                MessageBox.Show("En el campo hora de estreno, número no es válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }