Esempio n. 1
0
        /// <summary>
        /// Double dispatch
        /// </summary>
        /// <param name="settingsRepository"></param>
        /// <param name="configService"></param>
        public static ClientApplication AppIdSetup(ISettingsRepository settingsRepository,IConfigService configService)
        {
            var allowDecimal = settingsRepository.GetByKey(SettingsKeys.AllowDecimal);
            SetQuantityFormat(allowDecimal);
            Guid appId = configService.GetClientAppId();
            string hostname = Dns.GetHostName();

            ClientApplication clientApplication = configService.GetClientApplications().FirstOrDefault(s => s.Id == appId);
            if (clientApplication == null)
            {
                clientApplication = new ClientApplication();
                clientApplication.CanSync = false;
                clientApplication.DateInitialized = DateTime.Now;
            }
            clientApplication.HostName = hostname;
            clientApplication.Id = appId;
            configService.SaveClientApplication(clientApplication);
            return clientApplication;
        }