Exemple #1
0
 public void signOut()
 {
     Settings.Default["UserID"]   = "";
     Settings.Default["UserRole"] = "";
     authentication.loginStatus   = false;
     Settings.Default.Save();
     Application.OpenForms.Cast <Form>().Where(x => !(x is frmMain)).ToList().ForEach(x => x.Close());
     formAuth.frmLogin frmLogin = new formAuth.frmLogin();
     frmLogin.ShowDialog();
 }
Exemple #2
0
        public static Boolean checkStatus()
        {
            //MessageBoxAdv.Show(authentication.loginStatus.ToString());
            if (!authentication.loginStatus)
            {
                //MessageBoxAdv.Show("กรุณาล็อกอินก่อนทำรายการ!", "ผิดพลาด",
                //                                 MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                var frmLogin = new formAuth.frmLogin();
                //Application.OpenForms.Cast<Form>().Where(x => !(x is formAuth.frmLogin)).ToList().ForEach(x => x.Close());
                frmLogin.ShowDialog();
                if (authentication.loginStatus)
                {
                    return(true);
                }
                Application.Exit();
                return(false);
            }

            return(true);
        }