예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public GWFMessage LogOut(GWFMessage userInfo)
 {
     return new GWFMessage(GWFInfoCode.GWF_I_LOGOUT_SUCCESS);
 }