Example #1
0
        public async Task <ActionResult> Submit(string data)
        {
            ClientInfo info = JsonConvert.DeserializeObject <ClientInfo>(data);

            ClientVitals cv = new ClientVitals()
            {
                FirstName             = info.FirstName,
                MiddleName            = info.MiddleName,
                LastName              = info.LastName,
                GenderTypeID          = info.Gender,
                Aka1                  = info.Aka1,
                Aka2                  = info.Aka2,
                CountryOfBirth        = info.CountryOfBirth,
                DOB                   = info.DOB,
                AproximativeAge       = info.AproximativeAge,
                DisabilityYN          = info.DisabilityYN,
                MedicAlertYN          = info.MedicAlertYN,
                VeteranStateID        = info.VeteranStateID,
                CitizenshipTypeID     = info.CitizenshipTypeID,
                AboriginalIndicatorID = info.AboriginalIndicatorID,
                IsStealthYN           = "Y"
            };

            ViewBag.Success = true;

            var authService = new AuthenticationService.AuthenticationServiceClient();

            using (var scope = authService.InnerChannel)
            {
                var token = await authService.ValidateUserAsync("admin", "123456", 1, "", Request.RequestContext.HttpContext.Session.SessionID);

                try
                {
                    var clientService          = new ClientService.ClientServiceClient();
                    WCFValidationResult result = clientService.InsertVitals(cv, token);

                    ViewBag.Success = result.Success;

                    if (!result.Success)
                    {
                        logless(result.ValidationMessages[0], "Result message");
                    }
                }
                catch (FaultException e)
                {
                    logless(e.Message, "Exception message");

                    ViewBag.Success = false;
                }
            }

            return(View("Confirm"));
        }
Example #2
0
        public AuthenticationService.AuthenticationServiceClient GetAuthenticationClient(ILoginSettings loginSettings)
        {
            var client = new AuthenticationService.AuthenticationServiceClient();

            client.Endpoint.Address = new EndpointAddress(_appSettings.AuthenticationServiceUri);

            if (client.Endpoint.Behaviors.Find <EndpointBehavior>() == null && loginSettings != null)
            {
                var customBehavior = new EndpointBehavior(loginSettings.UserName, loginSettings.Password, loginSettings.CustomerId);
                client.Endpoint.Behaviors.Add(customBehavior);
            }
            return(client);
        }
Example #3
0
        public ServiceFacade(IEventAggregator  messageBus )
        {
            _messageBus = messageBus;
            if(_authenticationservice==null)
            {
                _authenticationservice= new AuthenticationServiceClient();
            }
            if(_customerservice==null)
            {
             _customerservice = new CustomerServiceClient();
            }

            
        }
        private bool authenticateUser()
        {
            var authService = new AuthenticationService.AuthenticationServiceClient();

            try
            {
                if (authService.Login(txtUsername.Text.ToString(), txtPassword.Password.ToString(), string.Empty, true))
                {
                    return true;
                }

                else
                {
                    return false;
                }
            }
            catch (Exception)
            {
                return false;
            }
        }
        private static async Task AuthenticateAsync(string login, string password, ChannelBase channel)
        {
            try
            {
                var authService =
                    new AuthenticationService.AuthenticationServiceClient(channel);

                var result = await authService.LoginAsync(new AuthenticateRequest
                {
                    Login    = login,
                    Password = password
                });

                _login = result.Login;
                _token = result.Token;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.ReadKey();
            }
        }