Esempio n. 1
0
        public void CargarDatos()
        {
            btnCompletar.Text = "Guardar";
            BindingContext    = _Global.CurrentAccount;

            pkr_pais.IsEnabled   = false;
            txt_phone1.IsEnabled = false;

            try
            {
                var pais = _Global.CurrentAccount.country.ToString();
                Prefijo = Pais.GetPrefijo(pais);
                _Global.Vistas.PageNewListaPaises.Selected = new EPais {
                    PrefijoTelefonico = Prefijo, Nombre = pais
                };
                _Global.PaisSeleccionado = new EPais {
                    PrefijoTelefonico = Prefijo, Nombre = pais
                };
                ;
            }
            catch
            {
                DisplayAlert("Prefijo", "no existe prefijo del pais:" + _Global.CurrentAccount.country, "ok");
            }
            try
            {
                var cantidad = Prefijo.Count <char>();
                var phone    = _Global.CurrentAccount.phone1.Remove(0, cantidad);
                txt_phone1.Text = phone;
            }
            catch (Exception ex)
            {
                DisplayAlert("ex", ex.Message, "ok");
            }
        }
Esempio n. 2
0
 public async Task <bool> Save(Prefijo entity)
 {
     if (entity.Id > 0)
     {
         return(await Update(entity));
     }
     else
     {
         return(await Add(entity));
     }
 }
Esempio n. 3
0
// Prefijo ::= Letra | Letra Letra ;
    public Prefijo ParsePrefijo()
    {
        Prefijo prefijo = new Prefijo();

        Log("ParsePrefijo");
        Parse(() => {
            Parse(() => {
                prefijo.Letra0 = Consume(Extracting.Letra);
            })
            .Or(() => {
                prefijo.Letra1 = Consume(Extracting.Letra);
                prefijo.Letra2 = Consume(Extracting.Letra);
            })
            .OrThrow("Expected: Letra | [Letra,Letra]");
        }).OrThrow("Failed to parse Prefijo");
        return(prefijo);
    }
Esempio n. 4
0
        //Update
        public async Task <bool> Update(Prefijo entity)
        {
            _context.Entry(entity).State = EntityState.Modified;

            return(await _context.SaveChangesAsync() > 0);
        }
Esempio n. 5
0
        //Insert
        public async Task <bool> Add(Prefijo entity)
        {
            _context.Prefijos.Add(entity);

            return(await _context.SaveChangesAsync() > 0);
        }