Exemplo n.º 1
0
        //Cuando se hace la busqueda por medio del combo, cuando aun no se entrega el producto hablita el boton de entregado
        private void btnEntregado_Click(object sender, EventArgs e)
        {
            //Usaremos un switch para conocer en que Menu se encuentra

            switch (menuSeleccionado)
            {
            case "Inaguracion":

                //Le agregaremos la entrega en la base de datos al usuario de Inaguracion
                conexion.setEntregadoInaguracion(usuario.id);
                ChecarEntregado(true);
                cbBoxNombre.Text = "";
                break;

            case "Alimentos":
                //Le agregaremos la entrega en la base de datos al usuario de Alimentos
                conexion.setEntregadoAlimentos(usuario.id);
                ChecarEntregado(true);

                if (btnEntregado.IsPressed == false)
                {
                    List <Usuario> conexiones = ConexionBD.Muestra2(usuario);
                    TorneoAnual.CrystalReports.TicketAlimento tAli = new CrystalReports.TicketAlimento();

                    tAli.SetParameterValue("Nombre", usuario.nombre);
                    tAli.SetParameterValue("Categoria", usuario.categoriaDescripcion);
                    if (usuario.categoriaTipo == "T")
                    {
                        tAli.SetParameterValue("Tipo", "Tenis");
                    }
                    else
                    {
                        tAli.SetParameterValue("Tipo", "Golf");
                    }


                    tAli.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
                    tAli.PrintToPrinter(1, true, 1, 2);
                    tAli.Close();
                    tAli.Dispose();
                    cbBoxNombre.Text = "";
                }
                break;

            case "Cerveza":
                //Le agregaremos la entrega en la base de datos al usuario de Cerveza
                conexion.setEntregadoCerveza(usuario.id, countCervezas += 2);
                ChecarEntregado(true);
                btnEntregado.Content    = "Tomara otras 2";
                btnEntregado.Visibility = Visibility.Visible;
                btnEntregado.IsEnabled  = true;

                if (btnEntregado.IsPressed == false)
                {
                    List <Usuario> conexiones = ConexionBD.Muestra2(usuario);
                    TorneoAnual.CrystalReports.TicketCerveza tCer = new CrystalReports.TicketCerveza();

                    tCer.SetParameterValue("Nombre", usuario.nombre);
                    tCer.SetParameterValue("Categoria", usuario.categoriaDescripcion);
                    if (usuario.categoriaTipo == "T")
                    {
                        tCer.SetParameterValue("Tipo", "Tenis");
                    }
                    else
                    {
                        tCer.SetParameterValue("Tipo", "Golf");
                    }

                    tCer.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
                    tCer.PrintToPrinter(1, true, 1, 2);
                    tCer.Close();
                    tCer.Dispose();
                    cbBoxNombre.Text = "";
                }
                break;

            case "Tenis":
                //Le agregaremos la entrega en la base de datos al usuario de Tennis
                conexion.setEntregadoTennis(usuario.id);
                ChecarEntregado(true);
                if (btnEntregado.IsPressed == false)
                {
                    List <Usuario> conexiones = ConexionBD.Muestra2(usuario);
                    TorneoAnual.CrystalReports.TicketTenis tTen = new CrystalReports.TicketTenis();

                    tTen.SetParameterValue("Nombre", usuario.nombre);
                    tTen.SetParameterValue("Categoria", usuario.categoriaDescripcion);
                    if (usuario.categoriaTipo == "T")
                    {
                        tTen.SetParameterValue("Tipo", "Tenis");
                    }
                    else
                    {
                        tTen.SetParameterValue("Tipo", "Golf");
                    }
                    tTen.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
                    tTen.PrintToPrinter(1, true, 1, 2);
                    tTen.Close();
                    tTen.Dispose();
                    cbBoxNombre.Text = "";
                }
                break;

            case "Golf":
                //Le agregaremos la entrega en la base de datos al usuario de Golf
                conexion.setEntregadoGolf(usuario.id);
                ChecarEntregado(true);

                if (btnEntregado.IsPressed == false)
                {
                    List <Usuario> conexiones = ConexionBD.Muestra2(usuario);
                    TorneoAnual.CrystalReports.TicketKGolf tGo = new CrystalReports.TicketKGolf();

                    tGo.SetParameterValue("Nombre", usuario.nombre);
                    tGo.SetParameterValue("Categoria", usuario.categoriaDescripcion);
                    if (usuario.categoriaTipo == "T")
                    {
                        tGo.SetParameterValue("Tipo", "Tenis");
                    }
                    else
                    {
                        tGo.SetParameterValue("Tipo", "Golf");
                    }
                    tGo.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
                    tGo.PrintToPrinter(1, true, 1, 2);
                    tGo.Close();
                    tGo.Dispose();
                    cbBoxNombre.Text = "";
                }
                break;

            case "Concierto":
                //Le agregaremos la entrega en la base de datos al usuario de Concierto
                conexion.setEntregadoConcierto(usuario.id);
                ChecarEntregado(true);
                if (btnEntregado.IsPressed == false)
                {
                    List <Usuario> conexiones = ConexionBD.Muestra2(usuario);
                    TorneoAnual.CrystalReports.ticketConcierto tCon = new CrystalReports.ticketConcierto();

                    tCon.SetParameterValue("Nombre", usuario.nombre);
                    tCon.SetParameterValue("Categoria", usuario.categoriaDescripcion);
                    if (usuario.categoriaTipo == "T")
                    {
                        tCon.SetParameterValue("Tipo", "Tenis");
                    }
                    else
                    {
                        tCon.SetParameterValue("Tipo", "Golf");
                    }
                    tCon.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
                    tCon.PrintToPrinter(1, true, 1, 2);
                    tCon.Close();
                    tCon.Dispose();
                    cbBoxNombre.Text = "";
                }
                break;

            case "Clausura":
                //Le agregaremos la entrega en la base de datos al usuario de Clausura
                conexion.setEntregadoClausura(usuario.id);
                ChecarEntregado(true);
                cbBoxNombre.Text = "";
                break;
            }
        }