コード例 #1
0
        public async void LoadCourseworkSettings(string username, string cs_code, string course_nm, string sem, string yr, string acad, string progcode, string sess)
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    //retrive the course work settings.
                    string myURL = MobileConfig.GetWebAddress(campus) + string.
                                   Format("DataFinder.aspx?dataFormat=courseworksettings&empcode={0}&acad={1}&semester={2}" +
                                          "&course_id={3}&prog_id={4}&session={5}&intake=-&cyear={6}", username, acad, sem, cs_code, progcode, sess, yr);
                    var content = await _client.GetStringAsync(myURL);

                    //saving our json data locally
                    //await DisplayAlert("", "" + content, "Ok");
                    MobileConfig.set_course_work_settings(content);
                    setCourseWorkSettings();
                }
                else
                {
                    setCourseWorkSettings();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error :  " + ex);
            }


            setCourseWorkSettings();
        }
コード例 #2
0
        public async Task SaveCourseworkUpdates()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                App_activity_indicator.IsVisible = true;
                App_activity_indicator.IsRunning = true;

                var url = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                          Format("DataFinder.aspx?dataFormat=UpdateCourseWork&cw1={0}&cw2={1}&cw3={2}&cw4={3}&cw5={4}&compFormat={5}&cwid={6}",
                                 txtAss1.Text, txtAss2.Text, txtAss3.Text, txtAss4.Text, txtAss5.Text, MobileConfig.get_coursework_compForm(), CWID);
                var response = await _client.PostAsync(url, null);

                var responseContent = await response.Content.ReadAsStringAsync();

                // set the server reply a message to the Display Alert
                await DisplayAlert("IUIU Mobile", "" + responseContent, "Ok");

                App_activity_indicator.IsVisible = false;
                App_activity_indicator.IsRunning = false;
            }
            else
            {
                App_activity_indicator.IsVisible = false;
                App_activity_indicator.IsRunning = false;
                await DisplayAlert("No internet Connection", "Sorry, please first connect to the internet.", "Ok");
            }
        }
コード例 #3
0
        public async Task SaveExamUpdates()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                App_activity_indicator.IsVisible = true;
                App_activity_indicator.IsRunning = true;

                var url = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                          Format("DataFinder.aspx?dataFormat=UpdateExamMarks&q1={0}&q2={1}&q3={2}&q4={3}&q5={4}&q6={5}&q7={6}&q8={7}&q9={8}&q10={9}&typ={10}&exid={11}",
                                 txtAss1.Text, txtAss2.Text, txtAss3.Text, txtAss4.Text, txtAss5.Text, txtAss6.Text, txtAss7.Text, txtAss8.Text, txtAss9.Text, txtAss10.Text,
                                 Application.Current.Properties["examstat"], _EXID);
                var response = await _client.PostAsync(url, null);

                var responseContent = await response.Content.ReadAsStringAsync();

                // set the server reply a message to the Display Alert
                await DisplayAlert("IUIU Mobile", "" + responseContent, "Ok");

                App_activity_indicator.IsVisible = false;
                App_activity_indicator.IsRunning = false;
            }
            else
            {
                App_activity_indicator.IsVisible = false;
                App_activity_indicator.IsRunning = false;
                await DisplayAlert("No internet Connection", "Sorry, please first connect to the internet.", "Ok");
            }
        }
コード例 #4
0
        public async void LoadExamSettings(string username, string cs_code, string sem, string yr, string acad, string prog_id, string sess)
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    //retrive the course work settings.

                    string myURL = MobileConfig.
                                   GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.Format("DataFinder.aspx?dataFormat=examsettings&empcode={0}&acad={1}&semester={2}" +
                                                                                                                      "&course_id={3}&prog_id={4}&session={5}&intake=-&cyear={6}", username, acad, sem, cs_code, prog_id, sess, yr);


                    var content = await _client.GetStringAsync(myURL);

                    //Debug.WriteLine("URL ->  " + myURL);
                    //await DisplayAlert("General Error!  ", "" + myURL, "Ok");
                    //saving our json data locally
                    MobileConfig.set_exam_results(content);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error huxy :  " + ex);
            }
            setExamresultsSettings();
        }
コード例 #5
0
        async Task Submission()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                // retrieving data saved locally and formatting it to JSON object.
                string saved_data = MobileConfig.get_exam_results().Replace("[", "").Replace("]", "");
                //deserializing JSON object.
                Debug.WriteLine("DATA : " + saved_data);
                var des_json        = JsonConvert.DeserializeObject <Model.Examresultssettings>(saved_data);
                int exam_settingsID = des_json.examSettingsID;

                var url = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                          Format("DataFinder.aspx?dataFormat=SubmitExamResults&EXID={0}", exam_settingsID);

                var response = await _client.PostAsync(url, null);

                var responseContent = await response.Content.ReadAsStringAsync();

                // set the server reply a message to the Display Alert
                await DisplayAlert("IUIU Mobile", "" + responseContent, "OK");
            }

            else
            {
                await DisplayAlert("Connection Error!", "sorry, please first connect to the internet.", "Ok");
            }
        }
コード例 #6
0
        public async void saveSettings()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                // retrieving data saved locally and formatting it to JSON object.
                string saved_data = MobileConfig.get_exam_results().Replace("[", "").Replace("]", "");
                //deserializing JSON object.
                Debug.WriteLine("DATA : " + saved_data);
                var    des_json        = JsonConvert.DeserializeObject <Model.Examresultssettings>(saved_data);
                string lecturerID      = des_json.lecturerID;
                int    exam_settingsID = des_json.examSettingsID;
                string acadYr          = des_json.acadyear;
                string sem             = "" + des_json.semester;
                string course_id       = "" + des_json.course_id;
                string prog_id         = "" + des_json.progid;
                string intake          = "-";
                string sess            = "" + des_json.studSession;
                string cyear           = "" + des_json.cyear;
                string mark1           = txtAss1.Text;
                string mark2           = txtAss2.Text;
                string mark3           = txtAss3.Text;
                string mark4           = txtAss4.Text;
                string mark5           = txtAss5.Text;
                string mark6           = txtAss6.Text;
                string mark7           = txtAss7.Text;
                string mark8           = txtAss8.Text;
                string mark9           = txtAss9.Text;
                string mark10          = txtAss10.Text;
                string examratio       = txtEXPercent.Text;
                string cwk_ratio       = txtCWPercent.Text;
                string exam_format     = "";
                string noQns           = "0";
                string finalMark       = txtTotal.Text;


                var url = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                          Format("DataFinder.aspx?dataFormat=ExamSettingsEdit&acad={0}&semester={1}&course_id={2}" +
                                 "&prog_id={3}&intake={4}&sess={5}&cyear={6}&maxQ1={7}&maxQ2={8}&maxQ3={9}" +
                                 "&maxQ4={10}&maxQ5={11}&maxQ6={12}&maxQ7={13}&maxQ8={14}&maxQ9={15}" +
                                 "&maxQ10={16}&cwRatio={17}&examRatio={18}&noQns={19}&" +
                                 "maxTotal={20}&EXID={21}&examFormat={22}&empcode={23}",
                                 acadYr, sem, course_id, prog_id, intake, sess, cyear
                                 , mark1, mark2, mark3, mark4, mark5, mark6, mark7, mark8, mark9, mark10,
                                 cwk_ratio, examratio, noQns, finalMark, exam_settingsID, exam_format, lecturerID);

                Debug.WriteLine("POST : " + url);

                var response = await _client.PostAsync(url, null);

                var responseContent = await response.Content.ReadAsStringAsync();

                // set the server reply a message to the Display Alert
                await DisplayAlert("", "" + responseContent, "Ok");
            }

            else
            {
                await DisplayAlert("No internet Connection", "sorry, please first connect to the internet.", "Ok");
            }
        }
コード例 #7
0
        protected async Task RefreshResults()
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    string exid     = MobileConfig.get_exam_settings_id();
                    string examstat = txt_status.SelectedItem.ToString();
                    string stream   = txt_stream.SelectedItem.ToString();
                    Application.Current.Properties["examstat"] = examstat;
                    //await DisplayAlert("EXID ", exid, "OK");
                    try
                    {
                        App_activity_indicator.IsVisible = true;
                        App_activity_indicator.IsRunning = true;
                        string webaddress = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                                            Format("DataFinder.aspx?dataFormat=examresults&EXID={0}&examStat={1}&stream={2}",
                                                   exid, examstat, stream);
                        var content = await _client.GetStringAsync(webaddress);

                        // Debug.WriteLine("Exam Results DATA -> ", content);
                        //await DisplayAlert("Content! ", content, "OK");

                        if (content != "[]")
                        {
                            // save the data locally.

                            MobileConfig.save_exam_results_sheet(content);
                            App_activity_indicator.IsRunning = false;
                            DisplayResults();
                        }
                        else
                        {
                            await DisplayAlert("Content Error! ", "No Results Found", "OK");
                        }
                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                        DisplayResults();
                    }
                    catch (Exception ex)
                    {
                        await DisplayAlert("General Error! ", ex.Message, "OK");

                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                    }
                }
                else
                {
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                //await DisplayAlert("Final Error! ", e.Message, "OK");
                DisplayResults();
            }
        }
コード例 #8
0
        public async void saveSettings()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                // retrieving data saved locally and formatting it to JSON object.
                string saved_data = MobileConfig.get_course_work_settings_json().Replace("[", "").Replace("]", "");
                //deserializing JSON object.
                //await DisplayAlert("", "" + saved_data, "Ok");
                var des_json = JsonConvert.DeserializeObject <Model.CourseworkSettings>(saved_data);

                string lecture_id = des_json.cs_lecturerID;
                string acadYr     = des_json.cs_acadYear;
                string sem        = "" + des_json.cs_semester;
                string course_id  = "" + des_json.cs_courseID;
                string prog_id    = "" + des_json.progid;
                string intake     = "-";
                string sess       = "" + des_json.cs_session;
                string cyear      = "" + des_json.cs_year;
                string assn1      = txtAss1.Text;
                string assn2      = txtAss2.Text;
                string assn3      = txtAss3.Text;
                string Test1      = txtAss4.Text;
                string Test2      = txtAss5.Text;;
                string noTask     = "0";
                string finalMark  = txtTotal.Text;
                string csid       = "" + des_json.CSID;
                string compFormat = "" + txt_compformat.Items[txt_compformat.SelectedIndex];

                Debug.WriteLine("acadyer " + acadYr + " compFormat : " + compFormat);



                var url = MobileConfig.GetWebAddress(campus) + string.
                          Format("DataFinder.aspx?dataFormat=courseworksettingsEdit&acad={0}&semester={1}&course_id={2}" +
                                 "&prog_id={3}&intake={4}&sess={5}&cyear={6}&assn_1={7}&assn_2={8}&assn_3={9}" +
                                 "&test_1={10}&test_2={11}&noTasks={12}&finalMark={13}&CSID={14}&empcode={15}" +
                                 "&compFormat={16}", acadYr, sem, course_id, prog_id, intake, sess, cyear
                                 , assn1, assn2, assn3, Test1, Test2, noTask, finalMark, csid, lecture_id, compFormat);

                //await DisplayAlert("","POST : " + url,"OK");

                var response = await _client.PostAsync(url, null);

                var responseContent = await response.Content.ReadAsStringAsync();

                // set the server reply a message to the Display Alert
                await DisplayAlert("", "" + responseContent, "Ok");
            }

            else
            {
                await DisplayAlert("No internet Connection", "sorry, please first connect to the internet.", "Ok");
            }
        }
コード例 #9
0
        protected async Task RefreshResults()
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    string stream = txt_stream.SelectedItem.ToString();
                    //await DisplayAlert("CSID ", "CSID="+CSID, "OK");
                    try
                    {
                        App_activity_indicator.IsVisible = true;
                        App_activity_indicator.IsRunning = true;
                        string webaddress = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                                            Format("DataFinder.aspx?dataFormat=courseworkresults&CSID={0}&stream={1}", MobileConfig.get_coursework_settings_id(), stream);
                        var content = await _client.GetStringAsync(webaddress);

                        //await DisplayAlert("Content", "CSID=" + MobileConfig.get_coursework_settings_id(), "OK");
                        if (content != "[]")
                        {
                            MobileConfig.save_coursework_results_sheet(content);
                            App_activity_indicator.IsRunning = false;
                            DisplayResults();
                        }
                        else
                        {
                            await DisplayAlert("Content Error! ", "No Results Found", "OK");
                        }
                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                        DisplayResults();
                    }
                    catch (Exception ex)
                    {
                        await DisplayAlert("General Error! ", ex.Message, "OK");

                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                    }
                }
                else
                {
                    await DisplayAlert("Error! ", "No Internet Connection", "OK");
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                await DisplayAlert("Final Error! ", e.Message, "OK");

                DisplayResults();
            }
            DisplayResults();
        }