예제 #1
0
        public POVResultdetails POVQuizResult()
        {
            SqlConnection                con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
            MySqlConnection              mysqlcon = new MySqlConnection(ConfigurationManager.ConnectionStrings["mysqlcon"].ConnectionString);
            POVResultdetails             Detail = new POVResultdetails();
            POVResult                    Listss = new POVResult();
            List <POVTestQuestionResult> Lists = new List <POVTestQuestionResult>();
            List <POVOptionsResult>      OptonLists = new List <POVOptionsResult>();
            int    noquestions, duration, cnt = 0;
            float  score;
            int    roundNumber, studentcode;
            string admission_no, program_name, batch_name, student_name;

            var POVResultRequestmsg = Request.Content.ReadAsStringAsync();
            POVResultRequest povresultrequest = JsonConvert.DeserializeObject <POVResultRequest>(POVResultRequestmsg.Result);

            if (POVResultRequestmsg.Result.ToString() != null && POVResultRequestmsg.Result.ToString() != "")
            {
                # region QuizTest Start

                for (int i = 0; i < povresultrequest.questionid.Length; i++)
                {
                    string testquery = @"select * from `questions_logs` where question_id=" + povresultrequest.questionid[i] + " and student_id=" + povresultrequest.student_id
                                       + " and created is null and modified is null";
                    MySqlCommand testcmd = new MySqlCommand(testquery, mysqlcon);
                    testcmd.CommandType = CommandType.Text;
                    MySqlDataAdapter testsda = new MySqlDataAdapter(testcmd);
                    DataTable        testdt  = new DataTable();
                    testsda.Fill(testdt);
                    if (testdt.Rows.Count > 0)
                    {
                        mysqlcon.Open();
                        string updatequery = @"update  `questions_logs` set student_answer_id=" + povresultrequest.optionid[i] + " where question_id=" + povresultrequest.questionid[i]
                                             + " and student_id=" + povresultrequest.student_id + " and created is null and modified is null";
                        MySqlCommand updatecmd = new MySqlCommand(updatequery, mysqlcon);
                        updatecmd.ExecuteNonQuery();
                        mysqlcon.Close();
                    }
                    else
                    {
                        mysqlcon.Open();
                        string insertquery = @"insert into `questions_logs` (question_id,student_id,student_answer_id)values(" + povresultrequest.questionid[i]
                                             + "," + povresultrequest.student_id + "," + povresultrequest.optionid[i] + ")";
                        MySqlCommand insertcmd = new MySqlCommand(insertquery, mysqlcon);
                        insertcmd.ExecuteNonQuery();
                        mysqlcon.Close();
                    }
                }

                #endregion

                # region Quiz Result
예제 #2
0
    private void PointOfViewResponse(SocketIO.SocketIOEvent E)
    {
        print(E.data.ToString());
        POVResult rr = JsonConvert.DeserializeObject <POVResult>(E.data.ToString());

        print("pov response");
        if (rr.State)
        {
            if (rr.POV == 2)
            {
                print("playing as black");
                Camera.main.GetComponent <CameraController>().whiteTurn();
            }
            else
            {
                Camera.main.GetComponent <CameraController>().BlackTurn();
                print("playing as white");
            }
            tileSize = tilePrefab1.GetComponent <Renderer>().bounds.size;
            size     = new Vector3(tileSize.x * 10, tileSize.y, tileSize.z * 10);
            CreateGrid();
        }
    }