Ejemplo n.º 1
0
        public ItJakubServiceEncryptedClient GetEncryptedClient()
        {
            var endpoint = m_configurationProvider.GetEndpointAddress(EncryptedEndpointName);
            var binding  = m_configurationProvider.GetBasicHttpsBindingCertificateAuthentication();
            var behavior = new ClientCredentials();

            behavior.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, "C787F20847606DC40E50E015A5D2E3A9E59B704C");

            var client = new ItJakubServiceEncryptedClient(binding, endpoint);

            client.Endpoint.Behaviors.Remove <ClientCredentials>();
            client.Endpoint.Behaviors.Add(behavior);

            return(client);
        }
Ejemplo n.º 2
0
        public ItJakubServiceEncryptedClient GetEncryptedClient()
        {
            var client = new ItJakubServiceEncryptedClient(EncryptedEndpointName);

            return(client);
        }
Ejemplo n.º 3
0
        public FeedbackViewModel GetBasicViewModel(FeedbackFormIdentification formIdentification, string staticTextName, ItJakubServiceEncryptedClient client, string username = null)
        {
            var pageStaticText = m_staticTextManager.GetRenderedHtmlText(staticTextName);

            if (string.IsNullOrWhiteSpace(username))
            {
                var viewModel = new FeedbackViewModel
                {
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }

            using (client)
            {
                var user      = client.FindUserByUserName(username);
                var viewModel = new FeedbackViewModel
                {
                    Name               = string.Format("{0} {1}", user.FirstName, user.LastName),
                    Email              = user.Email,
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }
        }