Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            RequestWindowFeature(WindowFeatures.NoTitle);
            //base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.login);

            passTxv     = FindViewById <TextView>(Resource.Id.passwordTxv);
            usuariosTxv = FindViewById <TextView>(Resource.Id.usuariosTxv);
            usuariosSpn = FindViewById <Spinner>(Resource.Id.usuariosSpn);
            passEtx     = FindViewById <EditText>(Resource.Id.passwordEtx);
            loginBtn    = FindViewById <Button>(Resource.Id.loginBtn);

            loginBtn.Click += LoginBtn_Click;

            try
            {
                LocalDbManager.InitializeLocalDb();
                CargarUsuarios();
            }
            catch (Exception)
            {
                Utiles.MostrarMensaje(this, "Sin conexión", "Sin conexión al servidor");
            }

#if DEBUG
            passEtx.Text = "Syntex";
#endif
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            usuario = Intent.GetStringExtra("Usuario");
            bool bReingreso = Intent.GetBooleanExtra("ReingresoMenu", false);

            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            LinearLayout btnAltaAnimal = FindViewById <LinearLayout>(Resource.Id.btnAltaAnimal);
            LinearLayout btnConsulta   = FindViewById <LinearLayout>(Resource.Id.btnConsulta);
            LinearLayout btnMuestreo   = FindViewById <LinearLayout>(Resource.Id.btnMuestreo);
            LinearLayout btnSangria    = FindViewById <LinearLayout>(Resource.Id.btnSangria);
            LinearLayout btnTacto      = FindViewById <LinearLayout>(Resource.Id.btnTacto);
            LinearLayout btnTraslado   = FindViewById <LinearLayout>(Resource.Id.btnTraslado);
            LinearLayout btnUpload     = FindViewById <LinearLayout>(Resource.Id.btnUpload);
            LinearLayout btnDownload   = FindViewById <LinearLayout>(Resource.Id.btnDownload);

            btnUpload.Click   += Upload_Click;
            btnDownload.Click += Download_Click;


            if (!bReingreso)
            {
                LocalDbManager.InitializeLocalDb();
            }

            var listaPermisosUsuario = revisarPermisos(usuario);

            permisosAll = Permisos.Select(null);

            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Alta animal").First().ID) != -1) //ALTA ANIMAL
            {
                btnAltaAnimal.Enabled = true;
                btnAltaAnimal.Click  += AltaAnimales_Click;
                btnAltaAnimal.SetBackgroundColor(Android.Graphics.Color.ParseColor("#5ab75d"));
            }
            else
            {
                btnAltaAnimal.Enabled = true;
                btnAltaAnimal.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Consulta animal").First().ID) != -1) //CONSULTA ANIMAL
            {
                btnConsulta.Enabled = true;
                btnConsulta.Click  += Consulta_Click;
                btnConsulta.SetBackgroundColor(Android.Graphics.Color.ParseColor("#0175d8"));
            }
            else
            {
                btnConsulta.Enabled = true;
                btnConsulta.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Asociar animal").First().ID) != -1)//ASOCIAR
            {
                permisoAsociar = true;
            }
            else
            {
                permisoAsociar = false;
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Traslado animal").First().ID) != -1) //TRASLADO
            {
                btnTraslado.Enabled = true;
                btnTraslado.Click  += Traslado_Click;
                btnTraslado.SetBackgroundColor(Android.Graphics.Color.ParseColor("#00bdd4"));
            }
            else
            {
                btnTraslado.Enabled = true;
                btnTraslado.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Tacto animal").First().ID) != -1)//TACTO
            {
                btnTacto.Enabled = true;
                btnTacto.Click  += Tacto_Click;
                btnTacto.SetBackgroundColor(Android.Graphics.Color.ParseColor("#aba1bd"));
            }
            else
            {
                btnTacto.Enabled = true;
                btnTacto.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Muestreo animal").First().ID) != -1) //MUESTREO
            {
                btnMuestreo.Enabled = true;
                btnMuestreo.Click  += Muestreo_Click;
                btnMuestreo.SetBackgroundColor(Android.Graphics.Color.ParseColor("#e98904"));
            }
            else
            {
                btnMuestreo.Enabled = true;
                btnMuestreo.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
            if (listaPermisosUsuario.IndexOf(permisosAll.Where(x => x.Descripcion == "Mobile - Sangria animal").First().ID) != -1)//SANGRIA
            {
                btnSangria.Enabled = true;
                btnSangria.Click  += Sangria_Click;
                btnSangria.SetBackgroundColor(Android.Graphics.Color.ParseColor("#de3f27"));
            }
            else
            {
                btnSangria.Enabled = true;
                btnSangria.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
            }
        }