public GWFMessage LogIn(GWFMessage userInfo) { User user = (User)userInfo.content; if (!this.isRegistered(user)) { return new GWFMessage(GWFErrorCode.GWF_E_LOGIN_ERROR); } user.currentState = new OnlineState(); return new GWFMessage(GWFInfoCode.GWF_I_LOGIN_SUCCESS); }
public GWFMessage Register(GWFMessage newUserInfoMsg) { User user = (User) newUserInfoMsg.content; if (this.isRegistered(user)) { return new GWFMessage(GWFErrorCode.GWF_E_SIGNUP_ERROR); } user.uid = Guid.NewGuid().ToString(); SqlConnection conn = this.connectToDB(); String queryString = String.Format("INSERT INTO GWFUser (guid, name, email) VALUES ('{0}', '{1}', '{2}');", user.uid, user.nickName, user.emailAccount); this.executeSQLQuery(conn, queryString); this.disconnectToDB(conn); return new GWFMessage(GWFInfoCode.GWF_I_SIGNUP_SUCCESS); }
public GWFMessage LogOut(GWFMessage userInfo) { return new GWFMessage(GWFInfoCode.GWF_I_LOGOUT_SUCCESS); }