public async Task <StudentDashboard> StudentDashBoard(string studentId)
        {
            var httpClient = new HttpClient();
            var taskModels = new StudentDashboard();
            var newUrl     = _webServiceUrl + "?id=" + studentId;
            var json       = JsonConvert.SerializeObject(studentId);

            HttpContent httpContent = new StringContent(json);

            try
            {
                //var request = new HttpRequestMessage(HttpMethod.Post, newUrl);

                var result = await httpClient.PostAsync(newUrl, httpContent);

                var content = await result.Content.ReadAsStringAsync();

                taskModels = JsonConvert.DeserializeObject <StudentDashboard>(content);
            }
            catch (Exception e)
            {
                taskModels.Message = e.Message;
            }

            return(taskModels);
        }
 private void btnSignin_Click(object sender, EventArgs e)
 {
     if (userNameTextBox.Text == "" || userPasswordTextBox.Text == "")
     {
         MessageBox.Show("Username or password can not be empty");
     }
     else
     {
         UserService    userService    = new UserService();
         StudentService studentService = new StudentService();
         bool           userResult     = userService.LoginValidation(userNameTextBox.Text, userPasswordTextBox.Text);
         bool           studentResult  = studentService.LoginValidation(userNameTextBox.Text, userPasswordTextBox.Text);
         if (userResult)
         {
             Dashboard dashboard = new Dashboard();
             dashboard.Show();
             this.Hide();
         }
         else if (studentResult)
         {
             StudentDashboard student = new StudentDashboard();
             student.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Invalid User Name or Password!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        public void Login(Form _form)
        {
            loginProxy = new LoginProxy();
            var user = loginProxy.Login(UserName, Password);

            if (user != null)
            {
                if (user.AccountLevel == "admin")
                {
                    _form.Hide();
                    Form admin = new AdminDashboard();
                    admin.Show();
                }
                else if (user.AccountLevel == "student")
                {
                    _form.Hide();
                    Form student = new StudentDashboard(user.RegistrationID.ToString());
                    student.Show();
                }
                else if (user.AccountLevel == "teacher")
                {
                    _form.Hide();
                    Form teacher = new TeacherDashboard(user.RegistrationID.ToString());
                    teacher.Show();
                }
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password!");
            }
        }
Exemple #4
0
        private void Login()
        {
            if (string.IsNullOrWhiteSpace(txtUserName.Text))
            {
                MessageBox.Show("Username is required");
                return;
            }
            if (string.IsNullOrWhiteSpace(txtPassword.Text))
            {
                MessageBox.Show("password is required");
                return;
            }

            var loginrequest = new LoginRequestViewModel()
            {
                UserName = txtUserName.Text,
                Password = txtPassword.Text
            };
            var result = Services.UserService.Login(loginrequest);

            if (result.Status)
            {
                switch (result.Type)
                {
                case Common.UserType.Student:
                    StudentDashboard student = new StudentDashboard(result);
                    student.Show();
                    break;

                case Common.UserType.Teacher:
                    TeacherDashboard teacher = new TeacherDashboard(result);
                    teacher.Show();
                    break;

                case Common.UserType.Parent:
                    break;

                case Common.UserType.Admin:

                    AdminDashboard admin = new AdminDashboard(result);
                    admin.Show();
                    break;

                default:
                    break;
                }
                this.Hide();
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
        private async void ListItemClicked(int position)
        {
            Android.Support.V4.App.Fragment fragment = null;
            switch (position)
            {
            case 0:
                int       id   = int.Parse(ap.getAccessKey());
                string    url  = "http://housechecker.co.uk/api/export.php";
                JsonValue json = await FetchUserAsync(url);

                string         jsonString      = json.ToString();
                List <Student> listOfLandlords = JsonConvert.DeserializeObject <List <Student> >(jsonString);
                var            user            = listOfLandlords.Where(a => a.Id == id).FirstOrDefault();

                if (user.Type == "Landlord")
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Add Property");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Properties");
                    // If the user type is Landlord, it sets the two extra features to these options
                }
                else
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Favourite Properties");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Reviews");
                    // If you're a student the options are different
                }
                // Gets the list of users and finds the one that matches your ID

                usernameDisplay = FindViewById <TextView>(Resource.Id.navBarHeader);
                // Gets the display name for the nav bar


                if (user.Type == "Landlord")
                {
                    fragment             = LandlordDashboard.NewInstance();
                    usernameDisplay.Text = user.CompanyName;
                    // Sets the name to company name if you are a landlord
                }
                else
                {
                    fragment             = StudentDashboard.NewInstance();
                    usernameDisplay.Text = user.Name;
                    // And to username if you are a student
                }
                break;

            case 1:
                fragment = PropertyDetail.NewInstance();
                Bundle idBundle = new Bundle();
                idBundle.PutString("accomID", "77");
                fragment.Arguments = idBundle;
                // This code calls the new fragment and places it on the screen aka loading a new page
                break;

            case 2:
                fragment = SearchPage.NewInstance();
                break;

            case 3:
                fragment = Profile.NewInstance();
                break;

            case 4:
                if (userType == "Landlord")
                {
                    fragment = AddProperty.NewInstance();
                }
                else
                {
                    fragment = DisplayFavourites.NewInstance();
                }
                break;

            case 5:
                if (userType == "Landlord")
                {
                    fragment = MyProperties.NewInstance();
                }
                else
                {
                    fragment = MyReviews.NewInstance();
                }
                break;

            case 6:
                id   = int.Parse(ap.getAccessKey());
                url  = "http://housechecker.co.uk/api/export.php";
                json = await FetchUserAsync(url);

                jsonString      = json.ToString();
                listOfLandlords = JsonConvert.DeserializeObject <List <Student> >(jsonString);
                user            = listOfLandlords.Where(a => a.Id == id).FirstOrDefault();

                if (user.Type == "Landlord")
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Add Property");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Properties");
                    // If the user type is Landlord, it sets the two extra features to these options
                }
                else
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Favourite Properties");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Reviews");
                    // If you're a student the options are different
                }
                // Gets the list of users and finds the one that matches your ID

                url  = "http://housechecker.co.uk/api/display.php";
                json = await FetchUserAsync(url);

                jsonString = json.ToString();
                var addressList = JsonConvert.DeserializeObject <List <Address> >(jsonString);

                accomID  = addressList.Where(a => a.address1 == markerTitle).FirstOrDefault().id;
                fragment = PropertyDetail.NewInstance();
                Bundle bundle = new Bundle();
                bundle.PutString("accomID", accomID.ToString());
                fragment.Arguments = bundle;
                // Gets the accomodation that has been clicked on from the map page and then loads it
                break;
            }

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
            // Commits the transaction
        }
        public ActionResult Dashboard()
        {
            string  dashboardOutput           = StudentWeb.GetStudentDetails(Convert.ToInt32(Session["UserId"].ToString()));
            JObject studentUnderParentparsing = JObject.Parse(dashboardOutput);

            // load login details in student general class
            StudentGeneralDetails _studentDetails = new StudentGeneralDetails();

            _studentDetails.BoardName       = (String)studentUnderParentparsing["Table"][0]["BoardName"];
            _studentDetails.CityName        = (String)studentUnderParentparsing["Table"][0]["CityName"];
            _studentDetails.ClassName       = (String)studentUnderParentparsing["Table"][0]["ClassName"];
            _studentDetails.DistrictName    = (String)studentUnderParentparsing["Table"][0]["DistrictName"];
            _studentDetails.EmailAddress    = (String)studentUnderParentparsing["Table"][0]["EmailAddress"];
            _studentDetails.Name            = (String)studentUnderParentparsing["Table"][0]["FirstName"];
            _studentDetails.PhoneNumber     = (String)studentUnderParentparsing["Table"][0]["PhoneNumber"];
            _studentDetails.StateName       = (String)studentUnderParentparsing["Table"][0]["StateName"];
            _studentDetails.StudentId       = (Int32)studentUnderParentparsing["Table"][0]["StudentId"];
            _studentDetails.InstitutionName = (String)studentUnderParentparsing["Table"][0]["InstitutionName"];

            // Create Object for class
            StudentDashboard     _StudentDashboardDetails     = new StudentDashboard();
            StudentRank          _StudentRankDetails          = new StudentRank();
            OverallAvailableTest _StudentOverallAvailableTest = new OverallAvailableTest();
            OverallLastFiveTest  _StudentOverallLastFiveTest  = new OverallLastFiveTest();
            // Get Dashboard Details with respect to student id form service
            String _GetStudentDashboardDetails = StudentWeb.StudentDashboardDetails(Convert.ToInt32(Session["UserId"].ToString()));
            // Get Student Rank Details form service with respect to student id
            String _GetStudentDashboardDetails1 = StudentWeb.GetStudentDashboard(Convert.ToInt32(Session["UserId"].ToString()));
            // Parse the student dashbord details form Json Student dashboard
            JObject Studentparsing = JObject.Parse(_GetStudentDashboardDetails);
            // parse the student rank details form Json Student dashboard Details1
            JObject Studentparsing1 = JObject.Parse(_GetStudentDashboardDetails1);
            //
            int _studentPerformanceCount = Studentparsing["Table3"].Count();

            _StudentRankDetails.CityRank        = (Int32)Studentparsing1["Table"][0]["CityRank"];
            _StudentRankDetails.DistrictRank    = (Int32)Studentparsing1["Table"][0]["DistrictRank"];
            _StudentRankDetails.InstitutionRank = (Int32)Studentparsing1["Table"][0]["InstitutionRank"];
            _StudentRankDetails.StateRank       = (Int32)Studentparsing1["Table"][0]["StateRank"];

            int _SubjectPercentageCount = (Int32)Studentparsing["Table1"].Count();

            List <SubjectPercentage> _SubjectPercentageList = new List <SubjectPercentage>();

            for (int i = 0; i < _SubjectPercentageCount; i++)
            {
                SubjectPercentage _Subjectpercentage = new SubjectPercentage();
                _Subjectpercentage.SubjectId   = (Int32)Studentparsing["Table1"][i]["SubjectId"];
                _Subjectpercentage.Percentage  = (Int32)Studentparsing["Table1"][i]["Percentage"];
                _Subjectpercentage.SubjectName = (String)Studentparsing["Table1"][i]["SubjectName"];
                _SubjectPercentageList.Add(_Subjectpercentage);
            }

            List <OverallLastFiveTest> _LastFiveTestList = new List <OverallLastFiveTest>();
            int _LastFiveTestCountCount = (Int32)Studentparsing["Table2"].Count();

            if (_LastFiveTestCountCount > 5)
            {
                _LastFiveTestCountCount = 5;
            }

            for (int i = 0; i < _LastFiveTestCountCount; i++)
            {
                OverallLastFiveTest _LastFiveTest = new OverallLastFiveTest();
                _LastFiveTest.SubjectID   = (Int32)Studentparsing["Table2"][i]["SubjectId"];
                _LastFiveTest.Percentage  = (Int32)Studentparsing["Table2"][i]["Percentage"];
                _LastFiveTest.SubjectName = (String)Studentparsing["Table2"][i]["SubjectName"];
                _LastFiveTest.TestId      = (Int32)Studentparsing["Table2"][i]["TestId"];
                _LastFiveTest.TestType    = (String)Studentparsing["Table2"][i]["TestType"];
                _LastFiveTestList.Add(_LastFiveTest);
            }
            int _OverallAvailableTestCount = (Int32)Studentparsing["Table3"].Count();
            //Studentparsing["Table3"].Count();
            List <OverallAvailableTest> _OverallAvailableTestList = new List <OverallAvailableTest>();


            //If Test Count is more than 5 show only  five test
            //It is not last five test
            if (_OverallAvailableTestCount > 5)
            {
                _OverallAvailableTestCount = 5;
            }

            // adding five test details
            for (int i = 0; i < _OverallAvailableTestCount; i++)
            {
                OverallAvailableTest _OverallAvailableTest = new OverallAvailableTest();
                _OverallAvailableTest.SubjectID   = (Int32)Studentparsing["Table3"][i]["SubjectId"];
                _OverallAvailableTest.SubjectName = (String)Studentparsing["Table3"][i]["SubjectName"];
                _OverallAvailableTest.TestId      = (Int32)Studentparsing["Table3"][i]["TestId"];
                _OverallAvailableTest.TestType    = (String)Studentparsing["Table3"][i]["TestType"];
                _OverallAvailableTestList.Add(_OverallAvailableTest);
            }

            //ADding Subject in Global
            int _SubjectCount = (Int32)Studentparsing["Table4"].Count();


            List <StudentSubjects> _SubjectDetailsList = new List <StudentSubjects>();

            for (int i = 0; i < _SubjectCount; i++)
            {
                StudentSubjects _SubjectDetails = new StudentSubjects();
                _SubjectDetails.SubjectName = (String)Studentparsing["Table4"][i]["SubjectName"];
                _SubjectDetails.SubjectID   = (Int32)Studentparsing["Table4"][i]["SubjectId"];

                _SubjectDetailsList.Add(_SubjectDetails);
            }

            // Get the Rows Count in Good, Bad and Average

            int goodPerformingCount    = Studentparsing["Table5"].Count(); // Good performace
            int averagePerformingCount = Studentparsing["Table6"].Count(); // Average performance
            int badPerformingCount     = Studentparsing["Table7"].Count(); // Bad performance
            //  Create Object for Good, Average, Bad list
            List <GoodPerformingSubject>    _goodPerformingSubjectList    = new List <GoodPerformingSubject>();
            List <AveragePerformingSubject> _averagePerformingSubjectList = new List <AveragePerformingSubject>();
            List <BadPerformingSubject>     _badPerformingSubjectList     = new List <BadPerformingSubject>();

            // Add good performing into list
            #region Good Performing
            if (goodPerformingCount > 0)
            {
                if (goodPerformingCount > 5)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        GoodPerformingSubject _goodPerformingSubject = new GoodPerformingSubject();
                        _goodPerformingSubject.SubjectId   = (Int32)Studentparsing["Table5"][i]["SubjectId"];
                        _goodPerformingSubject.SubjectName = (string)Studentparsing["Table5"][i]["SubjectName"];
                        _goodPerformingSubject.LessionId   = (Int32)Studentparsing["Table5"][i]["LessionId"];
                        _goodPerformingSubject.LessionName = (string)Studentparsing["Table5"][i]["LessionName"];
                        _goodPerformingSubject.Topic       = (string)Studentparsing["Table5"][i]["Topic"];
                        _goodPerformingSubject.Percentage  = (Int32)Studentparsing["Table5"][i]["Percentage"];
                        _goodPerformingSubjectList.Add(_goodPerformingSubject);
                    }
                }
                else
                {
                    for (int i = 0; i < goodPerformingCount; i++)
                    {
                        GoodPerformingSubject _goodPerformingSubject = new GoodPerformingSubject();
                        _goodPerformingSubject.SubjectId   = (Int32)Studentparsing["Table5"][i]["SubjectId"];
                        _goodPerformingSubject.SubjectName = (string)Studentparsing["Table5"][i]["SubjectName"];
                        _goodPerformingSubject.LessionId   = (Int32)Studentparsing["Table5"][i]["LessionId"];
                        _goodPerformingSubject.LessionName = (string)Studentparsing["Table5"][i]["LessionName"];
                        _goodPerformingSubject.Topic       = (string)Studentparsing["Table5"][i]["Topic"];
                        _goodPerformingSubject.Percentage  = (Int32)Studentparsing["Table5"][i]["Percentage"];
                        _goodPerformingSubjectList.Add(_goodPerformingSubject);
                    }
                }
            }
            #endregion
            // Add Average performing list
            #region Average Performing

            if (averagePerformingCount > 0)
            {
                if (averagePerformingCount > 5)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        AveragePerformingSubject _AveragePerformingSubject = new AveragePerformingSubject();
                        _AveragePerformingSubject.SubjectId   = (Int32)Studentparsing["Table6"][i]["SubjectId"];
                        _AveragePerformingSubject.SubjectName = (string)Studentparsing["Table6"][i]["SubjectName"];
                        _AveragePerformingSubject.LessionId   = (Int32)Studentparsing["Table6"][i]["LessionId"];
                        _AveragePerformingSubject.LessionName = (string)Studentparsing["Table6"][i]["LessionName"];
                        _AveragePerformingSubject.Topic       = (string)Studentparsing["Table6"][i]["Topic"];
                        _AveragePerformingSubject.Percentage  = (Int32)Studentparsing["Table6"][i]["Percentage"];
                        _averagePerformingSubjectList.Add(_AveragePerformingSubject);
                    }
                }
                else
                {
                    for (int i = 0; i < averagePerformingCount; i++)
                    {
                        AveragePerformingSubject _AveragePerformingSubject = new AveragePerformingSubject();
                        _AveragePerformingSubject.SubjectId   = (Int32)Studentparsing["Table6"][i]["SubjectId"];
                        _AveragePerformingSubject.SubjectName = (string)Studentparsing["Table6"][i]["SubjectName"];
                        _AveragePerformingSubject.LessionId   = (Int32)Studentparsing["Table6"][i]["LessionId"];
                        _AveragePerformingSubject.LessionName = (string)Studentparsing["Table6"][i]["LessionName"];
                        _AveragePerformingSubject.Topic       = (string)Studentparsing["Table6"][i]["Topic"];
                        _AveragePerformingSubject.Percentage  = (Int32)Studentparsing["Table6"][i]["Percentage"];
                        _averagePerformingSubjectList.Add(_AveragePerformingSubject);
                    }
                }
            }
            #endregion
            //  Add Bad Performing List
            #region Bad Performing
            if (badPerformingCount > 0)
            {
                if (badPerformingCount > 5)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        BadPerformingSubject _BadPerformingSubject = new BadPerformingSubject();
                        _BadPerformingSubject.SubjectId   = (Int32)Studentparsing["Table7"][i]["SubjectId"];
                        _BadPerformingSubject.SubjectName = (string)Studentparsing["Table7"][i]["SubjectName"];
                        _BadPerformingSubject.LessionId   = (Int32)Studentparsing["Table7"][i]["LessionId"];
                        _BadPerformingSubject.LessionName = (string)Studentparsing["Table7"][i]["LessionName"];
                        _BadPerformingSubject.Topic       = (string)Studentparsing["Table7"][i]["Topic"];
                        _BadPerformingSubject.Percentage  = (Int32)Studentparsing["Table7"][i]["Percentage"];
                        _badPerformingSubjectList.Add(_BadPerformingSubject);
                    }
                }
                else
                {
                    for (int i = 0; i < badPerformingCount; i++)
                    {
                        BadPerformingSubject _BadPerformingSubject = new BadPerformingSubject();
                        _BadPerformingSubject.SubjectId   = (Int32)Studentparsing["Table7"][i]["SubjectId"];
                        _BadPerformingSubject.SubjectName = (string)Studentparsing["Table7"][i]["SubjectName"];
                        _BadPerformingSubject.LessionId   = (Int32)Studentparsing["Table7"][i]["LessionId"];
                        _BadPerformingSubject.LessionName = (string)Studentparsing["Table7"][i]["LessionName"];
                        _BadPerformingSubject.Topic       = (string)Studentparsing["Table7"][i]["Topic"];
                        _BadPerformingSubject.Percentage  = (Int32)Studentparsing["Table7"][i]["Percentage"];
                        _badPerformingSubjectList.Add(_BadPerformingSubject);
                    }
                }
            }
            #endregion

            _StudentDashboardDetails.OverallAvailableTest     = _OverallAvailableTestList;
            _StudentDashboardDetails.OverallLastFiveTest      = _LastFiveTestList;
            _StudentDashboardDetails.StudentRank              = _StudentRankDetails;
            _StudentDashboardDetails.SubjectPercentage        = _SubjectPercentageList;
            _StudentDashboardDetails.StudentGeneralDetails    = _studentDetails;
            _StudentDashboardDetails.GoodPerformingSubject    = _goodPerformingSubjectList;
            _StudentDashboardDetails.AveragePerformingSubject = _averagePerformingSubjectList;
            _StudentDashboardDetails.BadPerformingSubject     = _badPerformingSubjectList;

            return(View(_StudentDashboardDetails));
        }
Exemple #7
0
        public ActionResult Index()
        {
            StudentGeneralDetails objStudentLoginDetails = new StudentGeneralDetails();

            objStudentLoginDetails.BoardName    = GlobalStudentClass.BoardName;
            objStudentLoginDetails.CityName     = GlobalStudentClass.CityName;
            objStudentLoginDetails.ClassName    = GlobalStudentClass.ClassName;
            objStudentLoginDetails.DistrictName = GlobalStudentClass.DistrictName;
            objStudentLoginDetails.EmailAddress = GlobalStudentClass.EmailAddress;
            objStudentLoginDetails.Name         = GlobalStudentClass.Name;
            objStudentLoginDetails.PhoneNumber  = GlobalStudentClass.PhoneNumber;
            objStudentLoginDetails.StateName    = GlobalStudentClass.StateName;
            objStudentLoginDetails.StudentId    = GlobalStudentClass.StudentId;

            objStudentLoginDetails.InstitutionName = GlobalStudentClass.InstitutionName;

            StudentDashboard     _StudentDashboardDetails     = new StudentDashboard();
            StudentRank          _StudentRankDetails          = new StudentRank();
            OverallAvailableTest _StudentOverallAvailableTest = new OverallAvailableTest();
            OverallLastFiveTest  _StudentOverallLastFiveTest  = new OverallLastFiveTest();

            String _GetStudentDashboardDetails  = StudentWeb.StudentDashboardDetails(GlobalStudentClass.StudentId);
            String _GetStudentDashboardDetails1 = StudentWeb.GetStudentDashboard(GlobalStudentClass.StudentId);

            JObject Studentparsing  = JObject.Parse(_GetStudentDashboardDetails);
            JObject Studentparsing1 = JObject.Parse(_GetStudentDashboardDetails1);

            _StudentRankDetails.CityRank        = (Int32)Studentparsing1["Table"][0]["CityRank"];
            _StudentRankDetails.DistrictRank    = (Int32)Studentparsing1["Table"][0]["DistrictRank"];
            _StudentRankDetails.InstitutionRank = (Int32)Studentparsing1["Table"][0]["InstitutionRank"];
            _StudentRankDetails.StateRank       = (Int32)Studentparsing1["Table"][0]["StateRank"];

            int _SubjectPercentageCount = (Int32)Studentparsing["Table1"].Count();

            List <SubjectPercentage> _SubjectPercentageList = new List <SubjectPercentage>();

            for (int i = 0; i < _SubjectPercentageCount; i++)
            {
                SubjectPercentage _Subjectpercentage = new SubjectPercentage();
                _Subjectpercentage.SubjectId   = (Int32)Studentparsing["Table1"][i]["SubjectId"];
                _Subjectpercentage.Percentage  = (Int32)Studentparsing["Table1"][i]["Percentage"];
                _Subjectpercentage.SubjectName = (String)Studentparsing["Table1"][i]["SubjectName"];
                _SubjectPercentageList.Add(_Subjectpercentage);
            }
            List <OverallLastFiveTest> _LastFiveTestList = new List <OverallLastFiveTest>();
            int _LastFiveTestCountCount = (Int32)Studentparsing["Table2"].Count();

            for (int i = 0; i < _LastFiveTestCountCount; i++)
            {
                OverallLastFiveTest _LastFiveTest = new OverallLastFiveTest();
                _LastFiveTest.SubjectID   = (Int32)Studentparsing["Table2"][i]["SubjectId"];
                _LastFiveTest.Percentage  = (Int32)Studentparsing["Table2"][i]["Percentage"];
                _LastFiveTest.SubjectName = (String)Studentparsing["Table2"][i]["SubjectName"];
                _LastFiveTest.TestId      = (Int32)Studentparsing["Table2"][i]["TestId"];
                _LastFiveTest.TestType    = (String)Studentparsing["Table2"][i]["TestType"];
                _LastFiveTestList.Add(_LastFiveTest);
            }


            List <OverallAvailableTest> _OverallAvailableTestList = new List <OverallAvailableTest>();

            for (int i = 0; i < 5; i++)
            {
                OverallAvailableTest _OverallAvailableTest = new OverallAvailableTest();
                _OverallAvailableTest.SubjectID   = (Int32)Studentparsing["Table3"][i]["SubjectId"];
                _OverallAvailableTest.SubjectName = (String)Studentparsing["Table3"][i]["SubjectName"];
                _OverallAvailableTest.TestId      = (Int32)Studentparsing["Table3"][i]["TestId"];
                _OverallAvailableTest.TestType    = (String)Studentparsing["Table3"][i]["TestType"];
                _OverallAvailableTestList.Add(_OverallAvailableTest);
            }

            //ADding Subject in Global
            int _SubjectCount = (Int32)Studentparsing["Table4"].Count();


            List <SubjectDetails> _SubjectDetailsList = new List <SubjectDetails>();

            for (int i = 0; i < _SubjectCount; i++)
            {
                SubjectDetails _SubjectDetails = new SubjectDetails();
                _SubjectDetails.SubjectName = (String)Studentparsing["Table4"][i]["SubjectName"];
                _SubjectDetails.SubjectID   = (Int32)Studentparsing["Table4"][i]["SubjectId"];

                _SubjectDetailsList.Add(_SubjectDetails);
            }

            GlobalStudentSubjects.SubjectList = _SubjectDetailsList;

            _StudentDashboardDetails.OverallAvailableTest  = _OverallAvailableTestList;
            _StudentDashboardDetails.OverallLastFiveTest   = _LastFiveTestList;
            _StudentDashboardDetails.StudentRank           = _StudentRankDetails;
            _StudentDashboardDetails.SubjectPercentage     = _SubjectPercentageList;
            _StudentDashboardDetails.StudentGeneralDetails = objStudentLoginDetails;
            return(View(_StudentDashboardDetails));
        }
        public ActionResult Index(int StudentId)
        {
            GlobalStudentID = StudentId;
            StudentGeneralDetails objStudentLoginDetails   = new StudentGeneralDetails();
            StudentDashboard      _StudentDashboardDetails = new StudentDashboard();

            if (GlobalStudentID != 0)
            {
                String  _GetStudentGeneralDetails    = SupportWeb.GetStudentDetails(GlobalStudentID);
                JObject StudentGeneralDetailsparsing = JObject.Parse(_GetStudentGeneralDetails);

                objStudentLoginDetails.BoardName    = (string)StudentGeneralDetailsparsing["Table"][0]["BoardName"];
                objStudentLoginDetails.CityName     = (string)StudentGeneralDetailsparsing["Table"][0]["CityName"];
                objStudentLoginDetails.ClassName    = (string)StudentGeneralDetailsparsing["Table"][0]["ClassName"];
                objStudentLoginDetails.DistrictName = (string)StudentGeneralDetailsparsing["Table"][0]["DistrictName"];
                objStudentLoginDetails.EmailAddress = (string)StudentGeneralDetailsparsing["Table"][0]["EmailAddress"];
                objStudentLoginDetails.Name         = (string)StudentGeneralDetailsparsing["Table"][0]["FirstName"];
                objStudentLoginDetails.PhoneNumber  = (string)StudentGeneralDetailsparsing["Table"][0]["PhoneNumber"];
                objStudentLoginDetails.GroupId      = (int)StudentGeneralDetailsparsing["Table"][0]["GroupId"];

                objStudentLoginDetails.StudentId = GlobalStudentID;

                objStudentLoginDetails.InstitutionName = (string)StudentGeneralDetailsparsing["Table"][0]["InstitutionName"];


                StudentRank          _StudentRankDetails          = new StudentRank();
                OverallAvailableTest _StudentOverallAvailableTest = new OverallAvailableTest();
                OverallLastFiveTest  _StudentOverallLastFiveTest  = new OverallLastFiveTest();

                String  _GetStudentDashboardDetails1 = SupportWeb.GetStudentDashboard(GlobalStudentID);
                String  _GetStudentDashboardDetails  = SupportWeb.StudentDashboardDetails(GlobalStudentID);
                JObject Studentparsing = JObject.Parse(_GetStudentDashboardDetails);

                JObject Studentparsing1 = JObject.Parse(_GetStudentDashboardDetails1);
                try
                {
                    _StudentRankDetails.CityRank        = (Int32)Studentparsing1["Table"][0]["CityRank"];
                    _StudentRankDetails.DistrictRank    = (Int32)Studentparsing1["Table"][0]["DistrictRank"];
                    _StudentRankDetails.InstitutionRank = (Int32)Studentparsing1["Table"][0]["InstitutionRank"];
                    _StudentRankDetails.StateRank       = (Int32)Studentparsing1["Table"][0]["StateRank"];
                }
                catch
                {
                    return(RedirectToAction("CheckStudentDetails", "CustomerSupport"));
                }
                int _SubjectPercentageCount = (Int32)Studentparsing["Table1"].Count();

                List <SubjectPercentage> _SubjectPercentageList = new List <SubjectPercentage>();
                for (int i = 0; i < _SubjectPercentageCount; i++)
                {
                    SubjectPercentage _Subjectpercentage = new SubjectPercentage();
                    _Subjectpercentage.SubjectId   = (Int32)Studentparsing["Table1"][i]["SubjectId"];
                    _Subjectpercentage.Percentage  = (Int32)Studentparsing["Table1"][i]["Percentage"];
                    _Subjectpercentage.SubjectName = (String)Studentparsing["Table1"][i]["SubjectName"];
                    _SubjectPercentageList.Add(_Subjectpercentage);
                }
                List <OverallLastFiveTest> _LastFiveTestList = new List <OverallLastFiveTest>();
                int _LastFiveTestCountCount = (Int32)Studentparsing["Table2"].Count();

                for (int i = 0; i < _LastFiveTestCountCount; i++)
                {
                    OverallLastFiveTest _LastFiveTest = new OverallLastFiveTest();
                    _LastFiveTest.SubjectID   = (Int32)Studentparsing["Table2"][i]["SubjectId"];
                    _LastFiveTest.Percentage  = (Int32)Studentparsing["Table2"][i]["Percentage"];
                    _LastFiveTest.SubjectName = (String)Studentparsing["Table2"][i]["SubjectName"];
                    _LastFiveTest.TestId      = (Int32)Studentparsing["Table2"][i]["TestId"];
                    _LastFiveTest.TestType    = (String)Studentparsing["Table2"][i]["TestType"];
                    _LastFiveTestList.Add(_LastFiveTest);
                }


                List <OverallAvailableTest> _OverallAvailableTestList = new List <OverallAvailableTest>();

                for (int i = 0; i < 5; i++)
                {
                    OverallAvailableTest _OverallAvailableTest = new OverallAvailableTest();
                    _OverallAvailableTest.SubjectID   = (Int32)Studentparsing["Table3"][i]["SubjectId"];
                    _OverallAvailableTest.SubjectName = (String)Studentparsing["Table3"][i]["SubjectName"];
                    _OverallAvailableTest.TestId      = (Int32)Studentparsing["Table3"][i]["TestId"];
                    _OverallAvailableTest.TestType    = (String)Studentparsing["Table3"][i]["TestType"];
                    _OverallAvailableTestList.Add(_OverallAvailableTest);
                }

                //ADding Subject in Global
                int _SubjectCount = (Int32)Studentparsing["Table4"].Count();


                List <StudentSubjects> _SubjectDetailsList = new List <StudentSubjects>();
                for (int i = 0; i < _SubjectCount; i++)
                {
                    StudentSubjects _SubjectDetails = new StudentSubjects();
                    _SubjectDetails.SubjectName = (String)Studentparsing["Table4"][i]["SubjectName"];
                    _SubjectDetails.SubjectID   = (Int32)Studentparsing["Table4"][i]["SubjectId"];

                    _SubjectDetailsList.Add(_SubjectDetails);
                }

                _StudentDashboardDetails.StudentSubjects = _SubjectDetailsList;

                _StudentDashboardDetails.OverallAvailableTest  = _OverallAvailableTestList;
                _StudentDashboardDetails.OverallLastFiveTest   = _LastFiveTestList;
                _StudentDashboardDetails.StudentRank           = _StudentRankDetails;
                _StudentDashboardDetails.SubjectPercentage     = _SubjectPercentageList;
                _StudentDashboardDetails.StudentGeneralDetails = objStudentLoginDetails;
                return(View(_StudentDashboardDetails));
            }
            else
            {
                _StudentDashboardDetails = null;
                return(View(_StudentDashboardDetails));
            }
        }