Ejemplo n.º 1
0
        public static ObservableCollection <LotItem> GetLotsOfProduct(string MaterialCode)
        {
            var allItems = new ObservableCollection <LotItem>();

            if (SingletonERP.GetERPDbInstance().TestERPDBConnection())
            {
                return(DBinit.GetLotsOfProduct(MaterialCode));
            }
            return(allItems);
        }
Ejemplo n.º 2
0
        public static void GetAllCustomersList(ObservableCollection <CustomerItem> ComboBoxItems)
        {
            var allItems = new List <CustomerItem>
            {
                new CustomerItem("000", AppSettings.LangConfig == "GR" ? "Καμία επιλογή" : "None selected")
            };

            if (SingletonERP.GetERPDbInstance().TestERPDBConnection())
            {
                allItems.AddRange(DBinit.GetAllPrintableCustomers().ToList());
                ComboBoxItems.Clear();
                allItems.ForEach(p => ComboBoxItems.Add(p));
            }
            else
            {
                customersCollection.ToList().ForEach(p => ComboBoxItems.Add(p));
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService <HotellDbContext>();
                    DBinit.Initialiser(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "Fel vid initialisering av databasen");
                }

                host.Run();
            }
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                var context = services.GetRequiredService <ShopContext>();

                //Clear DB in every run
                context.Database.EnsureDeleted();

                //initialize customers
                var userManager = services.GetRequiredService <UserManager <IdentityUser> >();
                var roleManager = services.GetRequiredService <RoleManager <IdentityRole> >();

                DBinit.Initialize(context, userManager, roleManager);
            }
            host.Run();
        }