Esempio n. 1
0
        private async void btnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                Empleados           iniciar   = new Empleados(txtUsuario.Text, txtContrasenia.Text);
                HttpResponseMessage respuesta = await Task.Run(() => connection.PostHTTP(iniciar, "/login"));

                var contents = await respuesta.Content.ReadAsStringAsync();

                dynamic json = JObject.Parse(contents);

                if (json.success == "true")
                {
                    Properties.Settings.Default.Cedula = json.cedula;
                    Properties.Settings.Default.Nombre = json.name;
                    Properties.Settings.Default.Login  = true;
                    Properties.Settings.Default.Save();
                    MessageBox.Show("Bienvenido " + json.msg, "Inicio Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FrmSplashView mv = new FrmSplashView();
                    this.Hide();
                    mv.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("" + json.msg);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR EN INICIAR SESION: \n" + ex.Message);
            }
        }
Esempio n. 2
0
        private void btnIngresar_Click_1(object sender, EventArgs e)
        {
            FrmSplashView mv = new FrmSplashView();

            this.Hide();
            mv.ShowDialog();
            this.Close();
        }