Ejemplo n.º 1
0
        private void login()
        {
            Cursor = Cursors.WaitCursor;
            Result res;

            if (UserNameTxt.Text != string.Empty && PasswordTxt.Text != string.Empty)
            {
                SesionHelper shlp = new SesionHelper();
                res = shlp.Login(new User {
                    UserName = UserNameTxt.Text, Password = PasswordTxt.Text
                });
                Cursor = Cursors.Default;

                if (res.type == ResultType.SUCCESS)
                {
                    this.Hide();
                    var frm = new frm_main();
                    frm.Show();
                }
                else if (res.type == ResultType.USER_FAIL)
                {
                    var msg = MessageBox.Show("Los datos no coinciden", "Entrar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (res.type == ResultType.FAILED)
                {
                    var msg = MessageBox.Show(res.message, "Entrar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }