Exemplo n.º 1
0
        /*
         * Lây thông tin ca thi từ sql server
         */
        public TestExamInfo GetTestInfo(int casetestid)
        {
            try {
                conn.Open();
                SqlCommand cmd = new SqlCommand("GET_TEST_EXAMS", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@INT_EXAM_ID", SqlDbType.Int);
                cmd.Parameters["@INT_EXAM_ID"].Value = casetestid;

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string x = reader[1].ToString();
                    x = x.ToString();
                    var tei = new TestExamInfo(
                        Convert.ToInt32(reader[0]),
                        Convert.ToDateTime(reader[1]),
                        Convert.ToInt32(reader[2]),
                        Convert.ToInt32(reader[3]),
                        Convert.ToInt32(reader[4]),
                        (reader[5]).ToString(),
                        reader[6].ToString()
                        );
                    return(tei);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(null);
        }
Exemplo n.º 2
0
        public IActionResult GetAllStudentInTestExam(string id)
        {
            TestExamInfo tei = tep.GetTestInfo(Convert.ToInt32(id));

            tep.conn.Close();
            List <Students> lsts     = new List <Students>();
            string          out_mess = "";

            lsts                        = tep.GetALlStudentOfTestExam(Convert.ToInt32(id), out out_mess);
            ViewBag.Message             = out_mess;
            ViewData["ComputerCount"]   = tei.ComputerCount;
            ViewData["CoumputerNumber"] = tei.ComputerNumber;
            ViewData["Date"]            = tei.ExamDate.ToString("dd-MM-yyyy");
            ViewData["SubjectName"]     = tei.SubjectName;
            var order = "7h-9h";
            var hour  = tei.RoomOrder;

            if (hour == 1)
            {
                order = "7h-9h";
            }
            if (hour == 2)
            {
                order = "9h-11h";
            }
            if (hour == 3)
            {
                order = "11h-13h";
            }
            if (hour == 4)
            {
                order = "13h-15h";
            }
            if (hour == 5)
            {
                order = "15h-17h";
            }
            if (hour == 6)
            {
                order = "17h-19h";
            }

            ViewData["ExamOrder"]    = order;
            ViewData["ClassOrder"]   = tei.RoomOrder;
            ViewData["RoomLocation"] = tei.RoomLocation;
            return(View("StundetTestExam", lsts));
        }