Exemplo n.º 1
0
        private void GetStudentNumber()
        {
            //Initialize GetStudent Request
            Student.GetStudentInfoRequest requestGetStudent = new Student.GetStudentInfoRequest();
            requestGetStudent.TokenId = tokenId;

            //Create the GetStudentInMsg
            Student.GetStudentInMsg inMsgStudent = new Student.GetStudentInMsg();
            inMsgStudent.CorrelationId = correlationID;
            inMsgStudent.StudentId = int.Parse(Session["StudentID"].ToString()); // StudentID;

            //Bind GetStudentInMsg to the request
            requestGetStudent.Students = new Student.GetStudentInMsg[1];
            requestGetStudent.Students[0] = inMsgStudent;

            //Instantiate a Student service and url.
            Student.StudentWebService serviceStudent = new Student.StudentWebService();
            string urlStudent = System.Configuration.ConfigurationManager.AppSettings["StudentURL"];
            serviceStudent.Url = urlStudent;

            //Create GetStudent Response and pass in the request through the Student service
            Student.GetStudentInfoResponse responseGetStudent = serviceStudent.GetStudentInfo(requestGetStudent);

            //TODO - Check GetStudentInfoResponse - If not "OK" then handle somehow somewhere.
            if (responseGetStudent.TrxResult == "OK")
                StudentNumber = responseGetStudent.Students[0].StudentNumber.Trim();
            else
                StudentNumber = "0";  //TODO - is necessary??
        }