public bool Check_Power(int a_id, string a_name, int fi_no1, int fi_no2, string lg_ip, bool bl_save) { AdminPowerBLL apBLL = new AdminPowerBLL(); AdminLoginBLL alBLL = new AdminLoginBLL(); if (apBLL.Check(a_id, fi_no1, fi_no2, true)) { if (bl_save == true) { alBLL.Insert(a_id, fi_no2, DateTime.Now, lg_ip); } return(true); } else { return(false); } }
protected void BtLogin_Click(object sender, EventArgs e) { try { string password = Tools.GetPassword(txtUserName.Text.Trim(), txtPassword.Text.Trim()); //檢查密碼是否符合超級密碼 if (txtPassword.Text.Trim() == SystemConfigBLL.getDataByClassWithName("Main", "SuperCode")) { AdminInfo infoSuper = aBLL.getDataByAccount(txtUserName.Text.Trim()); uid = infoSuper.a_id; Response.Redirect(Tools.GetAppSettings("LoginedUrl"), true); return; } //檢查帳號密碼是否正確 AdminInfo info = aBLL.getDataByAccountWithPassword(txtUserName.Text.Trim(), password); if (info.a_id != 0) { uid = info.a_id; aBLL.UpdateLastDate(DateTime.Now, info.a_id); //由此開始判斷暫存檔過期 if (UserInfoConfig.GetUserConfig("tempStart").ToLower() == "true") { tfBLL.DeleteTempFiles(); } AdminLoginInfo alinfo = new AdminLoginInfo(); alinfo.a_id = info.a_id; alinfo.al_logintime = DateTime.Now; alinfo.al_ip = Tools.GetIpAddress(); alinfo.al_no2 = 0; alBLL.Insert(alinfo); Response.Redirect(Tools.GetAppSettings("LoginedUrl"), true); } else { message.Text = "帳號或密碼有誤,請重新輸入!"; } } catch (Exception ex) { message.Text = ex.Message; } }