Esempio n. 1
0
        public static List <String> ObtenerTelefonos(String Telefonos)
        {
            List <String> Result = new List <String>();

            foreach (String Telefono in Telefonos.Split(','))
            {
                if (Telefono.Trim() == "")
                {
                    continue;
                }
                String[] ColTelf = Telefono.Split('/');
                foreach (String TelefonoReal in ColTelf)
                {
                    try
                    {
                        if (TelefonoReal.Trim() == "")
                        {
                            continue;
                        }
                        String TelefonoIns = (TelefonoReal.Length < 5) ? ColTelf[0].Substring(0, ColTelf[0].Length - TelefonoReal.Length) + TelefonoReal : TelefonoReal;
                        //if (!Persona.Telefonos.Any(x => x.Telefono == TelefonoIns))
                        //{
                        Result.Add(TelefonoIns);
                        //}
                    }
                    catch
                    {
                        Result.Add(TelefonoReal);
                    }
                }
            }
            return(Result);
        }
Esempio n. 2
0
 private bool VerificaDati(bool notifyOn = false)
 {
     if (this.CategoriaIndexSelected < 0)
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi selezionare una categoria");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (this.CittaSelezionata == null)
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi selezionare la città dell'editor");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(this.IndirizzoEditor.Trim()))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire l'indirizzo dell'editor");
         }
         IsRegisterButtonEnable = false;
         return(true);
     }
     if (!validation.EmailValidation(IndirizzoEmail))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire un indirizzo email valido");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(Telefono.Trim()))
     {
         if (notifyOn)
         {
             toast.ShowMessageDialog("Registrazione editor", "Devi inserire un numero di telefono");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
        private Task <string> EnviarDatos()
        {
            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)
            {
                ConsultaDispositivosServices servicio = new ConsultaDispositivosServices();
                var res = servicio.VerificarUsuario(new VerificacionRequest
                {
                    numeroTel = Telefono?.Trim(),
                    pin       = Pin?.Trim(),
                    email     = Mail?.Trim()
                });
                if (res.Success)
                {
                    if (res.ObjectData.Data.Count == 0)
                    {
                        return(Task.FromResult("Esta terminal aun no se ha dado de alta"));
                    }
                    var datos = res.ObjectData.Data[0];
                    int sql   = UserRepository.GetInstancia.AddNewUser(
                        datos.Email,
                        datos.Pin,
                        datos.Email,
                        datos.Id.ToString()
                        );
                    if (sql > 0)
                    {
                        return(Task.FromResult("ok"));
                    }
                    else
                    {
                        return(Task.FromResult("Esta terminal aun no se ha dado de alta"));
                    }
                }
                else
                {
                    return(Task.FromResult("Esta terminal aun no se ha dado de alta"));
                }
            }
            else
            {
                return(Task.FromResult("No tienes conexión a internet"));
            }
        }
 private bool VerificaDati(bool notify = false)
 {
     if (string.IsNullOrEmpty(NomeDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il nome del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(CognomeDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il cognome del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(UsernameDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la username del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(PasswordDirigente.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la password del dirigente scolastico");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(NomeScuola.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il nome della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (CittaSelezionata == null)
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci la città della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(IndirizzoEmail.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci l'indirizzo email della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     if (string.IsNullOrEmpty(Telefono.Trim()))
     {
         if (notify)
         {
             toast.ShowMessageDialog("Registrazione scuola", "Inserisci il numero di telefono della scuola");
         }
         IsRegisterButtonEnable = false;
         return(false);
     }
     IsRegisterButtonEnable = true;
     return(true);
 }
Esempio n. 5
0
        string IDataErrorInfo.this[string columnName]
        {
            get
            {
                if (columnName == "Nombre")
                {
                    if (Nombre == null)  //must have an order description
                    {
                        return(" ");
                    }
                    else if (Nombre.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }
                    foreach (char c in Nombre)
                    {
                        if (!Char.IsLetter(c) && c != ' ')
                        {
                            return("Solo caracteres alfabéticos");
                        }
                    }
                }
                else if (columnName == "Apellidos")
                {
                    if (Apellidos == null)
                    {
                        return(" ");
                    }
                    else if (Apellidos.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }
                    foreach (char c in Apellidos)
                    {
                        if (!Char.IsLetter(c) && c != ' ')
                        {
                            return("Solo caracteres alfabéticos");
                        }
                    }
                }
                else if (columnName == "Sexo")
                {
                    if (Sexo.Equals('-'))
                    {
                        return(" ");
                    }
                    //if(Sexo != 'F' && Sexo != 'M')
                    //    return "Es un campo obligatorio";
                }
                else if (columnName == "Celular")
                {
                    if (Celular == null)
                    {
                        return(" ");
                    }
                    else if (Celular.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }
                    foreach (char c in Celular)
                    {
                        if (!Char.IsDigit(c))
                        {
                            return("Solo se permiten números");
                        }
                    }
                }
                else if (columnName == "Telefono")
                {
                    if (Telefono == null)
                    {
                        return(" ");
                    }
                    else if (Telefono.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }
                    foreach (char c in Telefono)
                    {
                        if (!Char.IsDigit(c))
                        {
                            return("Solo se permiten números");
                        }
                    }
                }
                else if (columnName == "CentLaboral")
                {
                    if (CentLaboral == null)  //must have an order description
                    {
                        return(" ");
                    }
                    else if (CentLaboral.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }
                    foreach (char c in CentLaboral)
                    {
                        if (!Char.IsLetterOrDigit(c) && c != ' ')
                        {
                            return("Solo caracteres alfanuméricos");
                        }
                    }
                }
                else if (columnName == "Email")
                {
                    if (CentLaboral == null)  //must have an order description
                    {
                        return(" ");
                    }
                    else if (CentLaboral.Trim() == string.Empty)
                    {
                        return("Es un campo obligatorio");
                    }

                    string expresion;
                    expresion = "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
                    if (Regex.IsMatch(Email, expresion))
                    {
                        if (!(Regex.Replace(Email, expresion, string.Empty).Length == 0))
                        {
                            return("Email invalido");
                        }
                    }
                    else
                    {
                        return("Email invalido");
                    }
                }
                else if (columnName == "NCTMP")
                {
                    if (NCTMP == null)
                    {
                        return(" ");
                    }
                    foreach (char c in NCTMP)
                    {
                        if (!Char.IsDigit(c))
                        {
                            return("Solo se permiten números");
                        }
                    }
                }
                else if (columnName == "NNDTA")
                {
                    if (NNDTA == null)
                    {
                        return(" ");
                    }
                    foreach (char c in NNDTA)
                    {
                        if (!Char.IsDigit(c))
                        {
                            return("Solo se permiten números");
                        }
                    }
                }
                return(null);
            }
        }