Ejemplo n.º 1
0
        private async void SendButton_Clicked(object sender, EventArgs e)
        {
            try {
                string[] envio           = new string[100];
                string   acceso          = null;
                int      positionCurso   = pickercurso.SelectedIndex;
                int      positionCarrera = pickercarrera.SelectedIndex;

                if (positionCurso > -1 && positionCarrera > -1)
                {
                    envio[0] = carreras[positionCarrera];
                    envio[1] = cursos[positionCurso];

                    //Console.WriteLine(envio[0]);
                    //Console.WriteLine(envio[1]);
                }

                acceso = Conectar.Union(9, envio);
                if (acceso != "u00000000")
                {
                    await Navigation.PushAsync(new MenuPage(0));
                }
                else
                {
                    await Navigation.PushAsync(new MenuPage(1));
                }
            }
            catch (Exception ed) { await DisplayAlert("Alerta-mainpage", ed.Message, "ok"); }
        }
Ejemplo n.º 2
0
        private async void Btnpage1_Clicked(object sender, EventArgs e)//boton crear votacion
        {
            var answer = await DisplayAlert("Alerta", "¿Estás seguro de que quieres crear la votación?", "Si", "No");

            if (answer == true)
            {
                int      positionCarrera = pickercarrera.SelectedIndex;
                string[] envio           = new string[100];
                string   acceso          = null;
                envio[0] = PLCnombre.Text;                       //nombre votacion
                envio[1] = PLCcandidato1.Text;                   //.Text;  //nombre opcion1
                envio[2] = PLCcandidato2.Text;                   //.Text;  //nombre opcion2
                envio[3] = PLCcandidato3.Text;                   // .Text;  //nombre opcion3
                envio[4] = PLCfechaini.Date.ToShortDateString(); //fecha inicio
                envio[5] = PLCfechafin.Date.ToShortDateString(); //fecha fin
                envio[6] = carreras[positionCarrera];
                envio[7] = (string)App.Current.Properties["name"];

                acceso = Conectar.Union(2, envio);// el 2 es para la informacion votacion

                await DisplayAlert("", "Su votación se ha creado correctamente", "Aceptar");

                await Navigation.PushAsync(new MenuPage(1));
            }
        }
Ejemplo n.º 3
0
        private async void Btnpage1_Clicked(object sender, EventArgs e)//boton crear votacion
        {
            if (PLCnombre.Text == null)
            {
                await DisplayAlert("Atención", "Por favor, introduzca un titulo para la votación", "Ok");
            }
            else
            {
                var answer = await DisplayAlert("Alerta", "¿Estás seguro de que quieres crear la votación?", "Si", "No");

                if (answer == true)
                {
                    int      positionCarrera = pickercarrera.SelectedIndex;
                    string[] envio           = new string[100];
                    string   acceso          = null;
                    envio[0] = PLCnombre.Text;                         //nombre votacion
                    envio[1] = "A FAVOR";                              //nombre opcion1
                    envio[2] = "EN CONTRA";                            //nombre opcion2
                    envio[3] = "ABSTENCION";                           //nombre opcion3
                    envio[4] = PLCfechaini.Date.ToShortDateString();   //fecha inicio
                    envio[5] = PLCfechafin.Date.ToShortDateString();   //fecha fin
                    envio[6] = carreras[positionCarrera];              //carrera
                    envio[7] = (string)App.Current.Properties["name"]; //id persona crea votacion
                    envio[8] = PLChorafin.Time.ToString();             //hora


                    acceso = Conectar.Union(2, envio);// el 2 es para la informacion votacion

                    await DisplayAlert("", "Su votación se ha creado correctamente", "Aceptar");

                    await Navigation.PushAsync(new MenuPage(1));
                }
            }
        }
Ejemplo n.º 4
0
        public void evento(object sender, EventArgs e, string[] resultado, int res)
        {
            string[] datos = new string[100];

            datos[0] = resultado[0];
            datos[1] = res.ToString();

            Conectar.Union(5, datos);
        }
Ejemplo n.º 5
0
        private async void Delete_Clicked(object sender, EventArgs e, string[] resultado)
        {
            var answer = await DisplayAlert("Alerta", "¿Está seguro de que desea eliminar la votación permanentemente?", "Sí", "No");

            if (answer == true)
            {
                string[] envio  = new string[100];
                string   acceso = null;
                envio[0] = resultado[0]; //IdVotacion

                acceso = Conectar.Union(11, envio);
                await DisplayAlert("", "La votación ha sido eliminada", "Aceptar");

                await Navigation.PushAsync(new MenuPage(1));
            }
        }
Ejemplo n.º 6
0
        public async void evento(object sender, EventArgs e, string[] resultado, int res)
        {
            string[] datos = new string[100];

            datos[0] = resultado[0];
            datos[1] = res.ToString();
            datos[2] = resultado[9];
            datos[3] = resultado[10];
            Conectar.Union(4, datos);
            if (resultado[9] != "u00000000")
            {
                await Navigation.PushAsync(new MenuPage(0));
            }
            else
            {
                await Navigation.PushAsync(new MenuPage(1));
            }
        }
Ejemplo n.º 7
0
        private void LoadEntries(string[] resultado)
        {
            try
            {
                int      i       = 0;
                float [] balor   = new float[3];
                string   valores = Conectar.Union(8, resultado);
                while (i < 3)
                {
                    balor[i] = float.Parse(valores.Substring(0, valores.IndexOf(".")));
                    valores  = valores.Substring(valores.IndexOf(".") + 1);
                    i++;
                }


                Entry e1 = new Entry(balor[0])
                {
                    Label      = resultado[1],
                    ValueLabel = balor[0].ToString(),
                    Color      = SKColor.Parse("#51FF00")
                };

                Entry e2 = new Entry(balor[1])
                {
                    Label      = resultado[2],
                    ValueLabel = balor[1].ToString(),
                    Color      = SKColor.Parse("#FF9700")
                };

                Entry e3 = new Entry(balor[2])
                {
                    Label      = resultado[3],
                    ValueLabel = balor[2].ToString(),
                    Color      = SKColor.Parse("#00FBFF")
                };
                entryList.Add(e1);
                entryList.Add(e2);
                entryList.Add(e3);
            }
            catch (Exception ex)
            {
                DisplayAlert("Error en resultados: ", ex.Message, "ok");
            }
        }
Ejemplo n.º 8
0
        public Votaciones(string[] resultado)
        {
            try
            {
                InitializeComponent();

                /* Necesario para obtener el rol del user que usa la app: Alumno, PDI, PAS */
                string[] rol = new string[100];
                rol[0] = resultado[9];
                string rolUser = Conectar.Union(12, rol);
                rolUser       = rolUser.Remove(rolUser.Length - 1); //removemos la coma
                resultado[10] = rolUser;
                //DisplayAlert("Atención",resultado[10],"Aceptar");
                /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */



                Label label = new Label
                {
                    Text              = resultado[6] + "," + resultado[1] + "," + resultado[2] + "," + resultado[3],
                    FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.Center
                };
                sl.Children.Add(label);
                part1.Text = resultado[1];
                part2.Text = resultado[2];
                part3.Text = resultado[3];

                string a = Conectar.Union(7, resultado);
                //DisplayAlert("1", a.Substring(0,1), "ok");
                if (a.Substring(0, 1) == "2")
                {
                    part1.Clicked += (sendr, EventArgs) => { evento(sendr, EventArgs, resultado, 1); };
                    part2.Clicked += (sendr, EventArgs) => { evento(sendr, EventArgs, resultado, 2); };
                    part3.Clicked += (sendr, EventArgs) => { evento(sendr, EventArgs, resultado, 3); };
                }
                else
                {
                    funcion(resultado);
                }
            }
            catch (Exception e) { DisplayAlert("Error en Votaciones: ", e.Message, "ok"); }
        }
Ejemplo n.º 9
0
        private async void Accept_Clicked(object sender, EventArgs e, string[] resultado, DatePicker seleccion)
        {
            string fechanueva = seleccion.Date.ToShortDateString();

            var answer = await DisplayAlert("Alerta", "¿Está seguro de que desea editar la fecha final de la votación a " + fechanueva + " ?", "Sí", "No");

            if (answer == true)
            {
                string[] envio  = new string[100];
                string   acceso = null;
                envio[0] = resultado[0];            //IdVotacion
                envio[1] = fechanueva;              //fecha fin

                acceso = Conectar.Union(10, envio); // el 10 es para el edit de info
                await DisplayAlert("", "Su votación se ha editado correctamente", "Aceptar");

                await Navigation.PushAsync(new MenuPage(1));
            }
        }
Ejemplo n.º 10
0
        private async void Btnpage1_Clicked(object sender, EventArgs e)    //boton acceder
        {
            try
            {
                string[] envio  = new string[100];
                string   acceso = null;
                string   usu    = PLCusuario.Text;

                envio[0] = Cifrado.Cifrar(PLCusuario.Text);    //usuario
                envio[1] = Cifrado.Cifrar(btncontrasena.Text); //contraseña

                acceso = Conectar.Union(1, envio);             //llama a la funcion Union el 1 es para ldap
                int c = int.Parse(acceso);
                if (c == 1 || c == 2)
                {
                    App.Current.Properties["name"] = PLCusuario.Text;

                    if (c == 1)
                    {
                        await Navigation.PushAsync(new Entry_form());
                    }
                    else
                    {
                        if (usu != "u00000000")
                        {
                            await Navigation.PushAsync(new MenuPage(0));
                        }
                        else
                        {
                            await Navigation.PushAsync(new MenuPage(1));
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alerta", "El usuario o la contraseña no son correctos", "ok");
                }
            }
            catch (Exception e2)
            {
                await DisplayAlert("Alerta: ", e2.Message, "ok");
            }
        }
Ejemplo n.º 11
0
 private async void Result(object sender, EventArgs e)
 {
     try
     {
         string[] resultado = new string[100];
         string   a         = Conectar.Union(6, null);
         int      poscoma   = a.IndexOf(",");
         int      condicion = int.Parse(a.Substring(0, poscoma));
         a = a.Substring(poscoma + 1);
         if (condicion == 0)
         {
             await DisplayAlert("Alerta", "No hay votaciones", "ok");
         }
         else
         {
             await Navigation.PushAsync(new Votar(resultado, a, condicion, poscoma, 2, (string)App.Current.Properties["name"]));
         }
     }
     catch (Exception e6) { }
 }