public static async void Fn_CerrarSesion() { v_perfil = new C_PerfilGen(); v_perfMed = new C_PerfilMed(); v_NotasMedic = new ObservableCollection <C_NotaMed>(); v_citas = new ObservableCollection <Cita>(); v_membresia = "0000D-0000"; v_folio = ""; v_letra = ""; v_log = "0"; string _json = JsonConvert.SerializeObject(v_perfil); Current.Properties[NombresAux.v_perfGen] = _json; _json = JsonConvert.SerializeObject(v_perfMed); Current.Properties[NombresAux.v_perMed] = _json; _json = JsonConvert.SerializeObject(v_NotasMedic); Current.Properties[NombresAux.v_Nota] = _json; _json = JsonConvert.SerializeObject(v_citas); Current.Properties[NombresAux.v_Nota] = _json; Current.Properties[NombresAux.v_membre] = v_membresia; Current.Properties[NombresAux.v_folio] = v_folio; Current.Properties[NombresAux.v_letra] = v_letra; Current.Properties[NombresAux.v_log] = v_log; await Current.SavePropertiesAsync(); await Task.Delay(100); }
public static async void Fn_GuardarDatos(C_PerfilMed _med, string _membre, string _folio, string _letra) { v_perfMed = _med; v_folio = _folio; v_membresia = _membre; v_letra = _letra; string _jsonPerMed = JsonConvert.SerializeObject(v_perfMed); Current.Properties[NombresAux.v_log] = v_log; Current.Properties[NombresAux.v_perMed] = _jsonPerMed; Current.Properties[NombresAux.v_membre] = v_membresia; Current.Properties[NombresAux.v_folio] = v_folio; Current.Properties[NombresAux.v_letra] = v_letra; string _jsoServ = JsonConvert.SerializeObject(v_servicios); Current.Properties[NombresAux.v_serviciosmedicos] = _jsoServ; string _jsonMed = JsonConvert.SerializeObject(v_medicos); Current.Properties[NombresAux.v_redmedica2] = _jsonMed; await Current.SavePropertiesAsync(); Fn_CargarDatos(); await Task.Delay(100); }
public async void Fn_CargaQuery() { Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); //HACIENDO EL QUERY para la info del GENERAL HttpClient _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; StringContent _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post try { HttpResponseMessage _respuestphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilGen _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); App.Fn_GuardarDatos(_nuePer, App.v_membresia, App.v_folio, App.v_letra); try { //carga la info del PERFIL MEDICO _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post HttpResponseMessage v_respuestphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await v_respuestphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); App.Fn_GuardarDatos(_nuePerMEd, App.v_membresia, App.v_folio, App.v_letra); } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } await Task.Delay(100); }
public async void Fn_Login(object sender, EventArgs _args) { if (Fn_Condiciones()) { StackMen.IsVisible = true; Mensajes_over.Text = " Comprobando informacion\n"; Regex MembreRegex = new Regex(@"^([0-9]){4}([A-Z]){1}-([0-9]){4}$"); if (MembreRegex.IsMatch(usu.Text)) { string prime = usu.Text.Split('-')[0]; string _membre = "";///los 4 numeros de la mebresia sin laletra for (int i = 0; i < prime.Length - 1; i++) { _membre += prime[i]; } string letra = prime[prime.Length - 1].ToString(); string _conse = usu.Text.Split('-')[1]; C_Login _login = new C_Login(_membre, letra, _conse, pass.Text, fol.Text); //crear el json string _jsonLog = JsonConvert.SerializeObject(_login, Formatting.Indented); Console.Write("Envia para login" + _jsonLog); //mostrar la pantalla con mensajes // Mensajes_over.Text +=_jsonLog ; //crear el cliente HttpClient _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/login.php"; StringContent _content = new StringContent(_jsonLog, Encoding.UTF8, "application/json"); //mandar el json con el post try { //getting exception in the following line //HttpResponseMessage upd_now_playing = await cli.PostAsync(new Uri("http://ws.audioscrobbler.com/2.0/", UriKind.RelativeOrAbsolute), tunp); HttpResponseMessage _respuestaphp = await _client.PostAsync(_DirEnviar, _content); if (_respuestaphp.StatusCode == System.Net.HttpStatusCode.OK) { string _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); if (_respuesta == "0") { Mensajes_over.Text += "\n Error en los datos"; Reinten.IsVisible = true; } else if (_respuesta == "1" || _respuesta == "2") { string _noespacios = ""; string _usutexto = usu.Text; for (int i = 0; i < _usutexto.Length; i++) { string _temp = _usutexto[i].ToString(); if (_temp != " ") { _noespacios += _usutexto[i]; } } Console.WriteLine("Login empre" + _respuesta); //cambiar a logeado //StackMen.IsVisible = false; Perf _perf = new Perf(); _perf.v_fol = fol.Text; _perf.v_membre = _noespacios; _perf.v_letra = letra; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); Console.Write("json para perfil" + _jsonper); //mostrar la pantalla con mensajes //await DisplayAlert("envia login ", _jsonper, "Sigue"); // Mensajes_over.Text = "\n" + _jsonper + "\n valor llega"+_respuesta+"\n"; //crear el cliente _client = new HttpClient(); _DirEnviar = "http://tratoespecial.com/query_perfil.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _respuestaphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); C_PerfilGen _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); //Mensajes_over.Text += _nuePer.Fn_GetDatos(); // await DisplayAlert("Info del perfil", _nuePer.Fn_GetDatos(), "Aceptar"); App.Fn_GuardarDatos(_nuePer, _noespacios, fol.Text, letra); Console.Write("json para perfil medicoo" + _jsonper); _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; //membre letraa folio _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _respuestaphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = new C_PerfilMed(); if (string.IsNullOrEmpty(_respuesta)) { _nuePerMEd = new C_PerfilMed(App.v_perfil.v_idsexo); } else { _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); } //Mensajes_over.Text ="info medica\n" + _nuePerMEd.Fn_Info(); App.Fn_GuardarDatos(_nuePerMEd, _noespacios, fol.Text, letra); // Console.Write("perfil medico ", _nuePerMEd.Fn_Info()); //cargar la nueva pagina de perfil string _nombre = (_nuePer.v_Nombre.Split(' ')[0]); _login = new C_Login(_membre, letra, _conse, App.Fn_GEtToken()); //crear el json _jsonLog = JsonConvert.SerializeObject(_login, Formatting.Indented); _DirEnviar = "http://tratoespecial.com/token_notification.php"; _content = new StringContent(_jsonLog, Encoding.UTF8, "application/json"); Console.WriteLine(" infosss " + _jsonLog); try { //mandar el json con el post _respuestaphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); if (_respuesta == "1") { App.v_log = "1"; Application.Current.MainPage = new V_Master(true, "Bienvenido " + App.v_perfil.v_Nombre); } else { Mensajes_over.Text = "Error"; Reinten.IsVisible = true; } } catch (HttpRequestException exception) { await DisplayAlert("Error", exception.Message, "Aceptar"); Reinten.IsVisible = true; } } catch (HttpRequestException exception) { await DisplayAlert("Error", exception.Message, "Aceptar"); Reinten.IsVisible = true; } } catch (HttpRequestException exception) { await DisplayAlert("Error", exception.Message, "Aceptar"); Reinten.IsVisible = true; } } else { //Mensajes_over.Text = "otra cosa que no entra en el if " + _respuesta; Mensajes_over.Text = "Error"; Reinten.IsVisible = true; } } } catch (HttpRequestException ex) { Mensajes_over.Text = ex.Message.ToString(); Reinten.IsVisible = true; } } else { //Mensajes_over.Text = "otra cosa que no entra en el if " + _respuesta; Mensajes_over.Text = "No contiene el formato de membresia\n 0000F-0000"; Reinten.IsVisible = true; } } }
protected override void OnStart() { //existe la variable guardada //Properties.Clear(); if (Properties.ContainsKey(NombresAux.v_log)) { //lee el valor guardado v_log = Current.Properties[NombresAux.v_log] as string; if (v_log == "0") {//no esta logeado v_perfil = new C_PerfilGen(); v_perfMed = new C_PerfilMed(); v_membresia = "0000D-0000"; v_folio = ""; v_letra = ""; string _json = JsonConvert.SerializeObject(v_perfil); Properties[NombresAux.v_perfGen] = _json; _json = JsonConvert.SerializeObject(v_perfMed); Properties[NombresAux.v_perMed] = _json; Properties[NombresAux.v_letra] = v_letra; Properties[NombresAux.v_membre] = v_membresia; Properties[NombresAux.v_folio] = v_folio; //v_IdCalendar = Current.Properties[NombresAux.v_IdCalendar] as string; //Fn_CargarListas(); MainPage = new V_Master(false, "Bienvenido a Trato Especial"); }//si esta logeado else if (v_log == "1") { /*if(v_log=="1" && Fn_GEtToken()=="a") * { * Fn_CerrarSesion(); * MainPage = new V_Master(false, "Bienvenido a Trato Especial"); * }*/ Fn_CargarDatos(); if (!Current.Properties.ContainsKey(NombresAux.v_perfGen)) { v_perfil = new C_PerfilGen(); string _json = JsonConvert.SerializeObject(v_perfil); Current.Properties.Add(NombresAux.v_perfGen, ""); Current.Properties[NombresAux.v_perfGen] = _json; } else { string _jsonGen = Current.Properties[NombresAux.v_perfGen] as string; v_perfil = JsonConvert.DeserializeObject <C_PerfilGen>(_jsonGen); Console.Write("cargca carga " + v_perfil.Fn_GetDatos() + "\n"); } // v_IdCalendar = Current.Properties[NombresAux.v_IdCalendar] as string; MainPage = new V_Master(true, "Bienvenido " + v_perfil.v_Nombre); } else { MainPage = new V_Master(false, "Bienvenido a Trato Especial"); } } else//es la primera ve que abre la app { v_log = "0"; v_perfil = new C_PerfilGen(); v_perfMed = new C_PerfilMed(); v_folio = ""; v_letra = ""; v_membresia = "0000D-0000"; Fn_CrearKey(); Fn_CargarListas(); App.Current.MainPage = new V_Master(false, "Bienvenido a Trato Especial"); } }
public static async void Fn_CargarDatos() { if (!Current.Properties.ContainsKey(NombresAux.v_membre)) { v_membresia = "0000D-0000"; Current.Properties.Add(NombresAux.v_membre, v_membresia); } else { v_membresia = Current.Properties[NombresAux.v_membre] as string; } if (!Current.Properties.ContainsKey(NombresAux.v_letra)) { v_letra = ""; Current.Properties.Add(NombresAux.v_letra, v_letra); } else { v_letra = Current.Properties[NombresAux.v_letra] as string; } if (!Current.Properties.ContainsKey(NombresAux.v_folio)) { v_folio = ""; Current.Properties.Add(NombresAux.v_folio, v_folio); } else { v_folio = Current.Properties[NombresAux.v_folio] as string; } if (!Current.Properties.ContainsKey(NombresAux.v_perfGen)) { Console.Write("carga datos nada"); v_perfil = new C_PerfilGen(); string _json = JsonConvert.SerializeObject(v_perfil); Current.Properties.Add(NombresAux.v_perfGen, ""); Current.Properties[NombresAux.v_perfGen] = _json; } else { string _jsonGen = Current.Properties[NombresAux.v_perfGen] as string; Console.Write("carga datos " + _jsonGen); v_perfil = JsonConvert.DeserializeObject <C_PerfilGen>(_jsonGen); } if (!Current.Properties.ContainsKey(NombresAux.v_perMed)) { v_perfMed = new C_PerfilMed(); string _json = JsonConvert.SerializeObject(v_perfMed); Current.Properties.Add(NombresAux.v_perMed, ""); Current.Properties[NombresAux.v_perMed] = _json; } else { string _jsonMed = Current.Properties[NombresAux.v_perMed] as string; v_perfMed = JsonConvert.DeserializeObject <C_PerfilMed>(_jsonMed); } if (!Current.Properties.ContainsKey(NombresAux.v_redmedica2)) { v_medicos = new ObservableCollection <C_Medico>(); string _json = JsonConvert.SerializeObject(v_medicos); Current.Properties.Add(NombresAux.v_redmedica2, ""); Current.Properties[NombresAux.v_redmedica2] = _json; if (Current.Properties.ContainsKey(NombresAux.v_redmedica))//eliminar el valor anterior cuando la red medica { Current.Properties.Remove(NombresAux.v_redmedica); } } else { string _jsonMed = Current.Properties[NombresAux.v_redmedica2] as string; v_medicos = JsonConvert.DeserializeObject <ObservableCollection <C_Medico> >(_jsonMed); if (Current.Properties.ContainsKey(NombresAux.v_redmedica))//eliminar el valor anterior cuando la red medica { Current.Properties.Remove(NombresAux.v_redmedica); } } if (!Current.Properties.ContainsKey(NombresAux.v_serviciosmedicos)) { v_servicios = new ObservableCollection <C_Servicios>(); string _json = JsonConvert.SerializeObject(v_servicios); Current.Properties.Add(NombresAux.v_serviciosmedicos, ""); Current.Properties[NombresAux.v_serviciosmedicos] = _json; } else { string _jsonServ = Current.Properties[NombresAux.v_serviciosmedicos] as string; v_servicios = JsonConvert.DeserializeObject <ObservableCollection <C_Servicios> >(_jsonServ); } if (!Current.Properties.ContainsKey(NombresAux.v_serviciosgenereales)) { v_generales = new ObservableCollection <C_ServGenerales>(); string _json = JsonConvert.SerializeObject(v_generales); Current.Properties.Add(NombresAux.v_serviciosgenereales, ""); Current.Properties[NombresAux.v_serviciosgenereales] = _json; } else { string _jsonServ = Current.Properties[NombresAux.v_serviciosgenereales] as string; v_generales = JsonConvert.DeserializeObject <ObservableCollection <C_ServGenerales> >(_jsonServ); } if (!Current.Properties.ContainsKey(NombresAux.v_citas)) { v_citas = new ObservableCollection <Cita>(); string _json = JsonConvert.SerializeObject(v_citas); Current.Properties.Add(NombresAux.v_citas, ""); Current.Properties[NombresAux.v_citas] = _json; } else { string _jsonCitas = Current.Properties[NombresAux.v_citas] as string; v_citas = JsonConvert.DeserializeObject <ObservableCollection <Cita> >(_jsonCitas); } if (!Current.Properties.ContainsKey(NombresAux.v_Nota)) { v_NotasMedic = new ObservableCollection <C_NotaMed>(); string _json = JsonConvert.SerializeObject(v_NotasMedic); Current.Properties.Add(NombresAux.v_Nota, ""); Current.Properties[NombresAux.v_Nota] = _json; } else { string _jsonCitas = Current.Properties[NombresAux.v_Nota] as string; v_NotasMedic = JsonConvert.DeserializeObject <ObservableCollection <C_NotaMed> >(_jsonCitas); } //ID DEL CALENDARIO //if (!Current.Properties.ContainsKey(NombresAux.v_IdCalendar)) //{ // v_IdCalendar = ""; // var TodosCalen = await CrossCalendars.Current.GetCalendarsAsync(); // Calendar _nuevoCal = new Calendar() // { // AccountName = "Trato Especial", // Name = "Trato Especial", // Color = "2896D1" // }; // if (!TodosCalen.Contains(_nuevoCal)) // { // await CrossCalendars.Current.AddOrUpdateCalendarAsync(_nuevoCal); // v_IdCalendar = _nuevoCal.ExternalID; // Current.Properties.Add(NombresAux.v_IdCalendar, v_IdCalendar); // } //} //else //{ // v_IdCalendar = Current.Properties[NombresAux.v_IdCalendar] as string; //} await Task.Delay(100); }
async void Fn_CrearKey() { if (!Properties.ContainsKey(NombresAux.v_log)) { Properties.Add(NombresAux.v_log, v_log); } if (!Properties.ContainsKey(NombresAux.v_membre)) { Properties.Add(NombresAux.v_membre, v_membresia); } if (!Properties.ContainsKey(NombresAux.v_letra)) { Properties.Add(NombresAux.v_letra, v_letra); } if (!Properties.ContainsKey(NombresAux.v_folio)) { Properties.Add(NombresAux.v_folio, v_folio); } if (!Properties.ContainsKey(NombresAux.v_perfGen)) { v_perfil = new C_PerfilGen(); string _json = JsonConvert.SerializeObject(v_perfil); Current.Properties.Add(NombresAux.v_perfGen, ""); Current.Properties[NombresAux.v_perfGen] = _json; } if (!Properties.ContainsKey(NombresAux.v_perMed)) { v_perfMed = new C_PerfilMed(); string _json = JsonConvert.SerializeObject(v_perfMed); Current.Properties.Add(NombresAux.v_perMed, ""); Current.Properties[NombresAux.v_perMed] = _json; } if (!Properties.ContainsKey(NombresAux.v_redmedica2)) { v_medicos = new ObservableCollection <C_Medico>(); string _json = JsonConvert.SerializeObject(v_medicos); Current.Properties.Add(NombresAux.v_redmedica2, ""); Current.Properties[NombresAux.v_redmedica2] = _json; if (Current.Properties.ContainsKey(NombresAux.v_redmedica))//eliminar el valor anterior cuando la red medica { Current.Properties.Remove(NombresAux.v_redmedica); } } if (!Properties.ContainsKey(NombresAux.v_serviciosmedicos)) { v_servicios = new ObservableCollection <C_Servicios>(); string _json = JsonConvert.SerializeObject(v_servicios); Current.Properties.Add(NombresAux.v_serviciosmedicos, ""); Current.Properties[NombresAux.v_serviciosmedicos] = _json; } if (!Properties.ContainsKey(NombresAux.v_serviciosgenereales)) { v_servicios = new ObservableCollection <C_Servicios>(); string _json = JsonConvert.SerializeObject(v_servicios); Current.Properties.Add(NombresAux.v_serviciosgenereales, ""); Current.Properties[NombresAux.v_serviciosgenereales] = _json; } if (!Properties.ContainsKey(NombresAux.v_citas)) { v_citas = new ObservableCollection <Cita>(); string _json = JsonConvert.SerializeObject(v_citas); Current.Properties.Add(NombresAux.v_citas, ""); Current.Properties[NombresAux.v_citas] = _json; } if (!Properties.ContainsKey(NombresAux.v_Nota)) { v_NotasMedic = new ObservableCollection <C_NotaMed>(); string _json = JsonConvert.SerializeObject(v_NotasMedic); Current.Properties.Add(NombresAux.v_Nota, ""); Current.Properties[NombresAux.v_Nota] = _json; } //CIta para la notif if (!Properties.ContainsKey(NombresAux.v_citaNot)) { v_nueva = new Cita(); string _json = JsonConvert.SerializeObject(v_nueva); Properties.Add(NombresAux.v_citaNot, _json); } //if (!Properties.ContainsKey(NombresAux.v_IdCalendar)) //{ // v_IdCalendar = ""; // var TodosCalen = await CrossCalendars.Current.GetCalendarsAsync(); // Calendar _nuevoCal = new Calendar() // { // AccountName = "Trato Especial", // Name = "Trato Especial", // Color = "2896D1" // }; // if (!TodosCalen.Contains(_nuevoCal)) // { // await CrossCalendars.Current.AddOrUpdateCalendarAsync(_nuevoCal); // v_IdCalendar = _nuevoCal.ExternalID; // Current.Properties.Add(NombresAux.v_IdCalendar, v_IdCalendar); // } //} await Current.SavePropertiesAsync(); }
public async void CargarMed() { Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); HttpClient _client = new HttpClient(); try { //carga la info del PERFIL MEDICO string _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; StringContent _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post HttpResponseMessage v_respuestphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await v_respuestphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); App.Fn_GuardarDatos(_nuePerMEd, App.v_membresia, App.v_folio, App.v_letra); } catch { await DisplayAlert("Error al cargar perfil medico", "Se mostrará la ultima información guardada", "Aceptar"); } App.Fn_CargarDatos(); if (!string.IsNullOrEmpty(App.v_perfMed.v_sangre)) { for (int i = 0; i < M_Sangre.Items.Count; i++) { if (App.v_perfMed.v_sangre == M_Sangre.Items[i]) { M_Sangre.SelectedIndex = i; } } // M_Sangre.SelectedIndex = App.v_perfMed.v_sangre; //M_Sangre.Title = M_Sangre.SelectedItem.ToString(); } M_Sangre.IsEnabled = false; if ((App.v_perfMed.v_sexo < 0) || (App.v_perfMed.v_sexo > 1)) { M_sexoPick.IsEnabled = true; if (App.v_perfMed.v_sexo == 1) { M_sexo.IsVisible = true; M_sexolbl.IsVisible = true; M_sexolbl.Text = "¿estas embarazada?,\n ¿tienes hijos? ¿cuantos?"; Fn_NullEntry(M_sexo, App.v_perfMed.v_infoMujer); } else { M_sexo.IsVisible = false; M_sexolbl.IsVisible = false; M_sexolbl.Text = ""; Fn_NullEntry(M_sexo, App.v_perfMed.v_infoMujer); } } else { M_sexoPick.SelectedIndex = App.v_perfMed.v_sexo; M_sexoPick.Title = M_sexoPick.SelectedIndex.ToString(); M_sexoPick.IsEnabled = false; if (App.v_perfMed.v_sexo == 1) { M_sexo.IsVisible = true; M_sexolbl.IsVisible = true; M_sexolbl.Text = "¿estas embarazada?,\n ¿tienes hijos? ¿cuantos?"; Fn_NullEntry(M_sexo, App.v_perfMed.v_infoMujer); } else { M_sexo.IsVisible = false; M_sexolbl.IsVisible = false; M_sexolbl.Text = ""; } } if (string.IsNullOrEmpty(App.v_perfMed.v_alergias)) { Tog_Aler.IsToggled = false; M_Alergias.IsVisible = false; Fn_NullEntry(M_Alergias, App.v_perfMed.v_alergias); } else { M_Alergias.IsVisible = true; Tog_Aler.IsToggled = true; Fn_NullEntry(M_Alergias, App.v_perfMed.v_alergias); } Fn_NullEntry(M_Operaciones, App.v_perfMed.v_operaciones); if (string.IsNullOrEmpty(App.v_perfMed.v_enfer)) { Tog_Enfer.IsToggled = false; M_Enferme.IsVisible = false; Fn_NullEntry(M_Enferme, App.v_perfMed.v_enfer); } else { M_Enferme.IsVisible = true; Tog_Enfer.IsToggled = true; Fn_NullEntry(M_Enferme, App.v_perfMed.v_enfer); } Fn_NullEntry(M_Medicamentos, App.v_perfMed.v_medica); await Task.Delay(100); }
public async void Fn_GuardarMed(object sender, EventArgs _Args) { Button _buton = (Button)sender; _buton.IsEnabled = false; //se crea el json con la clase mas lel folio y membresia string json = @"{"; json += "idmembre:'" + App.v_membresia + "',\n"; json += "idfolio:'" + App.v_folio + "',\n"; if (M_Sangre.SelectedItem != null) { json += "sangre:'" + App.Fn_Vacio(M_Sangre.SelectedItem.ToString()) + "',\n"; } else { } json += "idsexo:'" + M_sexoPick.SelectedIndex + "',\n"; if (M_sexoPick.SelectedIndex == 1) { json += "infoMuj:'" + App.Fn_Vacio(M_sexo.Text) + "',\n"; } else { json += "infoMuj:'" + "" + "',\n"; } if (Tog_Aler.IsToggled) { json += "alergias:'" + App.Fn_Vacio(M_Alergias.Text) + "',\n"; } else { json += "alergias:'" + "" + "',\n"; } json += "operaciones:'" + App.Fn_Vacio(M_Operaciones.Text) + "',\n"; if (Tog_Enfer.IsToggled) { json += "enfermedades:'" + App.Fn_Vacio(M_Enferme.Text) + "',\n"; } else { json += "enfermedades:'" + "" + "',\n"; } json += "medicamentos:'" + App.Fn_Vacio(M_Medicamentos.Text) + "',\n"; json += "}"; JObject jsonPer = JObject.Parse(json); StringContent _content = new StringContent(jsonPer.ToString(), Encoding.UTF8, "application/json"); HttpClient _client = new HttpClient(); string _url = "http://tratoespecial.com/update_perfil_medico.php"; try { HttpResponseMessage _respuestphp = await _client.PostAsync(_url, _content); string _result = _respuestphp.Content.ReadAsStringAsync().Result; if (_result == "1") { await DisplayAlert("Actualizado", "Informacion Guardado con éxito", "Aceptar"); Fn_EditarMed(sender, _Args); //volver a cargar la informacion Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); //HACIENDO EL QUERY para la info del GENERAL _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post try { _respuestphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilGen _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); App.Fn_GuardarDatos(_nuePer, App.v_membresia, App.v_folio, App.v_letra); //carga la info del PERFIL MEDICO _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _respuestphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); App.Fn_GuardarDatos(_nuePerMEd, App.v_membresia, App.v_folio, App.v_letra); CargarGen(); CargarMed(); } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } } else if (_result == "0") { await DisplayAlert("Error", _result + "\n" + jsonPer.ToString(), "Aceptar"); } else { await DisplayAlert("ERROR ", _result + "\n" + jsonPer.ToString(), "Aceptar"); } } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } _buton.IsEnabled = true; }
public async void Fn_GuardarGen(object sender, EventArgs _args) { Button _buton = (Button)sender; _buton.IsEnabled = false; //se crea el json con la clase mas lel folio y membresia string json = @"{"; json += "idmembre:'" + App.v_membresia + "',\n"; json += "idfolio:'" + App.v_folio + "',\n"; json += "nombre:'" + App.Fn_Vacio(G_Nombre.Text) + "',\n"; json += "rfc:'" + App.Fn_Vacio(G_rfc.Text) + "',\n"; json += "fechanac:'" + Fn_GetFecha() + "',\n"; json += "lugnac:'" + App.Fn_Vacio(G_lugar.Text) + "',\n"; json += "ocu:'" + App.Fn_Vacio(G_Ocu.Text) + "',\n"; json += "idsexo:'" + G_sexoPick.SelectedIndex + "',\n"; json += "tel:'" + App.Fn_Vacio(G_Tel.Text) + "',\n"; json += "cel:'" + App.Fn_Vacio(G_Cel.Text) + "',\n"; json += "calle:'" + App.Fn_Vacio(G_dom.Text) + "',\n"; json += "numext:'" + App.Fn_Vacio(G_ext.Text) + "',\n"; json += "numint:'" + App.Fn_Vacio(G_inte.Text) + "',\n"; json += "colonia:'" + App.Fn_Vacio(G_col.Text) + "',\n"; json += "ciudad:'" + App.Fn_Vacio(G_ciu.Text) + "',\n"; json += "municipio:'" + App.Fn_Vacio(G_mun.Text) + "',\n"; json += "estado:'" + App.Fn_Vacio(G_est.Text) + "',\n"; json += "cp:'" + App.Fn_Vacio(G_cp.Text) + "',\n"; json += "correo:'" + App.Fn_Vacio(G_Correo.Text) + "',\n"; json += "}"; JObject jsonPer = JObject.Parse(json); StringContent _content = new StringContent(jsonPer.ToString(), Encoding.UTF8, "application/json"); HttpClient _client = new HttpClient(); string _url = "http://tratoespecial.com/update_perfil.php"; try { HttpResponseMessage _respuestphp = await _client.PostAsync(_url, _content); string _result = _respuestphp.Content.ReadAsStringAsync().Result; if (_result == "1") { Fn_EditarGen(sender, _args); //volver a cargar la informacion Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = App.v_membresia; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); //HACIENDO EL QUERY para la info del GENERAL _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post _respuestphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilGen _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); App.Fn_GuardarDatos(_nuePer, App.v_membresia, App.v_folio, App.v_letra); //carga la info del PERFIL MEDICO _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); //mandar el json con el post _respuestphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); App.Fn_GuardarDatos(_nuePerMEd, App.v_membresia, App.v_folio, App.v_letra); CargarGen(); CargarMed(); await DisplayAlert("Actualizado", "Informacion Guardado con éxito", "Aceptar"); } else if (_result == "0") { await DisplayAlert("Error en actualizar", _result + "\n" + jsonPer.ToString(), "Aceptar"); } else { await DisplayAlert("NO 0 NI 1", _result + "\n" + jsonPer.ToString(), "Aceptar"); } } catch { await DisplayAlert("Error", "Se mostrará la ultima información guardada", "Aceptar"); } _buton.IsEnabled = true; }
/// <summary> /// carga el perfil desde la web y despues lo vuelve a guardar /// </summary> public async void CargarGen() { string _noespacios = ""; string _usutexto = App.v_membresia; for (int i = 0; i < _usutexto.Length; i++) { string _temp = _usutexto[i].ToString(); if (_temp != " ") { _noespacios += _usutexto[i]; } } Perf _perf = new Perf(); _perf.v_fol = App.v_folio; _perf.v_membre = _noespacios; _perf.v_letra = App.v_letra; //crear el json string _jsonper = JsonConvert.SerializeObject(_perf, Formatting.Indented); Console.Write("json para perfil" + _jsonper); //await DisplayAlert("enviar datos", _jsonper, "sdfds"); HttpClient _client = new HttpClient(); string _DirEnviar = "http://tratoespecial.com/query_perfil.php"; StringContent _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post HttpResponseMessage _respuestaphp = await _client.PostAsync(_DirEnviar, _content); string _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); //await DisplayAlert("REspuesta", _respuesta, "sdasd"); C_PerfilGen _nuePer; if (string.IsNullOrEmpty(_respuesta)) { _nuePer = new C_PerfilGen(); } else { _nuePer = JsonConvert.DeserializeObject <C_PerfilGen>(_respuesta); } //await DisplayAlert("cast respuesta ", _nuePer.Fn_GetDatos(), "sadasd"); string _vars = JsonConvert.SerializeObject(_nuePer); //await DisplayAlert("varsss ",_vars,"sadad"); //App.Fn_GuardarDatos(_vars,_noespacios, App.v_folio, App.v_letra); App.Fn_GuardarDatos(_nuePer, _noespacios, App.v_folio, App.v_letra); Console.Write("json para perfil medicoo" + _jsonper); _DirEnviar = "http://tratoespecial.com/query_perfil_medico.php"; //membre letraa folio _content = new StringContent(_jsonper, Encoding.UTF8, "application/json"); try { //mandar el json con el post _respuestaphp = await _client.PostAsync(_DirEnviar, _content); _respuesta = await _respuestaphp.Content.ReadAsStringAsync(); C_PerfilMed _nuePerMEd = new C_PerfilMed(); if (string.IsNullOrEmpty(_respuesta)) { _nuePerMEd = new C_PerfilMed(App.v_perfil.v_idsexo); } else { _nuePerMEd = JsonConvert.DeserializeObject <C_PerfilMed>(_respuesta); } //Mensajes_over.Text ="info medica\n" + _nuePerMEd.Fn_Info(); App.Fn_GuardarDatos(_nuePerMEd, _noespacios, App.v_folio, App.v_letra); // Console.Write("perfil medico ", _nuePerMEd.Fn_Info()); } catch { await DisplayAlert("Error al cargar Perfil", "Se mostrará la ultima información guardada", "Aceptar"); } } catch { await DisplayAlert("Error al cargar perfil", "Se mostrará la ultima información guardada", "Aceptar"); } App.Fn_CargarDatos(); if (App.v_folio == "0") //titular { if (string.IsNullOrEmpty(App.v_perfil.v_Rfc)) // null es persona fisica { G_Stack_rf.IsVisible = false; G_Stack_naci.IsVisible = true; Fn_NullEntry(G_lugar, App.v_perfil.v_LugNac); if (!string.IsNullOrEmpty(App.v_perfil.v_LugNac)) { G_lugar.IsEnabled = false; } if (string.IsNullOrEmpty(App.v_perfil.v_FecNaci)) { G_fecha.Date = DateTime.Now; G_fecha.MaximumDate = DateTime.Now; } else { string[] fecha = App.v_perfil.v_FecNaci.Split('-'); G_fecha.Date = new DateTime(int.Parse(fecha[0]), int.Parse(fecha[1]), int.Parse(fecha[2])); } G_fecha.IsEnabled = false; } else //moral { G_Stack_rf.IsVisible = true; G_Stack_naci.IsVisible = false; } } else { G_Stack_rf.IsVisible = false; G_Stack_naci.IsVisible = true; Fn_NullEntry(G_lugar, App.v_perfil.v_LugNac); if (!string.IsNullOrEmpty(App.v_perfil.v_LugNac)) { G_lugar.IsEnabled = false; } if (string.IsNullOrEmpty(App.v_perfil.v_FecNaci)) { G_fecha.Date = DateTime.Now; G_fecha.MaximumDate = DateTime.Now; } else { string[] fecha = App.v_perfil.v_FecNaci.Split('-'); G_fecha.Date = new DateTime(int.Parse(fecha[0]), int.Parse(fecha[1]), int.Parse(fecha[2])); } G_fecha.IsEnabled = false; } Fn_NullEntry(G_Nombre, App.v_perfil.v_Nombre); if ((App.v_perfil.v_idsexo < 0) || (App.v_perfil.v_idsexo > 1)) { G_sexoPick.IsEnabled = false; } else { G_sexoPick.SelectedIndex = App.v_perfil.v_idsexo; G_sexoPick.Title = G_sexoPick.SelectedIndex.ToString(); G_sexoPick.IsEnabled = false; } Fn_NullEntry(G_Ocu, App.v_perfil.v_Ocup); Fn_NullEntry(G_Tel, App.v_perfil.v_Tel); Fn_NullEntry(G_Cel, App.v_perfil.v_Cel); Fn_NullEntry(G_dom, App.v_perfil.v_Calle); Fn_NullEntry(G_ext, App.v_perfil.v_NumExt); Fn_NullEntry(G_inte, App.v_perfil.v_NumInt); Fn_NullEntry(G_col, App.v_perfil.v_Colonia); Fn_NullEntry(G_ciu, App.v_perfil.v_Ciudad); Fn_NullEntry(G_mun, App.v_perfil.v_municipio); Fn_NullEntry(G_est, App.v_perfil.v_Estado); Fn_NullEntry(G_cp, App.v_perfil.v_Cp); Fn_NullEntry(G_Correo, App.v_perfil.v_Correo); await Task.Delay(100); }