示例#1
0
        public User SignIn(Login login)
        {
            bool flag = false;
            User user = null;

            var connection = _SQLConnection.GetConnection();

            connection.Open();

            var cmd = Service.StoreProcedureCall
                          (sqlConnection: connection, StoreProcedure: "TradeLine.SignIn", Class: login);

            using (SqlDataReader rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    flag = ExtensionUtility.PasswordDecrypt(login.Password, rdr["Password"].ToString());
                    if (flag)
                    {
                        user = new User()
                        {
                            Name           = rdr["Name"].ToString(),
                            Lastname       = rdr["Lastname"].ToString(),
                            Username       = rdr["Username"].ToString(),
                            Email          = rdr["Email"].ToString(),
                            Identification = rdr["Identification"].ToString(),
                            ImageURL       = rdr["ImageURL"].ToString(),
                            Rol            = rdr["Rol"].ToString()
                        };
                    }
                }
            }

            connection.Close();

            return(user);
        }