// 方法名稱直白,單字第一個字需大寫 // 變數第一個單字須小寫 // Sign public string SignIn(string account, string password) // By Kevin Yen { string identify = ""; string memberID = ""; string access = ""; string ip = ""; string reMsg = ""; string jsonStr = ""; bool isSign = false; bool isIdentify = false; bool isLog = false; sql = "select MemberID,Password,Access from Member where Email = '" + account + "'"; JObject job = gm.getJsonResult(sqlMethod.Select(sql)); if (job["stage"].ToString().Equals(true.ToString())) { job = gm.getJsonObjectResult(job["message"].ToString()); if (job["Password"].ToString().Equals(password)) { isSign = true; identify = gm.getUUID(); memberID = job["MemberID"].ToString(); access = job["Access"].ToString(); ip = gm.getIpAddress(); reMsg = msg.success; } else { reMsg = msg.signError_cht;// 帳號密碼錯誤 } } else { reMsg = msg.signError_cht; // 帳號密碼錯誤 } if (isSign) { // Update Member table's identify sql = "update Member set Identify = '" + identify + "' where (MemberID = " + memberID + ")"; job = JObject.Parse(sqlMethod.Update(sql)); if (job["stage"].ToString().Equals(true.ToString())) { isIdentify = true; } // insert SignLog table sql = "insert into SignLog(MemberID,Account,SignInTime,Identify,IP) values('" + memberID + "','" + account + "','" + gm.getCurrentDate() + "','" + identify + "','" + ip + "')"; job = gm.getJsonResult(sqlMethod.Insert(sql)); if (job["stage"].ToString().Equals(true.ToString())) { isLog = true; } } if (isSign && isIdentify && isLog) { jsonStr = gm.getStageJson(true, gm.getJsonArray("Identify;Access", identify + ";" + access)); return(jsonStr); } else { if (!isLog) { reMsg = msg.signError_cht; // 帳號密碼錯誤 } jsonStr = gm.getStageJson(false, reMsg); return(jsonStr); } }