예제 #1
0
        //_____________________________________________________________________

        /// <summary>
        /// This method gets the details of the logged user in order to display it in his account summary page.
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>

        public static UserData GetUserDetailsByUserName(string UserId)
        {
            MendixGebruikersService.GebruikersServicePortTypeClient msClient = new MendixGebruikersService.GebruikersServicePortTypeClient();
            var response = msClient.GetGebruiker(new MendixGebruikersService.GetGebruiker()
            {
                Naam = UserId, Wachtwoord = ""
            });
            var gebruiker = response.Result;

            var user = new UserData()
            {
                BillingAddress = gebruiker.Straat + " " + gebruiker.Huisnummer,
                FirstName      = gebruiker.Voornaam,
                LastName       = gebruiker.Achternaam,
                UserId         = gebruiker.GebruikerId.ToString()
            };

            return(user);
        }
예제 #2
0
        //_____________________________________________________________________

        /// <summary>
        /// This method is used to login a registered user and grant corresponding privileges.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>

        public static string Login(string user, string pwd)
        {
            try
            {
                MendixGebruikersService.GebruikersServicePortTypeClient msClient = new MendixGebruikersService.GebruikersServicePortTypeClient();
                var response = msClient.GetGebruiker(new MendixGebruikersService.GetGebruiker()
                {
                    Naam = user, Wachtwoord = pwd
                });

                return(response.Result != null
                    ? "Admin logged in successfully"
                    : "");
            }
            catch (Exception ex)
            {
                string result = " Error in Login.";
                return(result);
            }
        }