private void cmdSave_Click(object sender, EventArgs e) { var customerId = ((ComboBoxItem)cmbUgyfel.SelectedItem).Value; var serviceId = ((ComboBoxItem)cmbSzolgaltatas.SelectedItem).Value; var useServices = new UseServices(new UsedServiceRepository(new FileUtil())); useServices.Execute(customerId, new List <ServiceModel>() { new ServiceModel { Id = serviceId, Name = txtSzolgaltatasNev.Text, TaxRate = 27 } }); MessageBox.Show("Sikeres mentés!"); }
/// <summary> 开启服务 </summary> /// <param name="args"></param> protected static void Start(string[] args) { Bootstrap = new SpearBootstrap(); var services = new ServiceCollection(); services.AddSpearConfig(ConfigBuild); services.AddLogging(builder => { builder.AddConfiguration(ConfigHelper.Instance.Config.GetSection("Logging")); builder.AddConsole(); }); MapServiceCollection?.Invoke(services); Bootstrap.BuilderHandler += b => { b.Populate(services); MapServices?.Invoke(b); }; Bootstrap.Initialize(); var container = Bootstrap.CreateContainer(); if (UseServiceProvider != null) { var provider = new AutofacServiceProvider(container); UseServiceProvider.Invoke(provider); } UseServices?.Invoke(container); AppDomain.CurrentDomain.ProcessExit += (sender, e) => { Shutdown(); }; Console.CancelKeyPress += (sender, e) => { Shutdown(); }; while (true) { var cmd = Console.ReadLine(); if (cmd == "exit") { break; } Command?.Invoke(cmd, container); } }
public void ExecuteTest() { //Arrange var useServices = new UseServices(new UsedServiceRepository(new FileUtil())); var customer = "Bukó Attila"; var services = new List <ServiceModel>(); services.Add(new ServiceModel { Id = ServiceKey.Hajfestes, Name = "Hajfestés", TaxRate = 27 }); services.Add(new ServiceModel { Id = ServiceKey.Hajvagas, Name = "Hajvágás", TaxRate = 27 }); services.Add(new ServiceModel { Id = ServiceKey.BalayageMelir, Name = "Balayage Melír", TaxRate = 27 }); //Act useServices.Execute(customer, services); }