public override void execute(INotification notification) { base.execute(notification); //获得用户登录的信息 LoginVO loginVO = (LoginVO)notification.getBody(); //获得需要使用到的Proxy UserProxy userProxy = facade.retrieveProxy(UserProxy.NAME) as UserProxy; //通过用户名返回用户的信息 UserInfo userInfo = userProxy.GetUserInfo(loginVO.UserName); //实现用户的登录逻辑 if (userInfo != null) { if (userInfo.Password == loginVO.Password) { //发出登录情况的通知 sendNotification(LOGIN_SUCCESS, userInfo); } else { sendNotification(LOGIN_FAILED); } } else { sendNotification(USER_NOT_FOUND); } }
/// <summary> /// 登录按钮的单击事件 /// </summary> public void Login(object sender, EventArgs e) { TextBox userNameTextBox = (TextBox)MyPage.FindControl("UserNameTextBox"); string userName = userNameTextBox.Text; TextBox passwordTextBox = (TextBox)MyPage.FindControl("PasswordTextBox"); string password = passwordTextBox.Text; LoginVO loginVO = new LoginVO(userName, password); sendNotification(DefaultPageController.LOGIN, loginVO); }