Beispiel #1
0
        /// <summary>
        /// Erstelle einene neuen Kontakt 
        /// </summary>
        /// <param name="phone">Telefon</param>
        /// <param name="fax">Fax</param>
        /// <param name="mobilePhone">Mobil</param>
        /// <param name="email">Mail</param>
        /// <param name="dbContext">Datenbankkontext</param>
        /// <returns>Den neue erstellten Kontakt</returns>
        public static Contact CreateContact(string phone, string fax, string mobilePhone, string email, DataClasses1DataContext dbContext)
        {
            Contact contact = new Contact()
            {
                Phone = phone,
                Fax = fax,
                MobilePhone = mobilePhone,
                Email = email
            };

            dbContext.Contact.InsertOnSubmit(contact);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Kontakt angelegt.", LogTypes.INSERT, contact.Id, "Contact");
            return contact;
        }
Beispiel #2
0
        /// <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;
        }
Beispiel #3
0
        /// <summary>
        /// Erstellt einen neuen Kunden.
        /// </summary>
        /// <param name="name">Name des Kunden.</param>
        /// <param name="street">Straße.</param>
        /// <param name="streetnumber">Hausnummer.</param>
        /// <param name="zipcode">Postleitzahl.</param>
        /// <param name="city">Ort.</param>
        /// <param name="country">Land.</param>
        /// <param name="phone">Telefonnummer.</param>
        /// <param name="fax">Faxnummer.</param>
        /// <param name="mobilephone">Mobiltelefonnummer.</param>
        /// <param name="email">E-Mailadresse.</param>
        /// <param name="vat">Mehrwersteuersatz.</param>
        /// <param name="termOfCredit">Zahlungsziel (in Tagen).</param>
        /// <param name="customerNumber">Kundennummer.</param>
        /// <returns>Den Kunden.</returns>
        /// <remarks>Methode soll nur für interne Zwecke benutzt werden. Die public Create-Methoden befinden sich in den spezialisierten Kundenklassen.</remarks>
        internal static Customer CreateCustomer(string name, string street, string streetnumber, string zipcode, string city, string country, string phone, string fax, string mobilephone, string email, decimal vat, int? termOfCredit, string customerNumber, string Matchcode="", string Debitornumber="", string eVB_Number="")
        {
            if (string.IsNullOrEmpty(customerNumber))
            {
                throw new ArgumentNullException("Die Kundennummer darf nicht leer sein.");
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("Der Kundenname darf nicht leer sein.");
            }

            var adress = new Adress()
            {
                Street = street,
                StreetNumber = streetnumber,
                City = city,
                Country = country,
                Zipcode = zipcode
            };

            var contact = new Contact()
            {
                Phone = phone,
                Fax = fax,
                MobilePhone = mobilephone,
                Email = email
            };

            var customer = new Customer()
            {
                Name = name,
                Adress = adress,
                Contact = contact,
                VAT = vat,
                InvoiceAdress = adress,
                InvoiceDispatchAdress = adress,
                TermOfCredit = termOfCredit,
                CustomerNumber = customerNumber,
                MatchCode = Matchcode,
                Debitornumber = Debitornumber,
                eVB_Number = eVB_Number
            };

            return customer;
        }
Beispiel #4
0
        /// <summary>
        /// Weist dem Benutzer die übergebenen Kontaktinformationen zu.
        /// </summary>
        /// <param name="contact">Kontakt, der dem Benutzer zugewiesen werden soll.</param>
        /// <param name="dbContext">Datenbankkontext.</param>
        public void AddContact(Contact contact, DataClasses1DataContext dbContext)
        {
            if (this.Contact != null)
            {
                throw new Exception("Der Benutzer besitzt bereits Kontaktinformationen.");
            }

            dbContext.WriteLogItem("Kontaktinformationen zu Benutzer " + this.Login + " hinzugefügt.", LogTypes.INSERT, this.Id, "User", contact.Id);
            this.Contact = contact;
        }
 partial void DeleteContact(Contact instance);
 partial void UpdateContact(Contact instance);
 partial void InsertContact(Contact instance);