public static void GetPatientDetails(string _patientRef) { try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method WS_Patient_GetByPatientRef_Request _patientProfileRequest = new WS_Patient_GetByPatientRef_Request(); _patientProfileRequest.patientRef = _patientRef; // connect! and grab the response code from hitting the web service... WS_Patient_GetByPatientRef_Response _patientProfileResponse = new WS_Patient_GetByPatientRef_Response(); _patientProfileResponse = _webService.route_Patient_GetByPatientRef(_patientProfileRequest); if (_patientProfileResponse.responseCode > 0) { Common.patientId = _patientProfileResponse.patient.patientId; Common.title = _patientProfileResponse.patient.title; Common.surname = _patientProfileResponse.patient.surname; Common.firstName = _patientProfileResponse.patient.firstName; Common.birthDate = _patientProfileResponse.patient.birthDate; Common.nationalIdentificationNumber = _patientProfileResponse.patient.nationalIdentificationNumber; Common.contactEmail = _patientProfileResponse.patient.contactEmail; Common.contactAddress = _patientProfileResponse.patient.contactAddress; Common.contactAddressState = _patientProfileResponse.patient.contactAddressState; Common.contactTelephone = _patientProfileResponse.patient.contactTelephone; Common.contactTelephone2 = _patientProfileResponse.patient.contactTelephone2; Common.contactTelephone3 = _patientProfileResponse.patient.contactTelephone3; Common.occupation = _patientProfileResponse.patient.occupation; Common.insuranceIdentificationNumber = _patientProfileResponse.patient.insuranceIdentificationNumber; Common.photograph = _patientProfileResponse.patient.photograph; Common.signature = _patientProfileResponse.patient.signature; Common.password = _patientProfileResponse.patient.password; Common.gender = _patientProfileResponse.patient.gender; Common.remark3 = _patientProfileResponse.patient.remark3; Common.remark4 = _patientProfileResponse.patient.remark4; Common.remark5 = _patientProfileResponse.patient.remark5; Common.remark6 = _patientProfileResponse.patient.remark6; Common.remark7 = _patientProfileResponse.patient.remark7; Common.remark8 = _patientProfileResponse.patient.remark8; Common.remark9 = _patientProfileResponse.patient.remark9; // get header information (CurrentDrawInfo) Common.patientName = (title + " " + firstName + " " + surname); //.ToUpper(); // retrieve Player's current location as well GetCurrentLocation(); } else { // do nothing throw new Exception("Your Profile could not be retrieved at this time. Please try again later."); } } catch (Exception ex) { throw ex; } }
public static List <String> GetAllHospitals() { List <String> ret = new List <String> { "Please choose a hospital {0}" }; try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method // no input parameter // connect! and grab the response code from hitting the web service... WS_Hospitals_GetAll_Response _hospitalsResponse = new WS_Hospitals_GetAll_Response(); _hospitalsResponse = _webService.route_Hospitals_GetAll(); int hospitalsCount = _hospitalsResponse.responseCode; if (hospitalsCount > 0) { for (int i = 0; i < hospitalsCount; i++) { ret.Add(_hospitalsResponse.hospitals[i].hospitalDescription); } return(ret); } else { // do nothing throw new Exception("The Hospitals Database is currently empty. Please try again at a later time."); } } catch (Exception genEx) { throw genEx; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.NewSurveyLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); Button btnNewSurvey = FindViewById <Button> (Resource.Id.games_button); btnNewSurvey.Enabled = true; btnNewSurvey.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(NewSurveyActivity)); dataToTransfer.PutExtra("go", "Games"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnSurveys = FindViewById <Button> (Resource.Id.account_button); btnSurveys.Enabled = true; btnSurveys.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(UpdateProfileActivity)); dataToTransfer.PutExtra("go", "MyAccount"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnProfile = FindViewById <Button> (Resource.Id.result_button); btnProfile.Enabled = true; btnProfile.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(MySurveysActivity)); dataToTransfer.PutExtra("go", "Results"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnInfo = FindViewById <Button> (Resource.Id.info_button); btnInfo.Enabled = true; btnInfo.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(InfoContactActivity)); dataToTransfer.PutExtra("go", "Info"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnLogout = FindViewById <Button> (Resource.Id.logout_button); btnLogout.Enabled = true; btnLogout.Click += delegate { if (Common.loggedIn) { //set all user variables to null and return to the login screen Common.Logout(); var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); this.Finish(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; // set some header information string patientName; patientName = Common.patientName; FindViewById <TextView> (Resource.Id.account_number).Text = "Logged In: " + Common.patientName; // populate the Hospitals spinner Spinner spinnerHospitals = FindViewById <Spinner> (Resource.Id.spinnerHospitals); List <String> hospitals = Common.GetAllHospitals(); ArrayAdapter <String> hospitalsAdapter = new ArrayAdapter <String> (this, Android.Resource.Layout.SimpleSpinnerItem, hospitals); hospitalsAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerHospitals.Adapter = hospitalsAdapter; lstNewSurveyDetailItems = FindViewById <ListView>(Resource.Id.List5); // get reference to the ListView in the layout // populate the listview with data // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method // no input parameter // connect! and grab the response code from hitting the web service... WS_HospitalRatings_GetAll_Response _ratingsResponse = new WS_HospitalRatings_GetAll_Response(); _ratingsResponse = _webService.route_HospitalRatings_GetAll(); if (_ratingsResponse.responseCode > 0) { // communicate success to the user _ratings = _ratingsResponse.hospitalRatings; int batchCount = _ratings.Length; if (batchCount > 0) { int desiredHeight = (280 * batchCount); lstNewSurveyDetailItems.LayoutParameters.Height = desiredHeight; for (int i = 0; i < batchCount; i++) { newSurveyDetailItems.Add(new SurveyQuestionItem() { hospitalRatingId = _ratings[i].hospitalRatingId, hospitalRatingGroup = _ratings[i].hospitalRatingGroup, hospitalRatingDepartment = _ratings[i].hospitalRatingDepartment, hospitalRatingTitle = _ratings[i].hospitalRatingTitle, remark1 = _ratings[i].remark1, remark2 = _ratings[i].remark2, remark3 = _ratings[i].remark3 }); } newSurveyDetailItems = newSurveyDetailItems.OrderBy(a => a.hospitalRatingId).ToList(); lstNewSurveyDetailItems.Adapter = new NewSurveyDetailAdapter(this, newSurveyDetailItems); // lstSurveyHistoryDetailItems.ItemClick += OnListItemClick; // Sometimes, the parent ScrollView object interferes with the scrollability of child ListViews. // lstsurveyHistoryDetailItems.Touch += ListViewOnTouch; } } else { new AlertDialog.Builder(this) .SetTitle("Info") .SetMessage("The Survey Questions Database is currently empty.\n\nPlease try again at a later time.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception Ex) { //Console.WriteLine("This is the InnerException message: " + ((SoapException) ex).Detail.InnerXml.ToString()); new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + Ex.Message + "\n\nStack Trace: " + Ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.MySurveysLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); Button btnNewSurvey = FindViewById <Button> (Resource.Id.games_button); btnNewSurvey.Enabled = true; btnNewSurvey.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(NewSurveyActivity)); dataToTransfer.PutExtra("go", "Games"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnSurveys = FindViewById <Button> (Resource.Id.account_button); btnSurveys.Enabled = true; btnSurveys.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(UpdateProfileActivity)); dataToTransfer.PutExtra("go", "MyAccount"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnProfile = FindViewById <Button> (Resource.Id.result_button); btnProfile.Enabled = true; btnProfile.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(MySurveysActivity)); dataToTransfer.PutExtra("go", "Results"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnInfo = FindViewById <Button> (Resource.Id.info_button); btnInfo.Enabled = true; btnInfo.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(InfoContactActivity)); dataToTransfer.PutExtra("go", "Info"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnLogout = FindViewById <Button> (Resource.Id.logout_button); btnLogout.Enabled = true; btnLogout.Click += delegate { if (Common.loggedIn) { //set all user variables to null and return to the login screen Common.Logout(); var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); this.Finish(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; // set some header information string patientName; patientName = Common.patientName; FindViewById <TextView> (Resource.Id.account_number).Text = "Logged In: " + Common.patientName; lstSurveyHistoryItems = FindViewById <ListView>(Resource.Id.List5); // get reference to the ListView in the layout // populate the listview with data // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method WS_HospitalRatingResponseBatches_GetFromSinglePatient_Request _responseBatchesRequest = new WS_HospitalRatingResponseBatches_GetFromSinglePatient_Request(); _responseBatchesRequest.patientRef = Common.patientRef; // connect! and grab the response code from hitting the web service... WS_HospitalRatingResponseBatches_GetFromSinglePatient_Response _responseBatchesResponse = new WS_HospitalRatingResponseBatches_GetFromSinglePatient_Response(); _responseBatchesResponse = _webService.route_HospitalRatingResponseBatches_GetFromSinglePatient(_responseBatchesRequest); if (_responseBatchesResponse.responseCode > 0) { //communicate success to the user _responseBatches = _responseBatchesResponse.hospitalRatingResponseBatches; int batchCount = _responseBatches.Length; if (batchCount > 0) { int desiredHeight = (200 * batchCount); lstSurveyHistoryItems.LayoutParameters.Height = desiredHeight; for (int i = 0; i < batchCount; i++) { surveyHistoryItems.Add(new SurveyHistoryItem() { hospitalRef = _responseBatches[i].hospitalRef, hospitalName = _responseBatches[i].hospitalName, patientRef = _responseBatches[i].patientRef, surveyDate = _responseBatches[i].dateTimeStamp, surveyDateRaw = _responseBatches[i].dateTimeStampRaw }); } surveyHistoryItems = surveyHistoryItems.OrderByDescending(a => a.surveyDateRaw).ToList(); lstSurveyHistoryItems.Adapter = new SurveyHistoryAdapter(this, surveyHistoryItems); lstSurveyHistoryItems.ItemClick += OnListItemClick; // Sometimes, the parent ScrollView object interferes with the scrollability of child ListViews. // lstSurveyHistoryItems.Touch += ListViewOnTouch; } } else { new AlertDialog.Builder(this) .SetTitle("Info") .SetMessage("Your Survey History is currently empty.\n\nPlease go to 'New Survey' to get started.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception Ex) { //Console.WriteLine("This is the InnerException message: " + ((SoapException) ex).Detail.InnerXml.ToString()); new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + Ex.Message + "\n\nStack Trace: " + Ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.Register); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); // Set spinner properties Spinner spinnerTitle = FindViewById <Spinner> (Resource.Id.r_spinnerTitle); var questionsAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.registration_title_array, Android.Resource.Layout.SimpleSpinnerItem); questionsAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerTitle.Adapter = questionsAdapter; Spinner spinnerStates = FindViewById <Spinner> (Resource.Id.r_spinnerState); var statesAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.registration_states_array, Android.Resource.Layout.SimpleSpinnerItem); statesAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerStates.Adapter = statesAdapter; // set spinner callback spinnerTitle.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerTitle_ItemSelected); spinnerStates.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerStates_ItemSelected); // Set radioGroup callback RadioButton rdoFemale = FindViewById <RadioButton>(Resource.Id.r_rdoGenderF); rdoFemale.Click += RadioButtonClick; RadioButton rdoMale = FindViewById <RadioButton>(Resource.Id.r_rdoGenderM); rdoMale.Click += RadioButtonClick; CheckBox chkAgreeTerms = FindViewById <CheckBox> (Resource.Id.chkAgreeTerms); string legalText = "By checking this box, I certify that I have read, and agree to be bound by, the Terms and Conditions and Privacy Policy of Aesulapius HealthCare Consultants." + Common.newLine + Common.newLine; legalText += "I also certify that I am at least 18 years of age."; chkAgreeTerms.Text = legalText; // Get the Register button from the layout resource, and attach an event to it Button btnNextStageOfRegistration = FindViewById <Button> (Resource.Id.r_btnNext); btnNextStageOfRegistration.Click += delegate { // grab user-supplied values // patientRef wil be generated at run-time and supplied server-side password = FindViewById <EditText> (Resource.Id.r_editTextPassword1).Text.Trim(); // title ==> Whenever this selection is changed in the UI, a SelectedItem event is fired for the Spinner object... lastName = FindViewById <EditText> (Resource.Id.r_editTextSurname).Text.Trim(); firstName = FindViewById <EditText> (Resource.Id.r_editTextFirstName).Text.Trim(); // gender ==> Whenever this selection is changed in the UI, a Click event is fired for the RadioGroup object... dateOfBirth = FindViewById <DatePicker> (Resource.Id.r_datePickerDateOfBirth).DateTime; nationalIdentificationNumber = ""; // FindViewById<EditText> (Resource.Id.r_editTextNationalIdentificationNumber).Text.Trim(); contactEmail = FindViewById <EditText> (Resource.Id.r_editTextEmail).Text.Trim(); contactAddress = FindViewById <EditText> (Resource.Id.r_editTextAddressLine1).Text.Trim(); // contactAddressState ==> Whenever this selection is changed in the UI, a SelectedItem event is fired for the Spinner object... contactAddressCountry = FindViewById <EditText> (Resource.Id.r_editTextCountry).Text.Trim(); contactTelephone = FindViewById <EditText> (Resource.Id.r_editTextTelephone).Text.Trim(); contactTelephone2 = FindViewById <EditText> (Resource.Id.r_editTextTelephone2).Text.Trim(); contactTelephone3 = FindViewById <EditText> (Resource.Id.r_editTextTelephone3).Text.Trim(); occupation = FindViewById <EditText> (Resource.Id.r_editTextOccupation).Text.Trim(); insuranceIdentificationNumber = ""; // FindViewById<EditText> (Resource.Id.r_editTextInsuranceIdentificationNumber).Text.Trim(); // photograph ==> unused, for now // signature ==> unused, for now agreedToTerms = FindViewById <CheckBox> (Resource.Id.chkAgreeTerms).Checked; try { // new AlertDialog.Builder(this) // .SetTitle("Info") // .SetMessage("Gender|State|Security is currently: "+ gender + "|" + state + "|" + securityQuestion.ToString()) // .SetPositiveButton("Close", (s, e) => { }) // .Show(); if (agreedToTerms) { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the player registration parameters WS_Patient_AddNew_Request _registerPatientRequest = new WS_Patient_AddNew_Request(); _registerPatientRequest.password = password; _registerPatientRequest.title = title; _registerPatientRequest.surname = lastName; _registerPatientRequest.firstName = firstName; _registerPatientRequest.gender = gender; _registerPatientRequest.birthDate = dateOfBirth; _registerPatientRequest.nationalIdentificationNumber = nationalIdentificationNumber; _registerPatientRequest.contactEmail = contactEmail; _registerPatientRequest.contactAddress = contactAddress; _registerPatientRequest.contactAddressState = contactAddressState; _registerPatientRequest.contactTelephone = contactTelephone; _registerPatientRequest.contactTelephone2 = contactTelephone2; _registerPatientRequest.contactTelephone3 = contactTelephone3; _registerPatientRequest.occupation = occupation; _registerPatientRequest.insuranceIdentificationNumber = insuranceIdentificationNumber; _registerPatientRequest.photograph = photograph; _registerPatientRequest.signature = signature; // connect! and grab the response code from hitting the web service... WS_Patient_AddNew_Response _registerPatientResponse = new WS_Patient_AddNew_Response(); _registerPatientResponse = _webService.route_Patient_AddNew(_registerPatientRequest); if (_registerPatientResponse.responseCode > 0) { new AlertDialog.Builder(this) .SetTitle("Success") .SetMessage("Congrats.\n\nRegistration was successful.") .SetPositiveButton("Close", (s, e) => { var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); }) .Show(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nRegistration was NOT successful.\n\nUnexpected Response Code received.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } else { // User did not click checkbox to agree to terms of registration new AlertDialog.Builder(this) .SetTitle("Info") .SetMessage("You must check the box above to tell us that you have agreed to the Terms and Conditions and Privacy Policy governing the HQI Service." + Common.newLine + Common.newLine + "We cannot process your registration unless you agree." + Common.newLine + Common.newLine + "Please check the box and try again.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception ex) { if (ex.Message.Contains("ConnectFailure")) { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nIt appears your device is not connected at this time." + Common.newLine + Common.newLine + "Please verify that your device is connected and try again." + Common.newLine + Common.newLine + "Hint: Check your Wi-Fi and/or 3G connection(s).") .SetPositiveButton("Close", (s, e) => { }) .Show(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + ex.Message + "\n\nStack Trace: " + ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Load the UI created in Main.axml RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.ForgotPasswordLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); Button btnLogin = FindViewById <Button> (Resource.Id.fgp_btnLogin); btnLogin.Click += delegate { var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); }; // Get the button from the layout resource, and attach an event to it Button btnRetrieve = FindViewById <Button> (Resource.Id.fgp_btnRetrieve); btnRetrieve.Click += delegate { // grab user-supplied values contactEmail = FindViewById <EditText> (Resource.Id.txtEmail).Text.Trim(); try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the sign-on parameters: essentially username and password WS_Patient_GetByEmail_Request _getPatientByEmailRequest = new WS_Patient_GetByEmail_Request(); _getPatientByEmailRequest.contactEmail = contactEmail; // connect! and grab the response code from hitting the web service... WS_Patient_GetByEmail_Response _getPatientByEmailResponse = new WS_Patient_GetByEmail_Response(); _getPatientByEmailResponse = _webService.route_Patient_GetByEmail(_getPatientByEmailRequest); if (_getPatientByEmailResponse.responseCode > 0) { // send the retrieved password, by e-mail, to user string emailText = "Congrats.\n\nYour password was successfully retrieved.\n\nYour password is " + _getPatientByEmailResponse.patient.password + ".\n\nKind regards,\n\nThe HQI Team.\n\n<a href='http://www.aesculapiusvn.com'>www.aesculapiusvn.com</a>"; string[] emailAddresses = new string[] { _getPatientByEmailResponse.patient.contactEmail }; string emailSubject = "HQI - Your password retrieval request."; if (Common.SendEmail(emailText, emailSubject, emailAddresses)) { // communicate success to the user new AlertDialog.Builder(this) .SetTitle("Success") .SetMessage("Congrats.\n\nYour password was successfully retrieved, and has been sent to the email address you supplied (" + contactEmail + ").") .SetPositiveButton("Close", (s, e) => { }) .Show(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn error occurred that prevented us from sending your retrieved password to you by e-mail.\n\nPlease try again.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn error occurred that prevented the retrieval of your password.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception ex) { //Console.WriteLine("This is the InnerException message: " + ((SoapException) ex).Detail.InnerXml.ToString()); new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + ex.Message + "\n\nStack Trace: " + ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.UpdateProfileLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); Button btnNewSurvey = FindViewById <Button> (Resource.Id.games_button); btnNewSurvey.Enabled = true; btnNewSurvey.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(NewSurveyActivity)); dataToTransfer.PutExtra("go", "Games"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnSurveys = FindViewById <Button> (Resource.Id.account_button); btnSurveys.Enabled = true; btnSurveys.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(UpdateProfileActivity)); dataToTransfer.PutExtra("go", "MyAccount"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnProfile = FindViewById <Button> (Resource.Id.result_button); btnProfile.Enabled = true; btnProfile.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(MySurveysActivity)); dataToTransfer.PutExtra("go", "Results"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnInfo = FindViewById <Button> (Resource.Id.info_button); btnInfo.Enabled = true; btnInfo.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(InfoContactActivity)); dataToTransfer.PutExtra("go", "Info"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnLogout = FindViewById <Button> (Resource.Id.logout_button); btnLogout.Enabled = true; btnLogout.Click += delegate { if (Common.loggedIn) { //set all user variables to null and return to the login screen Common.Logout(); var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); this.Finish(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; // set some header information string patientName; patientName = Common.patientName; FindViewById <TextView> (Resource.Id.account_number).Text = "Logged In: " + Common.patientName; // Set spinner properties (Titles) Spinner spinnerTitles = FindViewById <Spinner> (Resource.Id.r_spinnerTitle); var adapterTitles = ArrayAdapter.CreateFromResource(this, Resource.Array.registration_title_array, Android.Resource.Layout.SimpleSpinnerItem); adapterTitles.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerTitles.Adapter = adapterTitles; // Set spinner properties (States) Spinner spinnerStates = FindViewById <Spinner> (Resource.Id.r_spinnerState); var adapterStates = ArrayAdapter.CreateFromResource(this, Resource.Array.registration_states_array, Android.Resource.Layout.SimpleSpinnerItem); adapterStates.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerStates.Adapter = adapterStates; // set spinner callback spinnerTitles.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerTitles_ItemSelected); spinnerStates.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerStates_ItemSelected); try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method WS_Patient_GetByPatientRef_Request _patientProfileRequest = new WS_Patient_GetByPatientRef_Request(); _patientProfileRequest.patientRef = Common.patientRef; // connect! and grab the response code from hitting the web service... WS_Patient_GetByPatientRef_Response _patientProfileResponse = new WS_Patient_GetByPatientRef_Response(); _patientProfileResponse = _webService.route_Patient_GetByPatientRef(_patientProfileRequest); if (_patientProfileResponse.responseCode > 0) { // communicate success to the user FindViewById <TextView> (Resource.Id.upd_Email).Text = _patientProfileResponse.patient.contactEmail; email = _patientProfileResponse.patient.contactEmail; spinnerTitles.SetSelection(Common.GetSpinnerIndex(spinnerTitles, _patientProfileResponse.patient.title)); title = _patientProfileResponse.patient.title; FindViewById <EditText> (Resource.Id.upd_LastName).Text = _patientProfileResponse.patient.surname; surname = _patientProfileResponse.patient.surname; FindViewById <EditText> (Resource.Id.upd_FirstName).Text = _patientProfileResponse.patient.firstName; firstName = _patientProfileResponse.patient.firstName; FindViewById <EditText> (Resource.Id.upd_DateOfBirth).Text = _patientProfileResponse.patient.birthDate.ToShortDateString(); dateOfBirth = _patientProfileResponse.patient.birthDate; FindViewById <EditText> (Resource.Id.upd_AddressLine1).Text = _patientProfileResponse.patient.contactAddress; addressLine1 = _patientProfileResponse.patient.contactAddress; spinnerStates.SetSelection(Common.GetSpinnerIndex(spinnerStates, _patientProfileResponse.patient.contactAddressState)); addressState = _patientProfileResponse.patient.contactAddressState; FindViewById <EditText> (Resource.Id.upd_Telephone1).Text = _patientProfileResponse.patient.contactTelephone; telephone1 = _patientProfileResponse.patient.contactTelephone; FindViewById <EditText> (Resource.Id.upd_Telephone2).Text = _patientProfileResponse.patient.contactTelephone2; telephone2 = _patientProfileResponse.patient.contactTelephone2; FindViewById <EditText> (Resource.Id.upd_Telephone3).Text = _patientProfileResponse.patient.contactTelephone3; telephone3 = _patientProfileResponse.patient.contactTelephone3; FindViewById <EditText> (Resource.Id.upd_Occupation).Text = _patientProfileResponse.patient.occupation; occupation = _patientProfileResponse.patient.occupation; gender = _patientProfileResponse.patient.gender; insuranceIdentificationNumber = _patientProfileResponse.patient.insuranceIdentificationNumber; nationalIdentificationNumber = _patientProfileResponse.patient.nationalIdentificationNumber; photograph = _patientProfileResponse.patient.photograph; signature = _patientProfileResponse.patient.signature; } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn error occurred and your Profile could not be loaded at this time.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception ex) { //Console.WriteLine("This is the InnerException message: " + ((SoapException) ex).Detail.InnerXml.ToString()); new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + ex.Message + "\n\nStack Trace: " + ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } Button btnCancel = FindViewById <Button> (Resource.Id.upd_btnCancel); btnCancel.Click += delegate { this.Finish(); }; // ALL of the above was to retrieve the Player Profile on screen load. This block saves changes made to the player's profile details. Button btnSaveProfile = FindViewById <Button> (Resource.Id.upd_btnSaveProfile); btnSaveProfile.Click += delegate { // grab user-supplied values email = FindViewById <TextView> (Resource.Id.upd_Email).Text.Trim(); title = spinnerTitles.SelectedItem.ToString(); surname = FindViewById <EditText> (Resource.Id.upd_LastName).Text.Trim(); firstName = FindViewById <EditText> (Resource.Id.upd_FirstName).Text.Trim(); dateOfBirth = Convert.ToDateTime(FindViewById <EditText> (Resource.Id.upd_DateOfBirth).Text); addressLine1 = FindViewById <EditText> (Resource.Id.upd_AddressLine1).Text.Trim(); addressState = spinnerStates.SelectedItem.ToString(); telephone1 = FindViewById <EditText> (Resource.Id.upd_Telephone1).Text.Trim(); telephone2 = FindViewById <EditText> (Resource.Id.upd_Telephone2).Text.Trim(); telephone3 = FindViewById <EditText> (Resource.Id.upd_Telephone3).Text.Trim(); occupation = FindViewById <EditText> (Resource.Id.upd_Occupation).Text.Trim(); try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method WS_Patient_Update_Request _editPlayerRequest = new WS_Patient_Update_Request(); _editPlayerRequest.patientRef = Common.patientRef; _editPlayerRequest.password = Common.password; _editPlayerRequest.contactEmail = email; _editPlayerRequest.title = title; _editPlayerRequest.surname = surname; _editPlayerRequest.firstName = firstName; _editPlayerRequest.birthDate = dateOfBirth; _editPlayerRequest.contactAddress = addressLine1; _editPlayerRequest.contactAddressState = addressState; _editPlayerRequest.contactTelephone = telephone1; _editPlayerRequest.contactTelephone2 = telephone2; _editPlayerRequest.contactTelephone3 = telephone3; _editPlayerRequest.occupation = occupation; _editPlayerRequest.gender = gender; _editPlayerRequest.insuranceIdentificationNumber = insuranceIdentificationNumber; _editPlayerRequest.nationalIdentificationNumber = nationalIdentificationNumber; _editPlayerRequest.photograph = photograph; _editPlayerRequest.signature = signature; // connect! and grab the response code from hitting the web service... WS_Patient_Update_Response _editPlayerResponse = new WS_Patient_Update_Response(); _editPlayerResponse = _webService.route_Patient_Update(_editPlayerRequest); if (_editPlayerResponse.responseCode > 0) { new AlertDialog.Builder(this) .SetTitle("Success") .SetMessage("Congrats.\n\nProfile changes were successfully saved.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn error occurred and the changes you requested could not be saved to your profile.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception ex) { //Console.WriteLine("This is the InnerException message: " + ((SoapException) ex).Detail.InnerXml.ToString()); new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + ex.Message + "\n\nStack Trace: " + ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Load the UI created in Main.axml RequestWindowFeature(WindowFeatures.CustomTitle); SetContentView(Resource.Layout.Main); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout._Custom_Title); //hide the Soft Keyboard by default ActivityExtensions.HideSoftKeyboard(this); TextView btnRegister = FindViewById <TextView> (Resource.Id.btnRegister); btnRegister.Enabled = true; btnRegister.TextFormatted = Html.FromHtml("<a href='#'>Register</a>"); // btnRegister.MovementMethod = LinkMovementMethod.Instance; // Move to the Registration page when the 'Register' button is tapped btnRegister.Click += delegate { var dataToTransfer = new Intent(this, typeof(RegisterActivity)); dataToTransfer.PutExtra("go", "Register"); StartActivity(dataToTransfer); }; TextView btnForgotPassword = FindViewById <TextView> (Resource.Id.btnForgotPassword); btnForgotPassword.Enabled = true; btnForgotPassword.TextFormatted = Html.FromHtml("<a href='#'>Forgot Password?</a>"); // btnForgotPassword.MovementMethod = LinkMovementMethod.Instance; btnForgotPassword.Click += delegate { var dataToTransfer = new Intent(this, typeof(ForgotPasswordActivity)); dataToTransfer.PutExtra("go", "ForgotPassword"); StartActivity(dataToTransfer); }; Button btnNewSurvey = FindViewById <Button> (Resource.Id.games_button); btnNewSurvey.Enabled = true; btnNewSurvey.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(NewSurveyActivity)); dataToTransfer.PutExtra("go", "Games"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnSurveys = FindViewById <Button> (Resource.Id.account_button); btnSurveys.Enabled = true; btnSurveys.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(UpdateProfileActivity)); dataToTransfer.PutExtra("go", "MyAccount"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnProfile = FindViewById <Button> (Resource.Id.result_button); btnProfile.Enabled = true; btnProfile.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(MySurveysActivity)); dataToTransfer.PutExtra("go", "Results"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnInfo = FindViewById <Button> (Resource.Id.info_button); btnInfo.Enabled = true; btnInfo.Click += delegate { if (Common.loggedIn) { var dataToTransfer = new Intent(this, typeof(InfoContactActivity)); dataToTransfer.PutExtra("go", "Info"); StartActivity(dataToTransfer); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnLogout = FindViewById <Button> (Resource.Id.logout_button); btnLogout.Enabled = true; btnLogout.Click += delegate { if (Common.loggedIn) { //set all user variables to null and return to the login screen Common.Logout(); var dataToTransfer = new Intent(this, typeof(MainActivity)); dataToTransfer.PutExtra("go", "Login"); StartActivity(dataToTransfer); this.Finish(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry. You are not logged in.\n\nYou need to log in before you can perform that action.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } }; Button btnLogin = FindViewById <Button> (Resource.Id.btnLogIn); if (Common.loggedIn) { btnLogin.Visibility = ViewStates.Invisible; } else { btnLogin.Visibility = ViewStates.Visible; } btnLogin.Click += delegate { // grab user-supplied values username = FindViewById <EditText> (Resource.Id.editText1).Text.Trim(); password = FindViewById <EditText> (Resource.Id.editText2).Text.Trim(); try { // set the webservice object and define its header properties... HQIWebService _webService = new HQIWebService(Common.webServiceURL); // define the parameters, if any, required by this Web Service method WS_Login_Request _loginRequest = new WS_Login_Request(); _loginRequest.username = username; _loginRequest.password = password; // connect! and grab the response code from hitting the web service... WS_Login_Response _loginResponse = new WS_Login_Response(); _loginResponse = _webService.route_Login(_loginRequest); if (_loginResponse.responseCode > 0) { Common.loggedIn = true; Common.patientRef = _loginResponse.patientRef; Common.contactEmail = username; Common.password = password; // Call GetUserProfile web method and populate the appropriate fields in Common.cs Common.GetPatientDetails(Common.patientRef); // set some header information //communicate success to the user CarryOutLoginSuccessAction(); // new AlertDialog.Builder(this) // .SetTitle("Success") // .SetMessage("Congrats.\n\nLogin was successful.\n\n" + GetString(Resource.String.alert_dismissal_phrase) + ".") // .SetPositiveButton("Close", (s, e) => { }) // .Show(); btnLogin.Enabled = false; btnLogin.Text = "You are logged in."; btnLogin.Visibility = ViewStates.Invisible; } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nInvalid login credentials.") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } catch (Exception ex) { if (ex.Message.Contains("ConnectFailure")) { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nIt appears your device is not connected at this time." + Common.newLine + Common.newLine + "Please verify that your device is connected and try again." + Common.newLine + Common.newLine + "Hint: Check your Wi-Fi and/or 3G connection(s).") .SetPositiveButton("Close", (s, e) => { }) .Show(); } else { new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Sorry.\n\nAn unexpected error occurred.\n\nError Message: " + ex.Message + "\n\nStack Trace: " + ex.StackTrace + ".\n\nPlease contact " + Resources.GetString(Resource.String.customer_support_email) + ".") .SetPositiveButton("Close", (s, e) => { }) .Show(); } } }; }