Esempio n. 1
0
        protected void Application_Start()
        {
            using (var ctx = new ImportItems())
            {
                ctx.InitAndMigrate();
            }

            GlobalConfiguration.Configuration.UseMemoryStorage();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Esempio n. 2
0
        public void Import(IImportItems progress, string xmlFilePath)
        {
            ImportItems db = new ImportItems();
            db.ShowDatabaseLog = DebugMode;

            progress.OnImportStart();

            List<ItemsVM> itemsList = new List<ItemsVM>();

            var items = GetItemsFromXML(xmlFilePath);
            
            itemsList.AddRange(items);

            List<String> errors = new List<String>();
            db.ShowDatabaseLog = true;
            db.UpdateAll(itemsList, true, out errors, progress);

            foreach (var err in errors)
            {
                progress.OnError(err);
            }

            progress.OnImportFinished();
        }