コード例 #1
0
        static void Main(string[] args)
        {
            main m1 = new main();
            main m2 = new main();

            session s1 = new session(m1, "127.0.0.1", 9252);
            session s2 = new session(m2, "127.0.0.1", 9252);

            // 1. lily login
            result r = s1.login("lily", "123456", 10000);

            if (!r.succ)
            {
                Console.WriteLine("ERROR: failed to login: {0}", r.info);
                return;
            }
            s1.quickplay(); // 2. lily want to play game

            // 3. test login
            r = s2.login("test", "t", 10000);
            if (!r.succ)
            {
                Console.WriteLine("ERROR: failed to login: {0}", r.info);
                s1.stop();
            }
            Thread.Sleep(2000);
            s2.quickplay(); // 4. test want to play

            // pause for a while, both logout
            Thread.Sleep(5000);
            s1.logout(5000);
            s2.logout(5000);
            s1.stop();
            s2.stop();
        }
コード例 #2
0
        /// <summary>
        /// Kết thúc phiên đăng nhập hiện tại của người dùng
        /// </summary>
        /// <returns></returns>
        public JsonResult logoutjs()
        {
            int     up  = 1;
            session ses = new session();

            if (ses.loginCode != "")//only do for staff
            {
                //have code
                PERSONALPARAMETER_BUS bus = new PERSONALPARAMETER_BUS();
                PERSONALPARAMETER_OBJ obj = bus.GetByKey(new fieldpara("staffcode", ses.loginCode));
                if (obj == null)
                {
                    obj = new PERSONALPARAMETER_OBJ();
                    up  = 0;//for insert
                }

                bus.CloseConnection();
            }
            if (ses.pLoginSession != "")
            {
                COMMONTOOL comt = new COMMONTOOL();
                comt.logLogout();
            }

            ses.logout();

            return(Json(new
            {
                ret = 0//ok
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
 public ActionResult Logout()
 {
     ses.logout();
     return(RedirectToAction("Login", "Home"));
 }
コード例 #4
0
 public ActionResult Logout()
 {
     ses.logout();
     Response.Redirect("/home/");
     return(View());
 }