Esempio n. 1
0
 private void consultarReclamo_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtReclamo.Text))
         {
             Reclamos solReclamo = new Reclamos();
             solReclamo.IdReclamo = Convert.ToInt32(txtReclamo.Text);
             if (solReclamo.consultar())
             {
                 txtArea.Text             = solReclamo.Area.ToString();
                 txtIdCliente.Text        = solReclamo.IdCliente.ToString();
                 dtpFecha.Value           = Convert.ToDateTime(solReclamo.Fecha);
                 cbServicio.SelectedIndex = solReclamo.Servicio;
                 txtReclamo.Text          = solReclamo.IdReclamo.ToString();
                 cbReclamo.SelectedIndex  = solReclamo.IdTipoReclamo;
                 txtCosto.Text            = solReclamo.Costo.ToString();
                 cbSolucion.SelectedIndex = solReclamo.IdSolucion;
                 solReclamo = null;
                 modificarReclamo.Enabled = true;
                 eliminarReclamo.Enabled  = true;
                 cbSolucion.Enabled       = true;
                 txtCosto.Enabled         = true;
             }
             else
             {
                 MessageBox.Show(solReclamo.Error, WARNING, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        protected void consultar_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.solicitudes.SelectedIndex)
                {
                case 0:
                    if (!string.IsNullOrEmpty(this.idPeticion.Text))
                    {
                        Peticiones soliPeticion = new Peticiones();
                        soliPeticion.IdPeticion = Convert.ToInt32(this.idPeticion.Text);
                        if (soliPeticion.consultar())
                        {
                            this.area.Text              = soliPeticion.Area.ToString();
                            this.idCliente.Text         = soliPeticion.IdCliente.ToString();
                            this.fecha.SelectedDate     = Convert.ToDateTime(soliPeticion.Fecha);
                            this.servicio.SelectedIndex = soliPeticion.Servicio;
                            this.idPeticion.Text        = soliPeticion.IdPeticion.ToString();
                            this.idSuper.Text           = soliPeticion.IdSupervisor.ToString();
                            soliPeticion           = null;
                            this.modificar.Enabled = true;
                            this.eliminar.Enabled  = true;
                            this.idSuper.Enabled   = true;
                            break;
                        }
                        else
                        {
                            mostrarErr(soliPeticion.Error);
                            soliPeticion = null;
                            break;
                        }
                    }
                    else
                    {
                        const string ERROR_PETICION_ID = "Debe ingresar el id de la petición para consultar";
                        mostrarErr(ERROR_PETICION_ID);
                    }
                    break;

                case 1:
                    if (!string.IsNullOrEmpty(this.idQueja.Text))
                    {
                        Quejas soliQueja = new Quejas();
                        soliQueja.IdQueja = Convert.ToInt32(this.idQueja.Text);
                        if (soliQueja.consultar())
                        {
                            this.area.Text              = soliQueja.Area.ToString();
                            this.idCliente.Text         = soliQueja.IdCliente.ToString();
                            this.fecha.SelectedDate     = Convert.ToDateTime(soliQueja.Fecha);
                            this.servicio.SelectedIndex = soliQueja.Servicio;
                            this.idQueja.Text           = soliQueja.IdQueja.ToString();
                            this.tipoRemu.SelectedIndex = soliQueja.IdTipoRemuneracion;
                            soliQueja = null;
                            this.modificar.Enabled = true;
                            this.eliminar.Enabled  = true;
                            this.tipoRemu.Enabled  = true;
                            break;
                        }
                        else
                        {
                            mostrarErr(soliQueja.Error);
                            soliQueja = null;
                            break;
                        }
                    }
                    else
                    {
                        const string ERROR_PETICION_ID = "Debe ingresar el id de la queja para consultar";
                        mostrarErr(ERROR_PETICION_ID);
                    }
                    break;

                case 2:
                    if (!string.IsNullOrEmpty(this.idReclamo.Text))
                    {
                        Reclamos soliReclamo = new Reclamos();
                        soliReclamo.IdReclamo = Convert.ToInt32(this.idReclamo.Text);
                        if (soliReclamo.consultar())
                        {
                            this.area.Text              = soliReclamo.Area.ToString();
                            this.idCliente.Text         = soliReclamo.IdCliente.ToString();
                            this.fecha.SelectedDate     = Convert.ToDateTime(soliReclamo.Fecha);
                            this.servicio.SelectedIndex = soliReclamo.Servicio;
                            this.idReclamo.Text         = soliReclamo.IdReclamo.ToString();
                            this.tipoRecl.SelectedIndex = soliReclamo.IdTipoReclamo;
                            this.costo.Text             = soliReclamo.Costo.ToString();
                            this.tipoSol.SelectedIndex  = soliReclamo.IdSolucion;
                            soliReclamo            = null;
                            this.modificar.Enabled = true;
                            this.eliminar.Enabled  = true;
                            this.tipoSol.Enabled   = true;
                            this.costo.Enabled     = true;
                            break;
                        }
                        else
                        {
                            mostrarErr(soliReclamo.Error);
                            soliReclamo = null;
                            break;
                        }
                    }
                    else
                    {
                        const string ERROR_PETICION_ID = "Debe ingresar el id del reclamo para consultar";
                        mostrarErr(ERROR_PETICION_ID);
                    }
                    break;

                case 3:
                    if (!string.IsNullOrEmpty(this.idSuge.Text))
                    {
                        Sugerencias soliSugerencia = new Sugerencias();
                        soliSugerencia.IdSugerencia = Convert.ToInt32(this.idSuge.Text);
                        if (soliSugerencia.consultar())
                        {
                            this.area.Text              = soliSugerencia.Area.ToString();
                            this.idCliente.Text         = soliSugerencia.IdCliente.ToString();
                            this.fecha.SelectedDate     = Convert.ToDateTime(soliSugerencia.Fecha);
                            this.servicio.SelectedIndex = soliSugerencia.Servicio;
                            this.idSuge.Text            = soliSugerencia.IdSugerencia.ToString();
                            this.sugerencia.Text        = soliSugerencia.Sugerencia;
                            soliSugerencia              = null;
                            this.modificar.Enabled      = true;
                            this.eliminar.Enabled       = true;
                            break;
                        }
                        else
                        {
                            mostrarErr(soliSugerencia.Error);
                            soliSugerencia = null;
                            break;
                        }
                    }
                    else
                    {
                        const string ERROR_PETICION_ID = "Debe ingresar el id de la sugerencia para consultar";
                        mostrarErr(ERROR_PETICION_ID);
                    }
                    break;

                case 4:
                    if (!string.IsNullOrEmpty(this.idFeli.Text))
                    {
                        Felicitaciones soliFelicitacion = new Felicitaciones();
                        soliFelicitacion.IdFelicitacion = Convert.ToInt32(this.idFeli.Text);
                        if (soliFelicitacion.consultar())
                        {
                            this.area.Text              = soliFelicitacion.Area.ToString();
                            this.idCliente.Text         = soliFelicitacion.IdCliente.ToString();
                            this.fecha.SelectedDate     = Convert.ToDateTime(soliFelicitacion.Fecha);
                            this.servicio.SelectedIndex = soliFelicitacion.Servicio;
                            this.idFeli.Text            = soliFelicitacion.IdFelicitacion.ToString();
                            this.felicitacion.Text      = soliFelicitacion.Felicitacion;
                            soliFelicitacion            = null;
                            this.modificar.Enabled      = true;
                            this.eliminar.Enabled       = true;
                            break;
                        }
                        else
                        {
                            mostrarErr(soliFelicitacion.Error);
                            soliFelicitacion = null;
                            break;
                        }
                    }
                    else
                    {
                        const string ERROR_PETICION_ID = "Debe ingresar el id de la felicitación para consultar";
                        mostrarErr(ERROR_PETICION_ID);
                    }
                    break;

                default:
                    goto case 0;
                }
            }
            catch (Exception ex)
            {
                mostrarErr(ex.Message);
            }
        }