예제 #1
0
        public static AuthorizationInfoDTO Authenticate(string userName, string password)
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler);
            AAServiceV2Client aaServiceClient = new AAServiceV2Client();

            try
            {
                AuthorizationInfoDTO _authorizationInfoDTO = aaServiceClient.Authenticate(userName, password, APPLICATION);

                foreach (RoleDTO roleDTO in _authorizationInfoDTO.Roles)
                {
                    roleDTO.ApplicationContexts = roleDTO.ApplicationContexts.Where(item => item.ApplicationContext1 == CONTEXT_ONE || item.ApplicationContext1 == "*").ToList();
                }
                _authorizationInfoDTO.Roles = _authorizationInfoDTO.Roles.Where(item => item.ApplicationContexts.Count > 0).ToList();

                foreach (ScenarioDTO scenarioDTO in _authorizationInfoDTO.Scenarios)
                {
                    scenarioDTO.ApplicationContexts = scenarioDTO.ApplicationContexts.Where(item => item.ApplicationContext1 == CONTEXT_ONE || item.ApplicationContext1 == "*").ToList();
                }
                _authorizationInfoDTO.Scenarios = _authorizationInfoDTO.Scenarios.Where(item => item.ApplicationContexts.Count > 0).ToList();

                return _authorizationInfoDTO;
            }
            catch (Exception e)
            {
                ElmahLogger.Warn("AAService call (with username and password) failed : ", e);
                return null;
            }
        }
예제 #2
0
        static void Main(string[] args)
        {

            while (true)
            {
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler);

                AAServiceV2Client client = new AAServiceV2Client();
                AuthorizationInfoDTO auazInfo = client.Authenticate("beymen_entegrasyon", "123", "Checkout");
                //AuthorizationInfoDTO auazInfo = client.Authenticate("71234", "123", "ECommerce");

                GlobalHeaderMesages.Instance.AuthenticationToken = auazInfo.Token.TokenString;

                Console.WriteLine("Herhangi bir tusa basınız. Checkout: c, Location: l, Cancellation: I, Stock Update: s, Exit: e");

                var keyInfo = Console.ReadKey();

                if (keyInfo.Key == ConsoleKey.C)
                {
                    Checkout();

                    Console.WriteLine("İşlem tamamlandı.");
                }
                else if (keyInfo.Key == ConsoleKey.L)
                {
                    SuggestLocation();

                    Console.WriteLine("İşlem tamamlandı.");
                }
                else if (keyInfo.Key == ConsoleKey.I)
                {
                    ReportCancelledItems();
                    Console.WriteLine("İşlem tamamlandı.");
                }
                else if(keyInfo.Key == ConsoleKey.S)
                {
                    UpdateStock();
                    Console.WriteLine("İşlem tamamlandı.");
                }

                else if (keyInfo.Key == ConsoleKey.E)
                {
                    return;
                }
                else
                {
                    Console.WriteLine("Geçersiz işlem.");
                }
            }
        }