//取得分數板 public void GetScore() { PubClass myClass = new PubClass(); DataTable dtScore = myClass.GetScore(); String strJson = myClass.ConvertToJsonString(dtScore); Clients.All.getScore(strJson); }
//加入問題 public void AddQuesiton(int intQutionNumber) { PubClass myClass = new PubClass(); DataTable dtQuestion = myClass.GetQuestionByID(intQutionNumber); String Question = myClass.ConvertToJsonString(dtQuestion); Clients.All.addQuestion(Question); }
//傳送答案 public void SendAnswer(int intQutionNumber) { PubClass myClass = new PubClass(); DataTable dtAnswwerImg = myClass.GetAnswerImgByID(intQutionNumber); String imgColleaction = myClass.ConvertToJsonString(dtAnswwerImg); DataTable dtUserIngfo = myClass.GetUserInfoByPhoneNumber(dtAnswwerImg.Rows[0]["phoneNumber"].ToString()); String userInfo = myClass.ConvertToJsonString(dtUserIngfo); JArray ja = new JArray(); JObject jo = new JObject(); jo.Add(new JProperty("imgCollection", imgColleaction)); jo.Add(new JProperty("userInfo", userInfo)); ja.Add(jo); String jsonString = JsonConvert.SerializeObject(ja); Clients.All.sendAnswer(jsonString); }