private void AddPost_Click(object sender, EventArgs e)
 {
     EditText postContent = FindViewById<EditText>(Resource.Id.postContentText);
     Core myCore = new Core(persistentData);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     data.Add("10");
     data.Add(persistentData[1]);
     data.Add(postContent.Text);
     data.Add(DateTime.Now.ToString("yyyy-MM-dd"));
     data.Add(DateTime.Now.ToString("HH:mm:ss"));
     if (postContent.Text == null || postContent.Text == "Type your query...")
         postErrorMessage("Query cannot be blank");
     else
     recieved = myCore.messageHandler(data);
     if (recieved[1] == "1")
         postQueryMessage("Your question has been posted");
     else
     {
         recieved = myCore.messageHandler(data);
         if (recieved[1] == "1")
             postQueryMessage("Your question has been posted");
         else
             postErrorMessage("There was an error in your request. Please try again.");
     }
 }
Beispiel #2
0
 private void Login_Click(object sender, EventArgs e)
 {
     //declare variables for getting text from UI
     EditText usernameText = FindViewById<EditText>(Resource.Id.usernameText);
     EditText passwordText = FindViewById<EditText>(Resource.Id.passwordText);
     //EditText ipText = FindViewById<EditText>(Resource.Id.ipText);
     List<string> persistentData = new List<string>();
     persistentData.Add(ip);
     persistentData.Add(usernameText.Text);
     /*if (usernameText.Text == null)
         LoginFailedAlert("Username cannot be blank");
     if (usernameText.Text == null)
         LoginFailedAlert("Password cannot be blank");*/
     Core myCore = new Core(persistentData);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     data.Add("01");
     data.Add(usernameText.Text);
     data.Add(passwordText.Text);
     recieved = myCore.messageHandler(data);
     persistentData.Add(recieved[2]);
     //create new intent to start profile activity
     Intent myIntent = new Intent(this, typeof(ProfileActivity));
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     //Start profile activity is correct login data otherwise display incorrect username/password alert
     if (recieved[1] == "1")
     {
         StartActivity(myIntent);
     }
     else
     {
         LoginFailedAlert("Incorrect username or password. Please try again");
     }
 }
 public void DeleteConfirmAlert(string failMessage, int position)
 {
     //build incorrect username/password alert and display when called
     AlertDialog.Builder alert = new AlertDialog.Builder(this);
     alert.SetTitle("Confirm Deletion");
     alert.SetMessage(failMessage);
     alert.SetNegativeButton("No", (senderAlert, args) =>
      {
          //do nothing, return to view
      });
     alert.SetPositiveButton("Yes", (senderAlert, args) =>
     {
         //delete appointment from database, return to view
         Core myCore = new Core(persistentData);
         List<string> myList = new List<string>();
         List<string> recieved = new List<string>();
         myList.Add("03");
         myList.Add(apptID[position]);
         recieved = myCore.messageHandler(myList);
         deleteAppointmentEntry(position);
     });
     RunOnUiThread(() =>
     {
         alert.Show();
     });
 }
Beispiel #4
0
 private void ViewPosts_Click(object sender, EventArgs e)
 {
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("08");
     recieved = myCore.messageHandler(data);
     Intent myIntent = new Intent(this, typeof(ViewForumPosts));
     myIntent.PutStringArrayListExtra("posts list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     StartActivity(myIntent);
 }
 private void SchedAppt_Click(object sender, EventArgs e)
 {
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("04");
     recieved = myCore.messageHandler(data);
     Intent myIntent = new Intent(this, typeof(ScheduleAppointment));
     myIntent.PutStringArrayListExtra("doctor list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     StartActivity(myIntent);
 }
 private void doctor_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
 {
     Spinner spinner = (Spinner)sender;
     selectedDoctor = doctorList[e.Position];
     recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("05");
     data.Add(selectedDoctor);
     recieved = myCore.messageHandler(data);
     recieved.RemoveAt(0);
     dateList = recieved;
     dateSpinner.Visibility = ViewStates.Visible;
     dateHelper();
 }
 protected override void OnListItemClick(ListView l, View v, int position, long id)
 {
     base.OnListItemClick(l, v, position, id);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     List<string> queryText = new List<string>();
     queryText.Add(contentDate[position].Split(',').First());
     Core myCore = new Core(persistentData);
     data.Add("09");
     data.Add(postID[position]);
     recieved = myCore.messageHandler(data);
     postID.Add(postID[position]);
     Intent myIntent = new Intent(this, typeof(ViewPostDetail));
     myIntent.PutStringArrayListExtra("replies list", recieved);
     myIntent.PutStringArrayListExtra("persistent data", persistentData);
     myIntent.PutStringArrayListExtra("post id", postID);
     myIntent.PutStringArrayListExtra("query text", queryText);
     StartActivity(myIntent);
 }
Beispiel #8
0
 private void SubmitReply_Click(object sender, EventArgs e)
 {
     EditText replyContent = FindViewById<EditText>(Resource.Id.replyContentText);
     Core myCore = new Core(persistentData);
     List<string> recieved = new List<string>();
     List<string> data = new List<string>();
     data.Add("11");
     data.Add(postID[0]);
     data.Add(persistentData[1]);
     data.Add(replyContent.Text);
     data.Add(DateTime.Now.ToString("yyyy-MM-dd"));
     data.Add(DateTime.Now.ToString("HH:mm:ss"));
     if (replyContent.Text == null || replyContent.Text == "please enter your response...")
         replyErrorMessage("Query cannot be blank");
     else
     {
         recieved = myCore.messageHandler(data);
         if (recieved[1] == "1")
             replyQueryMessage("Your reply has been posted");
         else
             replyErrorMessage("There was an error in your request. Please try again.");
     }
 }
 private void SchedApptButton_Click(object sender, EventArgs e)
 {
     recieved = new List<string>();
     List<string> data = new List<string>();
     Core myCore = new Core(persistentData);
     data.Add("07");
     data.Add(selectedDoctor);
     data.Add(persistentData[1]);
     data.Add(selectedDate);
     data.Add(selectedTime);
     recieved = myCore.messageHandler(data);
     if (recieved[1] == "1")
         scheduleMessage("Appointment has been scheduled");
     else
         scheduleMessage("There was an error in scheduling please try again");
 }
 protected override void OnListItemClick(ListView l, View v, int position, long id)
 {
     bool delete = false;
     base.OnListItemClick(l, v, position, id);
     if (DateTime.Now.Date < DateTime.Parse(date[position]))
     {
         string alertMessage = "Are you sure you want to delete this appointment?";
         DeleteConfirmAlert(alertMessage, position);
     }
     else
     {
         string alertMessage = "This appointment has already occured and cannot be deleted!";
         CannotDeleteAlert(alertMessage);
     }
     if(delete)
     {
         Core myCore = new Core(persistentData);
         List<string> myList = new List<string>();
         List<string> recieved = new List<string>();
         myList.Add("03");
         myList.Add(apptID[position]);
         recieved = myCore.messageHandler(myList);
         deleteAppointmentEntry(position);
         if (recieved[1] == "1")
             DeletedAlert("The appointment you selected has been deleted");
     }
 }