public async Task <bool> DeleteCustomerAsync(CustomerWrapper selectedCustomer) { await Task.Run(async() => { using (var context = _contextCreator()) { var customer = context.Customers.First(c => c.CustomerId == selectedCustomer._Id); var address = context.Addresses.FirstOrDefault(a => a.AddressId == customer.AddressId); var city = context.Cities.FirstOrDefault(ci => ci.CityId == address.CityId); var country = context.Countries.FirstOrDefault(cnry => cnry.CountryId == city.CountryId); context.Customers.Remove(customer); context.Addresses.Remove(address); context.Cities.Remove(city); context.Countries.Remove(country); context.Entry(customer).State = EntityState.Deleted; context.Entry(address).State = EntityState.Deleted; context.Entry(city).State = EntityState.Deleted; context.Entry(country).State = EntityState.Deleted; await context.SaveChangesAsync(); } }); return(true); }
private void InitializeCustomer(Customer customer) { Customer = new CustomerWrapper(customer); Customer.PropertyChanged += (s, e) => { if (!HasChanges) { HasChanges = _customerRepository.HasChanges(); } if (e.PropertyName == nameof(Customer.HasErrors)) { ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged(); } if (e.PropertyName == nameof(Customer.Name)) { SetTitle(); } }; ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged(); if (Customer.Id == 0) { // little trick to trigger the validation Customer.Name = ""; Customer.Address = ""; Customer.Phone = ""; } SetTitle(); }
public async Task SaveNewCustomerAsync(CustomerWrapper newCustomer, User user) { await Task.Run(async() => { using (var context = _contextCreator()) { var customerId = context.Customers.Count(); var addressId = context.Addresses.Count(); var cityId = context.Cities.Count(); var countryId = context.Countries.Count(); var customer = CreateCustomer(customerId, addressId, newCustomer, user); var address = CreateAddress(addressId, cityId, newCustomer, user); var city = CreateCity(cityId, countryId, newCustomer, user); var country = CreateCountry(countryId, newCustomer, user); ValidateCustomerData(address); context.Customers.Add(customer); context.Addresses.Add(address); context.Cities.Add(city); context.Countries.Add(country); context.Entry(customer).State = EntityState.Added; context.Entry(address).State = EntityState.Added; context.Entry(city).State = EntityState.Added; context.Entry(country).State = EntityState.Added; await context.SaveChangesAsync(); } }); }
public override async void OnNavigatedTo(NavigationContext navigationContext) { base.OnNavigatedTo(navigationContext); if (navigationContext.Parameters.ContainsKey("CustomerId") == false) { Customer = new CustomerWrapper(_contosoRepository, new Models.Customer()) { IsNewCustomer = true, IsInEdit = true }; } else { SetBusy("CustomerLoad", true); var id = navigationContext.Parameters.GetValue <Guid>("CustomerId"); //Debug.WriteLine($"{Title} / {id}"); await DispatcherHelper.ExecuteOnUIThreadAsync( async() => { var customer = await _contosoRepository.Customers.GetAsync(id); Customer = new CustomerWrapper(_contosoRepository, customer); await Customer.LoadOrdersAsync(); }); SetBusy("CustomerLoad", false); } }
private async void OnNewCustomerCreate(CustomerWrapper newCustomer) { Controls[ApplicationControls.CustomerDetail] = null; CurrentContent = Controls[ApplicationControls.CustomersList]; _eventAggregator.GetEvent <CustomerIsLoadingEvent>().Publish(true); if (newCustomer != null) { //catches exeption if phone number is not a number try { if (newCustomer._ExistingCustomer) { await _customerDataService.UpdateCustomerAsync(newCustomer, _user); } else { await _customerDataService.SaveNewCustomerAsync(newCustomer, _user); } } catch (InvalidCustomerDataException ex) { MessageBox.Show(ex.Message, "Error"); } await LoadCustomerData(); } _eventAggregator.GetEvent <CustomerIsLoadingEvent>().Publish(false); }
public override bool CommitChanges(StepPartners step, Assistant assistant) { BackgroundJob job = new BackgroundJob(step); job.Action += () => { PresentationDomain.Invoke(() => { step.Notebook.Sensitive = false; }); IList <CustomerWrapper> allCustomers = GetAllCustomers(); if (allCustomers.Count <= 0) { return; } CustomerWrapper def = allCustomers [0]; // Substitute the default customer def.Customer.Id = Partner.DefaultId; def.CommitChanges(); foreach (CustomerWrapper customer in allCustomers) { customer.CommitChanges(); } }; assistant.EnqueueBackgroundJob(job); return(true); }
public CustomerWrapperTests() { //Arrange var accountManager = new AccountManager(); var bankAccounts = new List <BankAccount>() { new BankAccountTest(id: 1) { AccountNo = "1234567890" }, new BankAccountTest(id: 2) { AccountNo = "0000000001" } }; _anyCustomer = new CustomerTest(id: 2) { Name = "AnySurname AnyLastName", InternetAdress = "http://microsoft.com", AccountManager = accountManager, BankAccounts = bankAccounts }; _customerWrapper = new CustomerWrapper(_anyCustomer); }
public AppointmentDetailViewModel(IEventAggregator eventAggregator, CustomerWrapper customer, AppointmentWrapper appointment) { _eventAggregator = eventAggregator; Customer = customer; Appointment = appointment; Type = new ObservableCollection <string> { "New Appt", "Follow up" }; TypeSelected = Appointment._Type; AvailableStartTime = new ObservableCollection <TimeSpan>(); AvailableEndTime = new ObservableCollection <TimeSpan>(); CreateTime(new TimeSpan(START_TIME_HOUR, 0, 0), AvailableStartTime); if (Appointment._Title != null) { Appointment._SelectedDate = Appointment._Start; var startTime = TimeZoneInfo.ConvertTimeFromUtc(Appointment._Start, TimeZoneInfo.Local); var endTime = TimeZoneInfo.ConvertTimeFromUtc(Appointment._End, TimeZoneInfo.Local); SelectedStartTime = new TimeSpan(startTime.Hour, startTime.Minute, 0); CreateTime(SelectedStartTime ?? new TimeSpan(), AvailableStartTime); SelectedEndTime = new TimeSpan(endTime.Hour, endTime.Minute, 0); } SaveCommand = new RelayCommand(OnAppointmentSave, CanAppointmentSave); CancelCommand = new RelayCommand(OnCancel); }
public InterpreterTests() { var container = new UnityContainer(); //container.RegisterType<IExpression<string, object>, IndexExpression>(); _contextMock = new Mock <IContext>(); _contextMock.Setup(o => o.Input).Returns("[%o_number%] [%c_firstName%] [%c_lastName%]"); var context = new Context("[%o_number%] [%c_firstName%] [%c_lastName%] [%h_SerialNumber%]"); var contextInput = "Numer zlecenia [%numer%], Data: [%data%] "; _context2 = new Context(contextInput); var orderModel = new CustomerWrapper(new Customer() { Id = Guid.NewGuid(), FirstName = "Jan", LastName = "Nowak" }); var customerModel = new OrderWrapper(new Order() { Id = Guid.NewGuid(), Number = "01/092019" }); var hardwareModel = new HardwareWrapper(new Hardware() { Id = Guid.NewGuid(), SerialNumber = "12332151HD" }); //_interpreter = new Interpreter(context, Expression.IndexExpression, orderModel, customerModel, hardwareModel); }
public CustomerDetailViewModel(IEventAggregator eventAggregator, CustomerWrapper customer) { _eventAggregator = eventAggregator; Customer = customer; SelectedCountry = Customer._SelectedCountry; SaveCommand = new RelayCommand(OnCustomerSave, CanCustomerSave); CancelCommand = new RelayCommand(OnCancel); }
private Country CreateCountry(int countryId, CustomerWrapper newCustomer, User user) { return(new Country { CountryId = countryId, Country1 = newCustomer._Country, CreateDate = DateTime.UtcNow, CreatedBy = user.UserId.ToString(), LastUpdate = DateTime.UtcNow, LastUpdateBy = user.UserId.ToString() }); }
private void SetSelectedItem(CustomerWrapper customerWrapper) { SelectedItem = customerWrapper; SelectedItem.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(SelectedItem.IsChanged)) { SaveCommand.RaiseCanExecuteChanged(); ResetCommand.RaiseCanExecuteChanged(); _eventAggregator.GetEvent <ModelIsChangedEvent>().Publish(SelectedItem.IsChanged);//Notify the mainwindow that there are changes, to prompt user not to close window. } }; }
public IActionResult AddCustomer(CustomerWrapper fromForm) { if (ModelState.IsValid) { dbContext.Add(fromForm.Customer); dbContext.SaveChanges(); return(RedirectToAction("Customers")); } else { CustomerWrapper CustomerWrapper = new CustomerWrapper(); CustomerWrapper.AllCustomers = dbContext.Customers.ToList(); return(View("Customers", CustomerWrapper)); } }
public IActionResult Customers() { RegisterUser fromLogin = HttpContext.Session.GetObjectFromJson <RegisterUser>("LoggedInUser"); if (fromLogin == null) { return(RedirectToAction("Index")); } CustomerWrapper CustomerWrapper = new CustomerWrapper(); CustomerWrapper.AllCustomers = dbContext.Customers.ToList(); return(View("Customers", CustomerWrapper)); }
private void InitializeCustomer(Customer customer) { Customer = new CustomerWrapper(customer); Customer.PropertyChanged += (s, e) => { if (!HasChanges) { HasChanges = _personRepository.HasChanges(); } if (e.PropertyName == nameof(Customer.HasErrors)) { ((DelegateCommand <PasswordBox>)SaveCommand).RaiseCanExecuteChanged(); } }; ((DelegateCommand <PasswordBox>)SaveCommand).RaiseCanExecuteChanged(); }
private Address CreateAddress(int addressId, int cityId, CustomerWrapper newCustomer, User user) { return(new Address { AddressId = addressId, Address1 = newCustomer._Address1, Address2 = string.IsNullOrEmpty(newCustomer._Address2) ? "null" : newCustomer._Address2, CityId = cityId, Phone = newCustomer._PhoneNumber, PostalCode = newCustomer._PostalCode, CreateDate = DateTime.UtcNow, CreatedBy = user.UserId.ToString(), LastUpdate = DateTime.UtcNow, LastUpdateBy = user.UserId.ToString() }); }
public void WhenEntityIsCreatedDefaultsAreCorrect() { // arrange var sut = new CustomerWrapper(); // act // assert Assert.True(sut.ActiveRuleSet == ValidationConstants.Insert, "ActiveRule set should have been Insert"); Assert.True(sut.Error == String.Empty, "Error should have been empty string"); Assert.True(sut.IsDirty == false, "IsDirty should have been false"); Assert.True(sut.IsDuplicateRow == false, "IsDuplicateRow should have been false"); Assert.True(sut.IsLoading == false, "IsLoading should have been false"); Assert.True(sut.IsNotValid == false, "IsNotValid should have been false"); Assert.True(sut.IsValid == true, "IsValid should have been true"); Assert.True(sut.MarkedForDeletion == false, "MarkedForDeletion should have been false"); Assert.True(sut.RowNumber == 0, "RowNumber should have been zero"); Assert.True(sut.AddInstanceBusinessValidationRulesCalled, "AddInstanceBusinessValidationRules should have been called"); Assert.True(sut.AddSharedBusinessValidationRulesCalled, "AddSharedBusinessValidationRules should have been called"); Assert.True(sut.AddSharedCharacterCasingFormattingRulesCalled, "AddSharedCharacterCasingFormattingRules should have been called"); }
private Customer CreateCustomer(int customerId, int addressId, CustomerWrapper newCustomer, User user) { var dayOfCreation = newCustomer._CreatedDate; if (!newCustomer._ExistingCustomer) { dayOfCreation = DateTime.UtcNow; } return(new Customer { CustomerId = customerId, CustomerName = newCustomer._Fullname, AddressId = addressId, Active = newCustomer._Active, CreateDate = dayOfCreation, CreatedBy = user.UserId.ToString(), LastUpdate = DateTime.UtcNow, LastUpdateBy = user.UserId.ToString() }); }
public async Task UpdateCustomerAsync(CustomerWrapper updatedCustomer, User user) { await Task.Run(async() => { using (var context = _contextCreator()) { var customer = CreateCustomer(updatedCustomer._Id, updatedCustomer._AddressId, updatedCustomer, user); var address = CreateAddress(updatedCustomer._AddressId, updatedCustomer._CityId, updatedCustomer, user); var city = CreateCity(updatedCustomer._CityId, updatedCustomer._CountryId, updatedCustomer, user); var country = CreateCountry(updatedCustomer._CountryId, updatedCustomer, user); ValidateCustomerData(address); context.Entry(customer).State = EntityState.Modified; context.Entry(address).State = EntityState.Modified; context.Entry(city).State = EntityState.Modified; context.Entry(country).State = EntityState.Modified; await context.SaveChangesAsync(); } }); }
public static ObservableCollection <CustomerWrapper> GetKunden() { var kuden = new ObservableCollection <CustomerWrapper>(); var kunde1 = new Kunde() { Klassifizirung = 1, Name = "TestKunde1", Ort = "Darmstadt", Plz = "64283", Str = "Stauffenbergstraße 56" }; var kunde2 = new Kunde() { Klassifizirung = 0, Name = "TestKunde2", Ort = "Taunusstein", Plz = "65232", Str = "Bleidenstädterstraße 5" }; var kunde3 = new Kunde() { Klassifizirung = 2, Name = "TestKunde3", Ort = "Darmstadt", Plz = "64293", Str = "Otto-Röhm-Straße 69" }; var artikel1 = new Artikel() { Bezeichnung = "TestArtikel1", IstLieferbar = true, Preis = 5.50 }; var artikel2 = new Artikel() { Bezeichnung = "TestArtikel2", IstLieferbar = false, Preis = 12.67 }; var atg1Kd1 = new Auftrag(kunde1.Uid, new TestBillingProvider(), new TestDiscountProvider()) { AuftragsDatum = new DateTime(2016, 1, 1), LieferDatum = new DateTime(2016, 05, 01), Status = 2 }; var pos1atg1 = new Auftragsposition(atg1Kd1.Uid, new TestDiscountProvider()) { ArtikelUid = artikel1.Uid, Bestellmenge = 5, Liefermenge = 5 }; var pos2atg1 = new Auftragsposition(atg1Kd1.Uid, new TestDiscountProvider()) { ArtikelUid = artikel2.Uid, Bestellmenge = 41, Liefermenge = 20 }; var pos1Wrapper = new PositionWrapper() { Position = pos1atg1, Artikel = artikel1 }; var pos2Wrapper = new PositionWrapper() { Position = pos2atg1, Artikel = artikel2 }; var atgWrapper = new AuftragWrapper() { Auftrag = atg1Kd1, Positionen = new ObservableCollection <PositionWrapper>() { pos1Wrapper, pos2Wrapper }, Kunde = kunde1 }; var kd1Wrapper = new CustomerWrapper() { Kunde = kunde1, Auftraege = new ObservableCollection <AuftragWrapper>() { atgWrapper } }; var kd2Wrapper = new CustomerWrapper() { Kunde = kunde2 }; var kd3Wrapper = new CustomerWrapper() { Kunde = kunde3 }; return(new ObservableCollection <CustomerWrapper>() { kd1Wrapper, kd2Wrapper, kd3Wrapper }); }
private void OnChangeSelectedCustomer(CustomerWrapper selectedCustomer) { selectedCustomer.Orders = new ObservableCollection<OrderWrapper>( _ordersRepository.GetAllOrders().Where(o => o.CustomerId == SelectedCustomer.Id).Select( x => new OrderWrapper(x))); var order = new Order { CustomerId = selectedCustomer.Id, ItemsTotal = 1, OrderDate = DateTime.Now, StoreId = selectedCustomer.StoreId, Phone = SelectedCustomer.Phone, DeliveryCity = SelectedCustomer.City, DeliveryState = selectedCustomer.State, DeliveryStreet = selectedCustomer.Street, DeliveryZip = selectedCustomer.Zip, DeliveryDate = DateTime.Now.AddDays(2) }; NewOrder = new OrderWrapper(order); }
static bool eingabeAusfuehren(string s) { string a = ""; int id = 0; switch (s) { case "0": //Hilfe ausgeben hilfe(); return(true); case "1": //Neuen Kunden erstellen try { Console.WriteLine("Um einen neuen Kunden anzulegen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Vorname, Nachname, Ort, PLZ, Strasse, Hausnummer, Geburtstag\nEingabe: "); a = Console.ReadLine(); //Bei string.split wird auch immer das Trennzeichen in das array kopiert. id = CustomerWrapper.Intf_createCustomer(a.Split(',', ' ')[0], //Vorname a.Split(',', ' ')[2], //Nachname a.Split(',', ' ')[4], //Ort a.Split(',', ' ')[6], //PLZ a.Split(',', ' ')[8], //Strasse Int32.Parse(a.Split(',', ' ')[10]), //Hausnummer a.Split(',', ' ')[12]); //Geburtsdatum if (id >= 0) { Console.WriteLine("Deine Benutzer ID = " + id + ", diese bitte merken."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "2": //Kunden bearbeiten try { Console.WriteLine("Um einen Kunden zu bearbeiten, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kundennummer, Vorname, Nachname, Ort, PLZ, Strasse, Hausnummer, Geburtstag\nEingabe: "); a = Console.ReadLine(); //Bei string.split wird auch immer das Trennzeichen in das array kopiert. id = CustomerWrapper.Intf_updateCustomer(Int32.Parse(a.Split(',', ' ')[0]), //Kundennummer a.Split(',', ' ')[2], //Vorname a.Split(',', ' ')[4], //Nachname a.Split(',', ' ')[6], //Ort a.Split(',', ' ')[8], //PLZ a.Split(',', ' ')[10], //Strasse Int32.Parse(a.Split(',', ' ')[12]), //Hausnummer a.Split(',', ' ')[14]); //Geburtsdatum if (id >= 0) { Console.WriteLine("Erfolgreich geändert."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "3": //Kunden löschen try { Console.WriteLine("Um einen Kunden zu löschen, bitte die Kundennummer eingeben: "); a = Console.ReadLine(); id = CustomerWrapper.Intf_deleteCustomer(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich gelöscht."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "4": //Konto erstellen try { Console.WriteLine("Um ein neues Konto zu erstellen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontotyp(0 = Spar, 1 = Kredit), Anfangsstand, Name des Kontos.\nEingabe: "); a = Console.ReadLine(); id = AccountWrapper.Intf_createAccount(Int32.Parse(a.Split(',', ' ')[0]), Double.Parse(a.Split(',', ' ')[2]), a.Split(',', ' ')[4]); if (id >= 0) { Console.WriteLine("Erfolgreich erstellt. Kontonummer = " + id + ", bitte merken."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "5": //Konto bearbeiten try { Console.WriteLine("Um ein Konto zu bearbeiten, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Kontotyp(0 = Spar, 1 = Kredit)\nEingabe: "); a = Console.ReadLine(); id = AccountWrapper.Intf_editAccount(Int32.Parse(a.Split(',', ' ')[0]), Int32.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich bearbeitet."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "6": //Konto löschen try { Console.WriteLine("Um ein Konto zu löschen, bitte die Kontonummer eingeben: "); a = Console.ReadLine(); id = AccountWrapper.Intf_deleteAccount(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich gelöscht."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "7": //Kontoauszug erstellen try { Console.WriteLine("Um einen Kontoauszug zu erstellen, bitte die Kontonummer eingeben: "); a = Console.ReadLine(); id = AccountWrapper.Intf_createBankStatement(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich erstellt."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "8": //Neue Ueberweisung try { //Die Überweisung braucht auch einen zum Konto zugewiesenen Kunden. Console.WriteLine("Um eine neue Ueberweisung durchzuführen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kundenummer (der die Ueberweisung startet), Von Kontonummer, zu Kontonummer, Betrag, in Waehrung(EUR = 0, USD = 1, GBP = 2, INR = 3, JPY = 4)\nEingabe: "); a = Console.ReadLine(); AccountWrapper.Intf_attachAccount(Int32.Parse(a.Split(',', ' ')[2]), Int32.Parse(a.Split(',', ' ')[0])); id = TransactionWrapper.Intf_transfer(Int32.Parse(a.Split(',', ' ')[0]), Int32.Parse(a.Split(',', ' ')[2]), Int32.Parse(a.Split(',', ' ')[4]), float.Parse(a.Split(',', ' ')[6]), Int32.Parse(a.Split(',', ' ')[8])); if (id >= 0) { Console.WriteLine("Erfolgreich ueberwiesen."); } else { Console.WriteLine("Falsche Eingaben bei der Ueberweisung, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "9": //Einzahlen try { Console.WriteLine("Um etwas auf einem Konto einzuzahlen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Betrag\nEingabe: "); a = Console.ReadLine(); id = TransactionWrapper.Intf_deposit(Int32.Parse(a.Split(',', ' ')[0]), float.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich eingezahlt."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "10": //Abheben try { Console.WriteLine("Um etwas von einem Konto abzuheben, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Betrag\nEingabe: "); a = Console.ReadLine(); id = TransactionWrapper.Intf_withdraw(Int32.Parse(a.Split(',', ' ')[0]), float.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich abgehoben."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "11": //Wartungsaufgaben try { Console.WriteLine("Räumt nun alle Daten auf. Alles wird gelöscht. Bitte mit \"ja\" bestätigen."); a = Console.ReadLine(); if (a.Equals("ja")) { DataMaintenance.Intf_clearData(); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "exit": return(false); default: hilfe(); return(true); } }
static void Main(string[] args) { #region FUNCTION TEST CALL //clear existing data of directory DataMaintenance.Intf_clearData(); //-------------------------------------------------------------------------- int VEcusID, FScusID = 0; // Customer functions VEcusID = CustomerWrapper.Intf_createCustomer("Mike", "Thomas", "5020", "Salzburg", "Breitenfelderstrasse", 47, "13.11.1992"); CustomerWrapper.Intf_updateCustomer(VEcusID, "Mike", "Anders", "5020", "AnotherPlace", "AnotherStreet", 1111, "11.11.1111"); CustomerWrapper.Intf_deleteCustomer(VEcusID); VEcusID = CustomerWrapper.Intf_createCustomer("Betty", "Katzian", "5020", "Salzburg", "Breitenfelderstrasse", 47, "13.11.1992"); //-------------------------------------------------------------------------- // Account functions int VEaccID, FSaccID = 0; VEaccID = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); //Account edit try { //interface throws notimplex bc 2nd party dll does not include this functionality AccountWrapper.Intf_editAccount(FSaccID, 1); } catch (Exception ex) { Debug.Print(ex.Message); } //Account deletion try { //interface throws notimplex bc 2nd party dll does not include this functionality AccountWrapper.Intf_deleteAccount(FSaccID); } catch (Exception ex) { Debug.Print(ex.Message); } ////create transactions for the accounts int VEaccID2, FSaccID2, VEaccID3, FSaccID3 = 0; VEaccID2 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); FSaccID2 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); VEaccID3 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); FSaccID3 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); //Attach/Dettach customer to account AccountWrapper.Intf_attachAccount(FSaccID2, FScusID); AccountWrapper.Intf_dettachAccount(FSaccID2, FScusID); AccountWrapper.Intf_attachAccount(FSaccID2, FScusID); //Creating transactions TransactionWrapper.Intf_transfer(FScusID, FSaccID2, FSaccID3, 100, 0); TransactionWrapper.Intf_deposit(FSaccID2, 500); TransactionWrapper.Intf_withdraw(FSaccID2, 500); //create a bankstatement AccountWrapper.Intf_createBankStatement(FSaccID2); TransactionWrapper.Intf_transfer(FScusID, FSaccID2, FSaccID3, 100, 0); //create a bankstatement AccountWrapper.Intf_createBankStatement(FSaccID2); #endregion DataMaintenance.Intf_clearData(); Console.WriteLine("\nThread schläft für 5 Sekunden, bitte warten!"); Thread.Sleep(5000); Console.Clear(); bool running = true; Console.WriteLine("Willkommen zum einfachen BankClient.\nIm Folgenden werden die eingebauten Kommandos und mit welcher Zahl sie aufgerufen werden können erklärt."); hilfe(); while (running) { Console.WriteLine("Bitte Zahl eingeben: "); running = eingabeAusfuehren(Console.ReadLine()); } }
private void SelectedItemSelectedEvent(CustomerWrapper selectedItem) { SelectedCustomer = selectedItem; NavTo(ViewNames.CustomerAddView); }