private void SaveCustomerToDb(PetfirstCustomer mCustomer, wsQCustomer dbCustomer, bool bAdd)
 {
     dbCustomer.BillCity = mCustomer.BillingInfo.City;
     dbCustomer.BillFirstName = mCustomer.BillingInfo.FirstName;
     dbCustomer.BillLastName = mCustomer.BillingInfo.LastName;
     dbCustomer.BillState = mCustomer.BillingInfo.State;
     dbCustomer.BillStateId = mCustomer.BillingInfo.StateId;
     dbCustomer.BillStreetAddress = mCustomer.BillingInfo.Address1;
     dbCustomer.BillStreetAddress2 = mCustomer.BillingInfo.Address2;
     dbCustomer.BillZipcode = mCustomer.BillingInfo.Zip;
     dbCustomer.City = mCustomer.MembershipInfo.City;
     dbCustomer.FirstName = mCustomer.MembershipInfo.FirstName;
     dbCustomer.LastName = mCustomer.MembershipInfo.LastName;
     dbCustomer.State = mCustomer.MembershipInfo.State;
     dbCustomer.StateId = mCustomer.MembershipInfo.StateId;
     dbCustomer.StreetAddress = mCustomer.MembershipInfo.Address1;
     dbCustomer.StreetAddress2 = mCustomer.MembershipInfo.Address2;
     dbCustomer.Zipcode = mCustomer.MembershipInfo.Zip;
     dbCustomer.Email = mCustomer.MembershipInfo.Email;
     dbCustomer.EnrollmentCode = mCustomer.EnrollmentCode;
     dbCustomer.Phone = mCustomer.MembershipInfo.Phone;
     dbCustomer.PaymentFrequency = mCustomer.PayFrequency;
     if (!bAdd)
         dbCustomer.ModifyDate = DateTime.Now;
     else
         context.wsQCustomers.AddObject(dbCustomer);
     context.SaveChanges();
     if (mCustomer.CustomerId == 0)
         mCustomer.CustomerId = dbCustomer.QCustomerID;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the wsQCustomers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTowsQCustomers(wsQCustomer wsQCustomer)
 {
     base.AddObject("wsQCustomers", wsQCustomer);
 }
 public void SaveCustomer(PetfirstCustomer mCustomer)
 {
     wsQCustomer dbCustomer = null;
     bool bAdd = false;
     dbCustomer = GetCustomerByEmailZip(mCustomer.MembershipInfo.Email, mCustomer.MembershipInfo.Zip);//tries to get by email and zip
     if (dbCustomer == null)
     {
         if (mCustomer.CustomerId==0)
         {
             dbCustomer = new wsQCustomer();
             bAdd = true;
             dbCustomer.CreateDate = DateTime.Now;
         }
         else
             dbCustomer = GetCustomerById(mCustomer.CustomerId);
     }
     else
     {
         mCustomer.OldCustData = true;//customer saved in db
         mCustomer.CustomerId = dbCustomer.QCustomerID;
     }
     if (dbCustomer == null)
     {
         dbCustomer = new wsQCustomer();
         bAdd = true;
         dbCustomer.CreateDate = DateTime.Now;
         SaveCustomerToDb(mCustomer, dbCustomer, bAdd);
     }
     else {
         SaveCustomerToDb(mCustomer, dbCustomer, bAdd);
     }
 }
 /// <summary>
 /// Create a new wsQCustomer object.
 /// </summary>
 /// <param name="qCustomerID">Initial value of the QCustomerID property.</param>
 /// <param name="enrollmentCode">Initial value of the EnrollmentCode property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 public static wsQCustomer CreatewsQCustomer(global::System.Int32 qCustomerID, global::System.String enrollmentCode, global::System.String email, global::System.DateTime createDate)
 {
     wsQCustomer wsQCustomer = new wsQCustomer();
     wsQCustomer.QCustomerID = qCustomerID;
     wsQCustomer.EnrollmentCode = enrollmentCode;
     wsQCustomer.Email = email;
     wsQCustomer.CreateDate = createDate;
     return wsQCustomer;
 }