private void Actions() { List <string> ICD_Chapters = new List <string>(); ICD_Codes = new List <string>(); ICD_Codes1 = new List <string>(); ConsumeRest cRest = new ConsumeRest(); ValidateJson validateJson = new ValidateJson(); Address address = new Address(); object strResponse, strResponse2; bool IsValidJson, IsValidJson2; string endpoint, endpoint2; endpoint = address.Endpoint + "icd_chapters"; endpoint2 = address.Endpoint + "icd_code"; strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); strResponse2 = cRest.makeRequest(endpoint2); IsValidJson2 = validateJson.IsValidJson(strResponse2); if (IsValidJson && IsValidJson2) { icdchapters = JsonConvert.DeserializeObject <List <icdChapters> >(strResponse.ToString()); icdcodes = JsonConvert.DeserializeObject <List <icd_codes> >(strResponse2.ToString()); if (icdchapters.Count != 0) { for (int i = 0; i < icdchapters.Count; i++) { ICD_Chapters.Add(icdchapters[i].col2.ToString()); } adapt = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, ICD_Chapters); spin.Adapter = adapt; } //icdcodesspecial = icdcodes; if (icdcodes.Count != 0) { for (int i = 0; i < icdcodes.Count; i++) { ICD_Codes.Add(icdcodes[i].col4.ToString() + ". " + icdcodes[i].col9.ToString()); } adapt1 = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, ICD_Codes); spin1.Adapter = adapt1; } } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem" + "\n" + strResponse) .Show(); } }
public Android.Graphics.Bitmap Start(int i) { bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); ValidateJson validateJson = new ValidateJson(); Address address = new Address(); //int k = 0; object strResponse2; string endpoint2 = address.Endpoint + "DataSenders/" + imageIds[i].DataSenderId; strResponse2 = cRest.makeRequest(endpoint2); IsValidJson = validateJson.IsValidJson(strResponse2); if (IsValidJson == true) { imageChats = JsonConvert.DeserializeObject <List <imagesChat> >(strResponse2.ToString()); ////// new code //bitmapList = BitmapFactory.DecodeByteArray(imageChats[i].Picture, 0, imageChats[i].Picture.Length); //Allbitmap.Add(new lstBitmap() { BitMap = bitmapList }); //bitmapList = null; ///// end new code } bitmapList = BitmapFactory.DecodeByteArray(imageChats[0].Picture, 0, imageChats[0].Picture.Length); return(bitmapList); }
protected void Actions() { ValidateJson validateJson = new ValidateJson(); ConsumeRest cRest = new ConsumeRest(); Address address = new Address(); Doctor2 demogr; bool IsValidJson; object strResponse; string endpoint; endpoint = address.Endpoint + "Doctors/" + myID; strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); if (IsValidJson) { demogr = JsonConvert.DeserializeObject <Doctor2>(strResponse.ToString()); txtFirstName.Text = demogr.FirstName; txtLastName.Text = demogr.LastName; txtSpeciality.Text = demogr.Speciality; } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem" + "\n" + strResponse) .Show(); } }
private void Action2() { DeleteFromNew(PictureID); bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); ValidateJson validateJson = new ValidateJson(); Address address = new Address(); object strResponse2; string endpoint2 = address.Endpoint + "DataSenders/" + PictureID; strResponse2 = cRest.makeRequest(endpoint2); IsValidJson = validateJson.IsValidJson(strResponse2); if (IsValidJson == true) { imageChats = JsonConvert.DeserializeObject <List <imagesChat> >(strResponse2.ToString()); Image = imageChats[0].Picture; Bitmap bitmap = BitmapFactory.DecodeByteArray(Image, 0, Image.Length); imageView.SetImageBitmap(bitmap); } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem") .Show(); } }
void methodInvokeAlertDialogWithListView(/*object sender, EventArgs e*/) { bool IsValidJson1; _lstDataItem = new List <string>(); _lstDataItem.Clear(); // check it ( it was changed ) ConsumeRest cRest = new ConsumeRest(); object strResponse; Address address = new Address(); string endpoint = address.Endpoint + "ContactsList/" + receiverID; strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValidJson1 = validateJson.IsValidJson(strResponse); if (IsValidJson1) { List <ContactsPerson> deserializedContacts = JsonConvert.DeserializeObject <List <ContactsPerson> >(strResponse.ToString()); Number = deserializedContacts.Count; for (int i = 0; i < deserializedContacts.Count; i++) { string NAME = deserializedContacts[i].FirstName + " " + deserializedContacts[i].LastName; _lstDataItem.Add(NAME); selectChoice.Add(new SelectChoice { PersonId = deserializedContacts[i].PersonId, Contactid = deserializedContacts[i].Contactid, FullName = deserializedContacts[i].FirstName + " " + deserializedContacts[i].LastName }); } var dlgAlert = (new AlertDialog.Builder(this)).Create(); dlgAlert.SetTitle(" Contacts "); var listView = new ListView(this); listView.Adapter = new EHR_Application.AlertListViewAdapter(this, _lstDataItem); // changed //listView.ItemClick += listViewItemClick; dlgAlert.SetView(listView); dlgAlert.SetButton("OK", handllerNotingButton); dlgAlert.Show(); } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found due to unexpected problem" + "\n" + strResponse) .Show(); } }
protected void Actions() { object strResponse; bool IsValidJson; string endpoint; ConsumeRest cRest = new ConsumeRest(); Address address = new Address(); if (newImages == false) { txtImage.Text = "No new images"; } else { txtImage.Text = " New images found!! " + "\n" + " Check for them at <New Images>"; } if (IsDoctor == false) { endpoint = address.Endpoint + "PatientNewMessages/" + myID; } else { endpoint = address.Endpoint + "DoctorNewMessages/" + myID; } strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValidJson = validateJson.IsValidJson(strResponse); if (IsValidJson) { newMessages = JsonConvert.DeserializeObject <List <NewMessages2> >(strResponse.ToString()); newMessages = newMessages.OrderBy(i => i.FirstName).ToList(); SetData(); } else { newMessages = JsonConvert.DeserializeObject <List <NewMessages2> >("[]".ToString()); new Android.App.AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found due to unexpected problem " + "\n" + strResponse) .SetIcon(Resource.Drawable.error) .Show(); } }
void methodInvokeAlertDialogWithListView2() { object strResponse; bool IsValidJson1; _lstDataItem2 = new List <string>(); _lstDataItem2.Clear(); ConsumeRest cRest = new ConsumeRest(); Address address = new Address(); string endpoint = address.Endpoint + "DoctorNewMessages/" + myID; strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValidJson1 = validateJson.IsValidJson(strResponse); if (IsValidJson1) { deserializedContacts = JsonConvert.DeserializeObject <List <NewMessages2> >(strResponse.ToString()); receivedMes = deserializedContacts.OrderBy(c => c.LastName).ToList(); for (int i = 0; i < receivedMes.Count; i++) { string NAME = "New Message from: " + receivedMes[i].FirstName + " " + receivedMes[i].LastName; _lstDataItem2.Add(NAME); } var dlgAlert = (new AlertDialog.Builder(this)).Create(); dlgAlert.SetTitle(" New Messages "); var listView = new ListView(this); listView.Adapter = new EHR_Application.AlertListViewAdapter(this, _lstDataItem2); listView.ItemClick += ListView_ItemClick; dlgAlert.SetView(listView); dlgAlert.SetButton("OK", handllerNotingButton1); dlgAlert.Show(); } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem" + "\n" + strResponse) .Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { bool IsValid; base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main2); // Data from previous activity Father = Intent.GetStringExtra("MyData"); VisitID = Intent.GetIntExtra("VisitID", -1); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); // SupportActionBar.Title = "Expandable ListView"; expandableListView = FindViewById <ExpandableListView>(Resource.Id.expandableListView); ConsumeRest cRest = new ConsumeRest(); Address address = new Address(); string endpoint = address.Endpoint + "DIagnosis/" /* + "Diagnosi/"*/ + VisitID; strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValid = validateJson.IsValidJson(strResponse); if (IsValid) { Diagnosis = JsonConvert.DeserializeObject <List <DIagnosis> >(strResponse.ToString()); SetData(out mAdapter); expandableListView.SetAdapter(mAdapter); } else { Diagnosis = JsonConvert.DeserializeObject <List <DIagnosis> >("[]".ToString()); new Android.App.AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found do to unexpected problem" + "\n" + strResponse) .SetIcon(Resource.Drawable.error) .Show(); } }
private void Actions() { string endpoint; bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); ValidateJson validateJson = new ValidateJson(); object strResponse; Address address = new Address(); RetrieveData retrieve = new RetrieveData(); // retrieve "IsDoctor" bool IsDoctor = retrieve.RetreiveBool(); if (IsDoctor == false) { endpoint = address.Endpoint + "PatientNewPhotos/" + myID; } else { endpoint = address.Endpoint + "DoctorNewPhotos/" + myID; } strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); if (IsValidJson == true) { imageIds = JsonConvert.DeserializeObject <List <imageIDs> >(strResponse.ToString()); imageIds = imageIds.OrderBy(i => i.FirstName).ToList(); SetData(); } else { imageIds = JsonConvert.DeserializeObject <List <imageIDs> >("[]".ToString()); new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem" + "\n" + strResponse) .Show(); } }
private void Actions() { ConsumeRest cRest = new ConsumeRest(); object strResponse; string endpoint; Address address = new Address(); if (IsDoctor == false) { endpoint = address.Endpoint + "PatientFriends/" + myID; } else { endpoint = address.Endpoint + "DoctorFriends/" + myID; } strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValidJson1 = validateJson.IsValidJson(strResponse); if (IsValidJson1) { deserializedFriends = JsonConvert.DeserializeObject <List <friends> >(strResponse.ToString()); deserializedFriends = deserializedFriends.OrderBy(i => i.FirstName).ToList(); } else { deserializedFriends = JsonConvert.DeserializeObject <List <friends> >("[]".ToString()); new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetIcon(Resource.Drawable.error) .SetMessage("No data found due to unexpected problem " + strResponse) .Show(); } SetData(); }
private void Actions() { bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); object strResponse; Address address = new Address(); string endpoint; ValidateJson validateJson = new ValidateJson(); try { endpoint = address.Endpoint + "AllergiesList/" + myID; if (IsDoctor == true) { endpoint = address.Endpoint + "AllergiesList/" + myID; } strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); deserializedAllergies = JsonConvert.DeserializeObject <List <Allergies> >(strResponse.ToString()); mItems = new List <Allergies>(); setData(); CustomAdapter3 adapter = new CustomAdapter3(this, mItems); mListView.Adapter = adapter; } catch { deserializedAllergies = JsonConvert.DeserializeObject <List <Allergies> >("[]".ToString()); new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found due to unexpected problem") .SetIcon(Resource.Drawable.error) .Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.RecyclerviewLayout); bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); ValidateJson validateJson = new ValidateJson(); object strResponse; Address address = new Address(); string endpoint = address.Endpoint + "Messages2/" + 1000 + "/" + 10001; strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); if (IsValidJson == true) { imageIds = JsonConvert.DeserializeObject <List <imageIDs> >(strResponse.ToString()); } for (int i = 0; i < imageIds.Count; i++) { if (i == 0) { bitmap4 = Start(i); Android.Graphics.Bitmap bitmap44 = ResizeBitmap(bitmap4, 600, 200); Android.Graphics.Bitmap bitmap12 = scaleDown(bitmap4, 200, true); IM1 = new BitmapDrawable(bitmap12); } if (i == 1) { bitmap5 = Start(i); Android.Graphics.Bitmap bitmap55 = ResizeBitmap(bitmap5, 600, 200); Android.Graphics.Bitmap bitmap13 = scaleDown(bitmap55, 200, true); IM2 = new BitmapDrawable(bitmap13); } if (i == 2) { bitmap6 = Start(i); Android.Graphics.Bitmap bitmap66 = ResizeBitmap(bitmap6, 600, 200); Android.Graphics.Bitmap bitmap14 = scaleDown(bitmap66, 200, true); IM3 = new BitmapDrawable(bitmap14); } if (i == 3) { bitmap7 = Start(i); Android.Graphics.Bitmap bitmap77 = ResizeBitmap(bitmap7, 600, 200); Android.Graphics.Bitmap bitmap15 = scaleDown(bitmap77, 200, true); IM4 = new BitmapDrawable(bitmap15); } if (i == 3) { bitmap8 = Start(i); Android.Graphics.Bitmap bitmap88 = ResizeBitmap(bitmap8, 600, 200); Android.Graphics.Bitmap bitmap16 = scaleDown(bitmap88, 200, true); IM5 = new BitmapDrawable(bitmap16); } } //Android.Graphics.Bitmap bitmap44 = ResizeBitmap(bitmap4, 600, 200); //Android.Graphics.Bitmap bitmap12 = scaleDown(bitmap4, 200, true); //IM1 = new BitmapDrawable(bitmap12); //Android.Graphics.Bitmap bitmap55 = ResizeBitmap(bitmap5, 600, 200); //Android.Graphics.Bitmap bitmap13 = scaleDown(bitmap55, 200, true); //IM2 = new BitmapDrawable(bitmap13); //Android.Graphics.Bitmap bitmap66 = ResizeBitmap(bitmap6, 600, 200); //Android.Graphics.Bitmap bitmap14 = scaleDown(bitmap66, 200, true); //IM3 = new BitmapDrawable(bitmap14); //Android.Graphics.Bitmap bitmap77 = ResizeBitmap(bitmap7, 600, 200); //Android.Graphics.Bitmap bitmap15 = scaleDown(bitmap77, 200, true); //IM4 = new BitmapDrawable(bitmap15); //Android.Graphics.Bitmap bitmap88 = ResizeBitmap(bitmap8, 600, 200); //Android.Graphics.Bitmap bitmap16 = scaleDown(bitmap88, 200, true); //IM5 = new BitmapDrawable(bitmap16); //int count = Allbitmap.Count; //for (int i=0; i<count; i++) //{ // Android.Graphics.Bitmap bitmapitem = scaleDown(Allbitmap[i].BitMap, 300, true); // //Allbitmap2.Add(new lstBitmap() { BitMap = bitmapitem }); // Drawable imageRecycle23 = new BitmapDrawable(bitmapitem); // Allimages.Add(new imageViews() {Image = imageRecycle23 }); //} //LoadFromResources(); /* * object JsonText = LoadJson(); * imageRecycle = JsonConvert.DeserializeObject<imagesChat>(JsonText.ToString()); * Android.Graphics.Bitmap bitmap = BitmapFactory.DecodeByteArray(imageRecycle.Picture, 0, imageRecycle.Picture.Length); * //Android.Graphics.Bitmap bitmap1 = ResizeBitmap(bitmap, 600, 400); */ Android.Graphics.Bitmap bitmap1 = scaleDown(bitmap4, 2200, true); // scale of image imageRecycle1 = new BitmapDrawable(bitmap1); //System.Drawing.Image Image42 = byteArrayToImage(imaGg.Picture); //Android.Graphics.Bitmap bitmap22 = bytesToBitmap(imaGg.Picture); //Android.Media.Image i = (Android.Media.Image)bitmap22; InputData(); recycler = FindViewById <RecyclerView>(Resource.Id.recycler); recycler.HasFixedSize = true; layoutManager = new LinearLayoutManager(this); recycler.SetLayoutManager(layoutManager); adapter = new RecyclerViewAdapter(lstData); recycler.SetAdapter(adapter); }
public void actions() { bool IsValidJson; ConsumeRest cRest = new ConsumeRest(); object strResponse; Address address = new Address(); string endpoint; ValidateJson validateJson = new ValidateJson(); ///////////// telephones try { List <string> Teleph = new List <string>(); List <string> emails = new List <string>(); endpoint = address.Endpoint + "CommunicationList/" + myID; //1001; strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); List <Communication> communication = JsonConvert.DeserializeObject <List <Communication> >(strResponse.ToString()); if (communication.Any()) { for (int i = 0; i < communication.Count; i++) { Teleph.Add(communication[i].Telephone.ToString()); emails.Add(communication[i].email); } } adapt = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Teleph); adapt1 = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, emails); spin.Adapter = adapt; spin1.Adapter = adapt1; } catch (Exception e) { } txt1.Text = "Patient"; demographics demogr; endpoint = address.Endpoint + "Demographics/" + receiverID; strResponse = cRest.makeRequest(endpoint); IsValidJson = validateJson.IsValidJson(strResponse); if (IsValidJson) { demogr = JsonConvert.DeserializeObject <demographics>(strResponse.ToString()); txt13.Text = demogr.FirstName; txt14.Text = demogr.LastName; txt15.Text = demogr.Country; txt16.Text = demogr.City; txt24.Text = demogr.StreetName; txt17.Text = demogr.StreetNumber.ToString(); txt18.Text = demogr.Sex; txt19.Text = demogr.Birthday.ToString(); } else { new AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found due to unexpected problem" + "n/" + strResponse) .Show(); } }