public static async Task SaveProfile(Student student) { WriteToStudentFile (student.studentID); KeyValuePair<string, object>[] values = new KeyValuePair<string, object>[]{ new KeyValuePair<string, object>("StudentId", student.studentID), new KeyValuePair<string, object>("DateOfBirth", student.dob), new KeyValuePair<string, object>("Gender", student.gender), new KeyValuePair<string, object>("Degree", student.degree), new KeyValuePair<string, object>("Status", student.status), new KeyValuePair<string, object>("FirstLanguage", student.first_language), new KeyValuePair<string, object>("CountryOrigin", student.country_origin), new KeyValuePair<string, object>("Background", student.background), new KeyValuePair<string, object>("DegreeDetails", student.degree_details), new KeyValuePair<string, object>("AltContact", student.alternative_contact), new KeyValuePair<string, object>("PreferredName", student.preferred_name), new KeyValuePair<string, object>("HSC", student.HSC), new KeyValuePair<string, object>("HSCMark", student.HSC_mark), new KeyValuePair<string, object>("IELTS", student.IELTS), new KeyValuePair<string, object>("IELTSMark", student.IELTS_mark), new KeyValuePair<string, object>("TOEFL", student.TOEFL), new KeyValuePair<string, object>("TOEFLMark", student.TOEFL_mark), new KeyValuePair<string, object>("TAFE", student.TAFE), new KeyValuePair<string, object>("TAFEMark", student.TAFE_mark), new KeyValuePair<string, object>("CULT", student.CULT), new KeyValuePair<string, object>("CULTMark", student.CULT_mark), new KeyValuePair<string, object>("InsearchDEEP", student.InsearchDEEP), new KeyValuePair<string, object>("InsearchDEEPMark", student.InsearchDEEP_mark), new KeyValuePair<string, object>("InsearchDiploma", student.InsearchDiploma), new KeyValuePair<string, object>("InsearchDiplomaMark", student.InsearchDiploma_mark), new KeyValuePair<string, object>("FoundationCourse", student.foundationcourse), new KeyValuePair<string, object>("FoundationCourseMark", student.foundationcourse_mark), new KeyValuePair<string, object>("CreatorId", student.creatorID) }; await RESTClass.PostStudent(values); }
protected override void OnCreate(Bundle bundle) { string userId = ""; string password = ""; ProgressDialog ProgressDialogLogin = null; try { base.OnCreate(bundle); SetContentView(Resource.Layout.Login); Button btnLogin = FindViewById <Button>(Resource.Id.btnLogin); EditText tbStudentID = FindViewById <EditText>(Resource.Id.tbStudentID); EditText tbPassword = FindViewById <EditText>(Resource.Id.tbPassword); LinearLayout llRoot = FindViewById <LinearLayout>(Resource.Id.llRoot); TextView txtmessage = FindViewById <TextView>(Resource.Id.txtmessage); txtmessage.Visibility = ViewStates.Invisible; tbStudentID.Text = userId; tbPassword.Text = password; llRoot.Click += delegate { //Dismiss Keybaord InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(tbStudentID.WindowToken, 0); btnLogin.RequestFocus(); }; btnLogin.Click += async delegate { try { userId = tbStudentID.Text; if (String.IsNullOrWhiteSpace(tbStudentID.Text) || String.IsNullOrWhiteSpace(tbPassword.Text)) { txtmessage.Text = "Please enter your Student Id and Password."; txtmessage.Visibility = ViewStates.Visible; } else { if (ProgressDialogLogin == null) { ProgressDialogLogin = ProgressDialog.Show(this, "", "Logging In..."); Student student = await RESTClass.GetStudent(userId); if (student != null) { Globals.LoggedStudent = student; if (Globals.StudentExists(student.studentID)) //Finds out if the studentid is in the text file and fills out globals if true { Globals.IsNewStudent = false; Globals.SetGlobalVars(student.studentID); StartActivity(new Intent(this, typeof(MainMenuActivity))); } else { Globals.IsNewStudent = true; StartActivity(new Intent(this, typeof(ProfileActivity))); } } else { txtmessage.Text = "This is not a vaid UTS ID."; txtmessage.Visibility = ViewStates.Visible; } if (ProgressDialogLogin != null) { ProgressDialogLogin.Dismiss(); ProgressDialogLogin = null; } } } } catch (Exception e) { ErrorHandling.LogError(e, this); if (ProgressDialogLogin != null) { ProgressDialogLogin.Dismiss(); ProgressDialogLogin = null; } } }; } catch (Exception e) { ErrorHandling.LogError(e, this); } finally { if (ProgressDialogLogin != null) { ProgressDialogLogin.Dismiss(); ProgressDialogLogin = null; } } }