Beispiel #1
0
        public async Task create(StudentReg student)
        {
            Response <Object> response = await db.post <Object>(apiUri + "register", null, student);

            if (!response.IsSuccess)
            {
                throw new StudentNotRegistered(response.DisplayMessage);
            }
        }
Beispiel #2
0
        private async void doRegister(StudentReg stdReg)
        {
            LoadingOverlay.Instance.showLoading(this);
            StudentList stdList = new StudentList();

            try{
                await stdList.create(stdReg);

                await this.DismissViewControllerAsync(true);
            }
            catch (Exception ex) {
                AppParam.Instance.showAlertMessage("Register", "Registration Fail!");
                Console.WriteLine(ex);
            }
        }
Beispiel #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            degreeTextField    = DegreeText;
            statusTextField    = StatusText;
            educationTextField = EducationBackground;

            //handle back button action
            backButton.Clicked += (o, e) => {
                this.DismissViewControllerAsync(true);
            };

            //check null for my profile
            if (AppParam.Instance.student != null)
            {
                navBar.TopItem.Title = "My Profile";

                Student tmpStudent = AppParam.Instance.student;
                degreeTextField.Text    = tmpStudent.degree == Degree.PostGrad ? "Postgraduate" : "Undergraduate";
                statusTextField.Text    = tmpStudent.status == Status.International ? "International" : "Permanent";
                educationTextField.Text = "HSC";
                CountryOrigin.Text      = tmpStudent.country_origin;
                PreferedName.Text       = tmpStudent.preferred_name;
                FirstLanguage.Text      = tmpStudent.first_language;

                degreeTextField.UserInteractionEnabled    = false;
                statusTextField.UserInteractionEnabled    = false;
                educationTextField.UserInteractionEnabled = false;
                PreferedName.UserInteractionEnabled       = false;
                FirstLanguage.UserInteractionEnabled      = false;
                CountryOrigin.UserInteractionEnabled      = false;


                SubmitButton.Hidden = true;
            }
            else
            {
                //Init degree picker
                CreatePicker();
                // Perform any additional setup after loading the view, typically from a nib.

                degreeTextField.TouchDown += (object sender, EventArgs e) => {
                    myPickerView.Model = new PickerModel(this, pickerTypeArr [0]);
                    ShowPicker(myPickerView);
                };

                statusTextField.TouchDown += (object sender, EventArgs e) => {
                    myPickerView.Model = new PickerModel(this, pickerTypeArr [1]);
                    ShowPicker(myPickerView);
                };

                educationTextField.TouchDown += (object sender, EventArgs e) => {
                    myPickerView.Model = new PickerModel(this, pickerTypeArr [2]);
                    ShowPicker(myPickerView);
                };

                this.SubmitButton.TouchUpInside += (o, e) => {
                    if (validation())
                    {
                        StudentReg stdReg = new StudentReg();
                        stdReg.StudentId     = this.currentStudentID;
                        stdReg.PreferredName = PreferedName.Text;
                        stdReg.Degree        = degreeTextField.Text.Equals("Undergraduate")?Degree.UnderGrad:Degree.PostGrad;
                        stdReg.Status        = statusTextField.Text.Equals("International")?Status.International:Status.Permanent;
                        stdReg.FirstLanguage = "English";
                        stdReg.CountryOrigin = "Australia";
                        stdReg.HSC           = true;
                        stdReg.CreatorId     = AppParam.CreatorId;

                        doRegister(stdReg);
                    }
                };
            }
        }