private void ConnectETSOnline()
        {
            // Connect to ETS
            LogsTxt = "Start proccess...";

            testETSOnline = new EtsApi(true);

            if (testETSOnline.GetConnection())
            {
                LogsTxt += "\nConnection to ETS is Ok";
                LogsTxt += "\nConnect to quotes table";

                if (testETSOnline.QuotesConnection() != 0)
                {
                    LogsTxt += "\nConnection to QuotesTable is Ok";

                    isRun = true;

                    quotesTask = new Task(QuotesTask);
                    quotesTask.Start();
                }
                else
                {
                    LogsTxt += "\nError with connection to Qutoes Table";
                }
            }
            else
            {
                LogsTxt += "\nError with connection to ETS";
            }
        }
        private static void RegisterTypes(IUnityContainer container)
        {
            var etsUrl        = WebConfigurationManager.AppSettings["EtsUrl"];
            var tempDirectory = HttpContext.Current.Server.MapPath("~/App_Data");

            container.RegisterType <OnlineBindService, OnlineBindService>(new ContainerControlledLifetimeManager(), new InjectionConstructor(etsUrl));

            //  ets api old version
            var etsApi = new EtsApi(string.Format("{0}/{1}", tempDirectory, "Online_war.ini"));

            container.RegisterInstance <IEtsApi>(etsApi);

            container.RegisterType <IDataManager, EntityContext>(BROKER_BASE, new InjectionConstructor(BROKER_BASE));
            container.RegisterType <IDataManager, EntityContext>(SUB_SYSTEM_PAYDA_TRADE, new InjectionConstructor(SUB_SYSTEM_PAYDA_TRADE));
            container.RegisterType <IAltaUserRepository, AltaUserRepository>(BROKER_BASE, new InjectionConstructor(BROKER_BASE));
            container.RegisterType <IAltaUserRepository, AltaUserRepository>(SUB_SYSTEM_PAYDA_TRADE, new InjectionConstructor(SUB_SYSTEM_PAYDA_TRADE));
            //archive
            container.RegisterType <ArchiveManager, ArchiveManager>(BROKER_BASE,
                                                                    new InjectionFactory((c, t, s) => new ArchiveManager(
                                                                                             container.Resolve <IDataManager>(BROKER_BASE),
                                                                                             WebConfigurationManager.AppSettings["ArchiveHost"],
                                                                                             WebConfigurationManager.AppSettings["ArchiveUser"],
                                                                                             WebConfigurationManager.AppSettings["ArchivePass"],
                                                                                             WebConfigurationManager.AppSettings["ArchiveRootPath"]
                                                                                             )));

            container.RegisterType <ArchiveManager, ArchiveManager>(SUB_SYSTEM_PAYDA_TRADE,
                                                                    new InjectionFactory((c, t, s) => new ArchiveManager(
                                                                                             container.Resolve <IDataManager>(SUB_SYSTEM_PAYDA_TRADE),
                                                                                             WebConfigurationManager.AppSettings["ArchiveHost_PaydaTrade"],
                                                                                             WebConfigurationManager.AppSettings["ArchiveUser_PaydaTrade"],
                                                                                             WebConfigurationManager.AppSettings["ArchivePass_PaydaTrade"],
                                                                                             WebConfigurationManager.AppSettings["ArchiveRootPath_PaydaTrade"]
                                                                                             )));

            container.RegisterInstance <IMapper>("SupplierMapper", MappingConfig.CreateSupplierMapper());
        }