/// <summary> /// Administrator login /// </summary> /// <param name="kiosk"></param> /// <returns></returns> public static bool AdminLogin(MainWindow kiosk) { try { bool result = false; using (DB_Manager.AdminManagement am = new DB_Manager.AdminManagement()) { string encryptPwd = am.Encrypt(kiosk.LoginUser.UserName, kiosk.LoginUser.Password); int currentAuth; if (!am.Login(kiosk.LoginUser.UserName, encryptPwd, out currentAuth)) { kiosk.log.AppendText(string.Format("{0}-{1} เข้าระบบไม่สำเร็จ", kiosk.LoginUser.UserName, kiosk.LoginUser.Password)); result = false; } else { kiosk.LoginUser.CurrentAuthentication = currentAuth; kiosk.log.AppendText(string.Format("{0}-{1} เข้าระบบสำเร็จ รหัสเข้าถึงคือ {2}", kiosk.LoginUser.UserName, kiosk.LoginUser.Password, currentAuth)); System.Diagnostics.Debug.WriteLine(string.Format("{0}-{1} เข้าระบบสำเร็จ รหัสเข้าถึงคือ {2}", kiosk.LoginUser.UserName, kiosk.LoginUser.Password, currentAuth)); result = true; } } return(result); } catch (Exception ex) { kiosk.log.AppendText(ex.Message); return(false); } }
public static bool RegSearchCardInfo(MainWindow kiosk) { try { bool result = false; using (DB_Manager.AdminManagement am = new DB_Manager.AdminManagement()) { string encryptPwd = am.Encrypt(kiosk.LoginUser.UserName, kiosk.LoginUser.Password); int currentAuth; if (!am.Login(kiosk.LoginUser.UserName, encryptPwd, out currentAuth)) { result = false; } else { kiosk.LoginUser.CurrentAuthentication = currentAuth; result = true; } } return(result); } catch (Exception ex) { kiosk.log.AppendText(ex.Message); return(false); } }