Пример #1
0
        /// <summary>
        /// Erstellt einen Laufkunden.
        /// </summary>
        /// <param name="name">Name des Kunden.</param>
        /// <param name="firstName">Vorname des Kunden.</param>
        /// <param name="title">Anrede.</param>
        /// <param name="gender">Geschlecht.</param>
        /// <param name="street">Straße.</param>
        /// <param name="streetnumber">Hausnummer.</param>
        /// <param name="zipcode">Postleitzahl.</param>
        /// <param name="city">Straße.</param>
        /// <param name="country">Land.</param>
        /// <param name="phone">Telefonnummer.</param>
        /// <param name="fax">Faxnummer.</param>
        /// <param name="mobilephone">Mobiltelefonnummer.</param>
        /// <param name="email">Emailaddresse.</param>
        /// <param name="vat">Mehrwersteuersatz für den Kunden.</param>
        /// <param name="termOfCredit">Zahlungsziel (in Tagen).</param>
        /// <param name="customerNumber">Kundennummer.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Den neuen Laufkunden.</returns>
        public static SmallCustomer CreateSmallCustomer(string name, string firstName, string title, string gender, string street, string streetnumber, string zipcode, string city, 
            string country, string phone, string fax, string mobilephone, string email, decimal vat, int? termOfCredit, string customerNumber, DataClasses1DataContext dbContext)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("Der Name darf nicht leer sein.");
            }

            var customer = Customer.CreateCustomer(name, street, streetnumber, zipcode, city, country, phone, fax, mobilephone, email, vat, termOfCredit, customerNumber);
            customer._dbContext = dbContext;
            var person = new Person()
            {
                FirstName = firstName,
                Name = name,
                Gender = gender,
                Title = title
            };

            var smallCustomer = new SmallCustomer()
            {
                Customer = customer,
                Person = person
            };

            dbContext.SmallCustomer.InsertOnSubmit(smallCustomer);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Kunde " + firstName + " " + name + " wurde angelegt.", LogTypes.INSERT, customer.Id, "SmallCustomer");

            return smallCustomer;
        }
Пример #2
0
        /// <summary>
        /// Erstellt einen neunen Person Datensatz
        /// </summary>
        /// <param name="dbContext">DB Kontext</param>
        /// <param name="firstname">Vorname</param>
        /// <param name="name">Name</param>
        /// <param name="title">Titel</param>
        /// <param name="extension">Zusatz</param>
        /// <returns>Person</returns>
        public static Person CreatePerson(DataClasses1DataContext dbContext, string firstname, string name, string title, string extension)
        {
            var person = new Person()
            {
                FirstName = firstname,
                Name = name,
                Gender = null,
                Title = title,
                Extension = extension,

            };

            dbContext.Person.InsertOnSubmit(person);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Kontaktperson " + firstname + " " + name + " wurde angelegt.", LogTypes.INSERT, person.Id, "LargeCustomer");

            return person;
        }
Пример #3
0
 partial void UpdatePerson(Person instance);
Пример #4
0
 partial void DeletePerson(Person instance);
Пример #5
0
 partial void InsertPerson(Person instance);