private async void Button1_Click(object sender, EventArgs e) // new Diagnosis { if (VISITID != 0 && icdID != 0 && Chapter != null) { string endpoint1; PostRest p = new PostRest(); Address address = new Address(); endpoint1 = address.Endpoint + "DIagnosis"; var uri = new Uri(endpoint1); NewDiagnosis newdiagnosis = new NewDiagnosis(); newdiagnosis.VisitID = VISITID; newdiagnosis.Description = Description.Text; newdiagnosis.ICD_Code_Id = icdID; newdiagnosis.ICD_Chapter = Chapter; string output = JsonConvert.SerializeObject(newdiagnosis); string StrRespPost = await PostRest.Post(output, uri, true); if (StrRespPost == "Created") { Chapter = null; icdID = 0; new AlertDialog.Builder(this) .SetMessage("Successful") .SetTitle("Message") .Show(); } else { new AlertDialog.Builder(this) .SetMessage("Unsuccessfull!!" + "\n" + "Something went wrong" + "\n" + StrRespPost) .SetTitle("Message") .SetIcon(Resource.Drawable.error) .Show(); } } else { new AlertDialog.Builder(this) .SetMessage("You need to choose ICD_code and ICD_chapter") .SetTitle("Message") .SetIcon(Resource.Drawable.error) .Show(); } }
private async void Button4_Click(object sender, EventArgs e) // new treatment { if (VISITID != 0 && ATCcode != null && Dosage != null) { string endpoint2; PostRest p = new PostRest(); Address address = new Address(); endpoint2 = address.Endpoint + "Treat_Medicines"; var uri = new Uri(endpoint2); NewMedicines newmedicines = new NewMedicines(); newmedicines.VisitID = VISITID; newmedicines.ATC_CODES = ATCcode.Text; newmedicines.Dosage = Dosage.Text; string output = JsonConvert.SerializeObject(newmedicines); string StrRespPost = await PostRest.Post(output, uri, true); if (StrRespPost == "Created") { ATCcode = null; Dosage = null; new AlertDialog.Builder(this) .SetMessage("Successful") .SetTitle("Message") .Show(); } else { new AlertDialog.Builder(this) .SetMessage("Unsuccessfull !!" + "\n" + "Something went wrong" + "\n" + StrRespPost) .SetTitle("Message") .SetIcon(Resource.Drawable.error) .Show(); } } else { new AlertDialog.Builder(this) .SetMessage("You need to choose ATC_code and Dosage") .SetTitle("Message") .SetIcon(Resource.Drawable.error) .Show(); } }
//private void SetIcdCodes() //{ // //spin1.Adapter(null); // if (icdcodesspecial.Count != 0) // { // for (int i = 0; i < icdcodesspecial.Count; i++) // { // ICD_Codes1.Add(icdcodesspecial[i].col4.ToString() + " " + icdcodesspecial[i].col9.ToString()); // } // adapt1 = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, ICD_Codes1); // spin1.Adapter = adapt1; // } //} private async void AddNewVisit() // new visit { if (VISITID == 0) { string endpoint; PostRest p = new PostRest(); Address address = new Address(); endpoint = address.Endpoint + "Visits"; var uri = new Uri(endpoint); NewVisit newvisit = new NewVisit(); newvisit.PersonID = receiverID; newvisit.DoctorPersonID = myID; string output = JsonConvert.SerializeObject(newvisit); string StrRespPost = await PostRest.Post(output, uri, false); try { newMessages = JsonConvert.DeserializeObject <VisitID>(StrRespPost.ToString()); VISITID = newMessages.visitId; new AlertDialog.Builder(this) .SetMessage("New visit has been created") .SetTitle("Message") .Show(); } catch { new AlertDialog.Builder(this) .SetMessage("An error has occur") .SetTitle("Message") .Show(); } } else { new AlertDialog.Builder(this) .SetMessage("You already have created a new Visit.If you need to create a new one you need to exit from this Visit ") .SetTitle(" No need for new Visit ") .Show(); } }