BL.Login.validateUser C# (CSharp) Метод

validateUser() публичный Метод

public validateUser ( string centroActual ) : bool
centroActual string
Результат bool
        public bool validateUser(string centroActual)
        {
            try
            {
                var usuarioQuery = from user in entidad.usuarios
                                   where user.username == userName && user.password == password
                                   select user;

                usuario[] usr = usuarioQuery.ToArray();

                if (usr.Length != 0)
                {
                    bool centroEncontrado = false;

                    foreach (role r in usr[0].roles)
                    {
                        centro ctr = r.centro1;

                        if (centroActual == ctr.lugar)
                        {
                            centroEncontrado = true;
                            break;
                        }
                    }

                    if (centroEncontrado)
                    {

                        this.idEmp = usr[0].empleado;
                        return true;
                    }
                    else
                        return false;
                } else
                    return false;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString() + "  --Login.cs / validateUser()");
            }
        }

Usage Example

Пример #1
0
 public void validateUserTest()
 {
     string userName = "******"; // TODO: Initialize to an appropriate value
     string password = "******"; // TODO: Initialize to an appropriate value
     Login target = new Login(userName, password); // TODO: Initialize to an appropriate value
     bool expected = true; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.validateUser("Tegucigalpa");
     Assert.AreEqual(expected, actual);
 }
All Usage Examples Of BL.Login::validateUser