public static ObservableCollection <LotItem> GetLotsOfProduct(string MaterialCode) { var allItems = new ObservableCollection <LotItem>(); if (SingletonERP.GetERPDbInstance().TestERPDBConnection()) { return(DBinit.GetLotsOfProduct(MaterialCode)); } return(allItems); }
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)); } }
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(); } }
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(); }