/// <summary> /// Erstellt eine neue Zulassung. /// </summary> /// <param name="carOwnerId">Id des Halters.</param> /// <param name="vehicleId">Id des Fahrzeugs.</param> /// <param name="licencenumber">Kennzeichen für die Zulassung.</param> /// <param name="evbNumber">eVB-Nummer der Fahrzeugversicherung.</param> /// <param name="generalInspectionDate">Datum der Hauptuntersuchung (HU).</param> /// <param name="registrationDate">Zulassungsdatum.</param> /// <param name="registrationDocumentNumber">Fahrzeugbriefnummer, falls vorhanden.</param> /// <param name="dbContext">Datenbankkontext für die Transaktion.</param> /// <returns>Die neue Zulassung.</returns> public static Registration CreateRegistration(CarOwner carOwner, Vehicle vehicle, string licencenumber, string evbNumber, DateTime? generalInspectionDate, DateTime? registrationDate, string registrationDocumentNumber, string emissionCode, DataClasses1DataContext dbContext) { Registration registration = new Registration() { Vehicle = vehicle, CarOwner = carOwner, Licencenumber = licencenumber, GeneralInspectionDate = generalInspectionDate, RegistrationDate = registrationDate, RegistrationDocumentNumber = registrationDocumentNumber, eVBNumber = evbNumber, EmissionCode = emissionCode }; dbContext.Registration.InsertOnSubmit(registration); dbContext.SubmitChanges(); dbContext.WriteLogItem("Zulassung wurde angelegt.", LogTypes.INSERT, registration.Id, "Registration", vehicle.Id); return registration; }
/// <summary> /// Erstelle einen neuen Fahrzeughalter /// </summary> /// <param name="name">Nachname</param> /// <param name="firstName">Vorname</param> /// <param name="bankAccountId">ID der Bankverbindung</param> /// <param name="contactId">ID des Kontaktdatensatzes</param> /// <param name="adressId">ID der Adresse</param> /// <param name="dbContext">DB Kontext</param> /// <returns>CarOwner</returns> public static CarOwner CreateCarOwner(string name, string firstName, BankAccount bankAccount, Contact contact, Adress adress, DataClasses1DataContext dbContext) { if (string.IsNullOrEmpty(name)) { ////throw new Exception("Der Name des Halters darf nicht leer sein."); } CarOwner owner = new CarOwner() { Name = name, FirstName = firstName, BankAccount = bankAccount, Contact = contact, Adress = adress }; dbContext.CarOwner.InsertOnSubmit(owner); dbContext.SubmitChanges(); dbContext.WriteLogItem("Halter " + name + " wurde angelegt.", LogTypes.INSERT, owner.Id, "CarOwner"); return owner; }
private void detach_CarOwner(CarOwner entity) { this.SendPropertyChanging(); entity.BankAccount = null; }
private void detach_CarOwner(CarOwner entity) { this.SendPropertyChanging(); entity.Adress = null; }
private void attach_CarOwner(CarOwner entity) { this.SendPropertyChanging(); entity.Adress = this; }
partial void DeleteCarOwner(CarOwner instance);
partial void UpdateCarOwner(CarOwner instance);
partial void InsertCarOwner(CarOwner instance);