| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using LYFZ.Command;
- namespace LYFZ.WeixinServers.WeiXinAPP
- {
- public partial class Login : System.Web.UI.Page
- {
- public string CookieSavePassword = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- /* #if DEBUG
- Response.Redirect("index.aspx");
- #endif*/
- if (CommonHandler.CheckLogin(this))
- {
- this.Response.Redirect("index.aspx");
- }
- else if (LYFZ.Command.Command_Cookie.GetCookie(SaveAccount)!=null)
- {
- this.txtuser.Value = LYFZ.Command.Command_Cookie.GetCookie(SaveAccount);
- CookieSavePassword = LYFZ.Command.Command_Cookie.GetCookie(SavePassword);
- this.txtpwd.Value = CookieSavePassword;
- this.cbxJiZhumima.Checked = true;
- }
- }
-
- }
- string SaveAccount = "SaveAccount";
- string SavePassword = "SavePassword";
- protected void lbtnLogin_Click(object sender, EventArgs e)
- {
- // LYFZ.Command.Command_Cookie.SaveCookie("","",0);
- // Response.Redirect("index.aspx");
- string userName=this.txtuser.Value.Trim();
- string password = this.txtpwd.Value.Trim();
- if (userName.Length <= 0 || password.Length <= 0)
- {
- MessageBox.Show(this, "请输入正确的帐号和登录密码!");
- }
- else {
- LYFZ.WeixinServiceDate.DAL.DAL_AdminUser userDal = new WeixinServiceDate.DAL.DAL_AdminUser();
- LYFZ.WeixinServiceDate.Model.Model_AdminUser userModel = (LYFZ.WeixinServiceDate.Model.Model_AdminUser)userDal.GetModelObject("Account", userName);
- if (userModel.ID > 0)
- {
- if (userModel.Account == userName && userModel.Password == password)
- {
- if (this.cbxJiZhumima.Checked)
- {
- LYFZ.Command.Command_Cookie.SaveCookie(SaveAccount, userModel.Account, 259200);
- LYFZ.Command.Command_Cookie.SaveCookie(SavePassword, userModel.Password, 259200);
- }
- else {
- LYFZ.Command.Command_Cookie.ClearCookie(SaveAccount);
- LYFZ.Command.Command_Cookie.ClearCookie(SavePassword);
- }
- LYFZ.Command.Command_Session.AddObject("Login", userModel,300);
- this.Response.Redirect("index.aspx");
- }
- else
- {
- MessageBox.Show(this, "输入帐号和登录密码不正确!");
- }
- }
- else {
- MessageBox.Show(this, "输入的登录帐号不存在!");
- }
- }
- }
- }
- }
|