protected void Button1_Click(object sender, EventArgs e)
        {
            if ((string)Session["bus"] != null)
            {
                TextMostrar.Text = Convert.ToString(Session["bus"]);

                String comodin  = Convert.ToString(Session["bus"]);
                String comodin2 = "\nProvincia: " + DropProvinicia.Text;
                string comodin3 = "";
                int    final    = 0;

                for (int i = 0; i < comodin.Length; i++)
                {
                    if (comodin3 == comodin2)
                    {
                        while (comodin[i] != '*')
                        {
                            comodin3 += comodin[i];
                            i++;
                        }

                        comodin3 = comodin3.Remove(comodin3.Length - 1);
                        comodin3 = comodin3.Replace(',', '\n');

                        TextMostrar.Text += "\n" + comodin3;
                        comodin3          = "";
                    }
                    else
                    {
                        comodin3 += comodin[i];
                    }
                }
            }
            else
            {
                TextMostrar.Text += "No existe ningun bus en la base de datos";
            }

            using (WDService.Service1Client BusCarac = new WDService.Service1Client())
            {
                //TextMostrar.Text = BusCarac.recibir().ToString();
            }
        }
Пример #2
0
        protected void ButtonRegistra_Click(object sender, EventArgs e)
        {
            Boolean correcto = true;
            string  negativo = "";


            if (DropProvincia.Text == "---")
            {
                correcto  = false;
                negativo += "\n - Provincia vacio";
            }
            else
            {
                provincia = DropProvincia.Text;
            }

            if (TextRuta.Text.Length > 7)
            {
                negativo += "\n-Ruta mayor a 7 digitos";
                correcto  = false;
            }
            else
            {
                ruta = TextRuta.Text;
            }

            if (TextRuta.Text.Length <= 0)
            {
                negativo += "\n-Ruta vacio";
                correcto  = false;
            }
            else
            {
                ruta = TextRuta.Text;
            }

            if (TextRuta.Text == " ")
            {
                negativo += "\n-Ruta vacio";
                correcto  = false;
            }
            else
            {
                ruta = TextRuta.Text;
            }


            if (DropInscrito.Text == "---")
            {
                correcto  = false;
                negativo += "\n - Inscrito vacio";
            }
            else
            {
                inscrito = DropInscrito.Text;
            }

            if (DropAutorizado.Text == "---")
            {
                correcto  = false;
                negativo += "\n - Autorizado Vacio ";
            }
            else
            {
                autorizado = DropAutorizado.Text;
            }

            try
            {
                pasajeroSentados = Convert.ToInt32(TextPaSentados.Text);
            }
            catch (Exception) { correcto = false; negativo += "\n - Cantidad pasajeros sentados vacio o no es numero"; };


            try
            {
                pasajerosPie = Convert.ToInt32(TextPaPie.Text);
            }
            catch (Exception) { correcto = false; negativo += "\n - Cantidad pasajeros pie vacio o no es numero "; };

            if (correcto == true)
            {
                string mensaje1 = "\nProvincia: " + provincia + "\nRuta: " + ruta + "\nInscrito: " + inscrito + "\nAutorizado: " + autorizado + "\nCantidad pasajeros en pie: " + pasajerosPie + "\nCantidad pasajeros sentados: " + pasajeroSentados + "*";
                string guardar  = provincia + "," + ruta + "," + inscrito + "," + autorizado + "," + pasajerosPie + "," + pasajeroSentados + "*";
                Session["bus"]     += mensaje1;
                TextRuta.Text       = "";
                TextPaSentados.Text = "";
                TextPaPie.Text      = "";
                DropProvincia.Text  = "---";
                DropInscrito.Text   = "---";
                DropAutorizado.Text = "---";

                using (WDService.Service1Client BusCarac = new WDService.Service1Client())
                {
                    //BusCarac.enviar(BusCarac);
                }
                mensaje1         = mensaje1.Remove(mensaje1.Length - 1);
                TextMostrar.Text = "Bus agregado: \n" + mensaje1;
            }
            else
            {
                TextMostrar.Text = "Existe algun dato erroneo, no se guardara \n\n\nProblemas presentes: " + negativo;
            }
        }
        protected void ButtonRegistra_Click(object sender, EventArgs e)
        {
            bool completado = true;
            string negativo="";

            if (DropProvincia.Text == "---")
            {
                completado = false;
                negativo += "\n-Provincia vacio";

            }
            else
            {
                provincia = DropProvincia.Text;

            }


            if (TextInicio.Text == " ")
            {
                completado = false;
                negativo += "\n-Punto inicio vacio";
            }
            else
            {
                inicioR = TextInicio.Text;

            }

            if (TextInicio.Text.Length <= 0)
            {
                completado = false;
                negativo += "\n-Punto inicio vacio";
            }
            else
            {
                inicioR = TextInicio.Text;

            }

            if (TextFin.Text == " ")
            {
                completado = false;
                negativo += "\n-Punto fin vacio";
            }
            else
            {
                finR = TextFin.Text;

            }

            if (TextFin.Text.Length <= 0)
            {
                completado = false;
                negativo += "\n-Punto fin vacio";
            }
            else
            {
                finR = TextFin.Text;

            }

            if (DropRural.Text == "---")
            {
                completado = false;
                negativo += "\n-Rural vacio";
            }
            else
            {
                rural = DropRural.Text;

            }

            try
            {
                kilometros = Convert.ToInt32(TextKilometros.Text);
            }
            catch (Exception) { completado = false; negativo += "\n-Kilometros vacio o no es numero"; }


            if (completado == true)
            {
                string mensaje1 = "\nProvincia:" + provincia + "\nInicio ruta: " + inicioR + "\nFin ruta: " + finR + "\nRural: " + rural + "\nCantidad kilometros en ruta: " + kilometros + "*";
                string guardar = provincia + "," + inicioR + "," + finR + "," + rural + "," + kilometros + "*";
                TextInicio.Text = "";
                TextFin.Text = "";
                DropProvincia.Text = "---";
                DropRural.Text = "---";
                TextKilometros.Text = "";
                Session["ruta"] += guardar;
                mensaje1 = mensaje1.Remove(mensaje1.Length - 1);
                TextMostrar.Text = "Ruta agregada: \n" + mensaje1;
            }
            else
            {

                TextMostrar.Text = "Existe algun dato erroneo, no se guardara \n\n\nProblemas presentes: " + negativo;
            }

            using (WDService.Service1Client Ruta = new WDService.Service1Client())
            {
                /*
               Ruta.enviar(BusCarac);
               */
            }

        }