Guest User

Untitled

a guest
Mar 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. switch (response.StatusCode) {
  2. //200
  3. case (System.Net.HttpStatusCode.OK):
  4.  
  5. HttpContent content = response.Content;
  6. string xjson = await content.ReadAsStringAsync();
  7.  
  8. try {
  9. //List<Table_Loc> loc_list = JsonConvert.DeserializeObject<List<Table_Loc>>(xjson);
  10. lbl_res.Text = "Ordenes Pendientes";
  11. Root myobject = JsonConvert.DeserializeObject < Root > (xjson);
  12.  
  13. //var T1count = myobject.tablas.Table1.Count;
  14.  
  15. if (myobject.tablas.Table1.Count == 0) {
  16. PasajeAereo.IsEnabled = false;
  17. } else {
  18. PasajeAereo.IsEnabled = true;
  19. }
  20.  
  21.  
  22. } catch (Exception ex) {
  23. await DisplayAlert("", "" + ex.ToString(), "ok");
  24. return;
  25. }
  26.  
  27. break;
  28. }
  29.  
  30. //Model ...
  31.  
  32. public class DatosEnvio
  33. {
  34. }
  35.  
  36. public class DatosEnvioJson
  37. {
  38. }
  39.  
  40. public class Table1
  41. {
  42. public string aerolinea { get; set; }
  43. public string vuelo { get; set; }
  44. public string salida { get; set; }
  45. public DateTime sFecha { get; set; }
  46. public string sHora { get; set; }
  47. public string regreso { get; set; }
  48. public DateTime rFecha { get; set; }
  49. public string rHora { get; set; }
  50. public string motivo { get; set; }
  51. public int idOrden { get; set; }
  52. }
  53.  
  54. public class Tablas
  55. {
  56. public List<Table1> Table1 { get; set; }
  57. }
  58.  
  59. public class Root
  60. {
  61. public DatosEnvio DatosEnvio { get; set; }
  62. public DatosEnvioJson DatosEnvioJson { get; set; }
  63. public Tablas tablas { get; set; }
  64. public string bandera { get; set; }
  65. public string mensaje { get; set; }
  66. }
  67.  
  68. if (myobject != null && myobject.tablas != null && myobject.tablas.Table1 != null && myobject.tablas.Table1.Count == 0) {
  69. PasajeAereo.IsEnabled = false;
  70. } else {
  71. PasajeAereo.IsEnabled = true;
  72. }
  73.  
  74. if (myobject?.tablas?.Table1?.Count == (int?)0) {
  75. PasajeAereo.IsEnabled = false;
  76. }
  77. else {
  78. PasajeAereo.IsEnabled = true;
  79. }
  80.  
  81. PasajeAereo.IsEnabled = myobject?.tablas?.Table1?.Count == (int?)0;
Add Comment
Please, Sign In to add comment