public static void SaveCustomerAndBooking(SyncBookingInquiry inquiry) { var booking = inquiry; QTouristik.Data.TravelApplicant travelApplicant = booking.BookingData.TravelApplicant; string customeremail = travelApplicant.EMail; bool exists = CustomerExists(customeremail); if (!exists) { Customer customer = CreateCustomer(travelApplicant); manager.AddMasterData(customer); BookingProcess bp = CreateBookingProcess(booking, customer); manager.AddMasterData(customer); manager.AddMasterData(bp); } else { var customer = manager.GetCustomerByEmail(customeremail); BookingProcess bp = CreateBookingProcess(booking, customer); manager.AddMasterData(bp); } }
private static Customer CreateCustomer(QTouristik.Data.TravelApplicant travelApplicant) { Customer customer = new Customer(); customer.Adress = travelApplicant.Adress; customer.Contry = travelApplicant.Contry; customer.EMail = travelApplicant.EMail; customer.FirstName = travelApplicant.FirstName; customer.LastName = travelApplicant.LastName; customer.MobilePhone = travelApplicant.MobilePhone; customer.Phone = travelApplicant.Phone; customer.Place = travelApplicant.Place; customer.Salutation = travelApplicant.Salutation; customer.ZipCode = travelApplicant.ZipCode; int customernr = GetMaxCustomerNr(); List <int> list = new List <int>(); list.Add(customernr); customer.CustomerNr = customernr; customer.BookKeepingNumber = list; return(customer); }