Exemplo n.º 1
0
        public async Task <PersonPhone> Update(PersonPhone personPhone)
        {
            _context.PersonPhone.Update(personPhone);
            await _context.SaveChangesAsync();

            return(personPhone);
        }
Exemplo n.º 2
0
 public async Task <PersonPhone> FindAsync(string key) => await Task.Run(() =>
 {
     PersonPhone personPhone = JsonConvert.DeserializeObject <PersonPhone>(key);
     return(_context.PersonPhone.Include(p => p.Person).Include(p => p.PhoneNumberType).Where(o => o.BusinessEntityID == personPhone.BusinessEntityID &&
                                                                                              o.PhoneNumber == personPhone.PhoneNumber &&
                                                                                              o.PhoneNumberTypeID == personPhone.PhoneNumberTypeID).FirstOrDefault());
 });
Exemplo n.º 3
0
        public async Task <Customer> GetByIdAsync(int id)
        {
            // get phone by phone number
            PersonPhone phoneNumber = await phoneNumberRetrieval.GetByIdAsync(id);

            // get person by id
            Person person = await personRetrieval.GetByIdAsync(phoneNumber.BusinessEntityId);

            // get employee by id
            Employee employee = await employeeRetrieval.GetByIdAsync(phoneNumber.BusinessEntityId);

            // get email address by id
            EmailAddress emailAddress = await emailAddressRetrieval.GetByIdAsync(phoneNumber.BusinessEntityId);

            // get address by id
            Address address = await addressRetrieval.GetByIdAsync(phoneNumber.BusinessEntityId);

            // form new customer object
            Customer customer = new Customer()
            {
                BusinessEntityId   = employee.BusinessEntityId,
                FirstName          = person.FirstName,
                MiddleName         = person.MiddleName,
                LastName           = person.LastName,
                EmailAddressString = emailAddress.EmailAddress1,
                PhoneNumber        = phoneNumber.PhoneNumber,
                Address            = address.AddressLine1 + address.AddressLine2,
                City       = address.City,
                PostalCode = address.PostalCode
            };

            return(customer);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(long id, [Bind("PersonPhoneId,PersonId,PhoneNumber")] PersonPhone personPhone)
        {
            if (id != personPhone.PersonPhoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personPhone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonPhoneExists(personPhone.PersonPhoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", "Clients", new { id = personPhone.PersonId }, null));
            }
            ViewData["PersonId"] = new SelectList(_context.Persons, "PersonId", "FirstName", personPhone.PersonId);
            return(View(personPhone));
        }
Exemplo n.º 5
0
 public int CreatePersonPhone(PersonPhone phone)
 {
     using (var db = new LogistoDb())
     {
         return(Convert.ToInt32(db.InsertWithIdentity(phone)));
     }
 }
Exemplo n.º 6
0
        public static PersonPhone Translate(DataRow row)
        {
            var phone = new PersonPhone();

            try
            {
                var communicationType = row.Field <string>("communication_type");

                if (communicationType != "Mobile" && !communicationType.Contains("Phone") && !communicationType.Contains("phone"))
                {
                    return(null);
                }

                var householdId       = row.Field <int>("household_id");
                var companyAsPersonId = F1Company.GetCompanyAsPersonId(householdId);
                var phoneType         = communicationType.Replace("Phone", string.Empty).Replace("phone", string.Empty).Trim();
                var phoneNumber       = new string( row.Field <string>("communication_value").Where(c => char.IsDigit(c)).ToArray());

                if (!string.IsNullOrWhiteSpace(phoneNumber))
                {
                    phone.PersonId    = companyAsPersonId;
                    phone.PhoneType   = phoneType;
                    phone.PhoneNumber = phoneNumber;
                    return(phone);
                }
            }
            catch
            {
                return(null);
            }

            return(null);
        }
        public IHttpActionResult PutPersonPhone(int id, PersonPhone personPhone)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != personPhone.Id)
            {
                return(BadRequest());
            }

            db.Entry(personPhone).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonPhoneExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Read(int page = 1)
        {
            int pageSize = 20;

            List <Employee>       employees_ = null;
            List <Person>         people     = null;
            List <EmailAddress>   email      = null;
            List <PersonPhone>    phones     = null;
            List <PersonEmployee> employees  = new List <PersonEmployee>();

            using (BussinessTransaction bt = new BussinessTransaction(_unitOfWork))
            {
                bt.Execute(() =>
                {
                    employees_ = _dbEmp.Read().ToList();
                    people     = _dbPer.Read().ToList();
                    phones     = _dbPhn.Read().ToList();
                    email      = _dbEml.Read().ToList();
                });
            }

            for (int i = 0; i < employees_.Count(); i++)
            {
                PersonEmployee y = new PersonEmployee();
                y.BusinessEntityID = employees_[i].BusinessEntityId;
                y.BirthDate        = employees_[i].BirthDate.ToShortDateString();
                y.NationalIDNumber = employees_[i].NationalIdnumber;
                y.JobTitle         = employees_[i].JobTitle;
                Person a = new Person();
                a           = people.Find(x => x.BusinessEntityId.Equals(y.BusinessEntityID));
                y.LastName  = a.LastName;
                y.FirstName = a.FirstName;
                EmailAddress b = new EmailAddress();
                b = email.Find(x => x.BusinessEntityId.Equals(y.BusinessEntityID));
                y.EmailAddress = b.EmailAddress1;
                PersonPhone c = new PersonPhone();
                c             = new PersonPhone();
                c             = phones.Find(x => x.BusinessEntityId.Equals(y.BusinessEntityID));
                y.PhoneNumber = c.PhoneNumber;
                employees.Add(y);
            }

            //return View(employees);
            //IEnumerable<PersonEmployee> perEmpsPerPages = employees.Skip((page - 1) * pageSize).Take(pageSize);
            //PageInfo pageInfo = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = employees.Count };
            //IndexViewModel ivm = new IndexViewModel { PageInfo = pageInfo, perEmps = perEmpsPerPages };
            //return View(ivm);

            var count = employees.Count();
            var items = employees.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            PersonEmployeeViewModel      empViewModel = new PersonEmployeeViewModel(count, page, pageSize);
            IndexPersonEmployeeViewModel viewModel    = new IndexPersonEmployeeViewModel
            {
                PersonEmployeeViewModel = empViewModel,
                PersonEmployees         = items
            };

            return(View(viewModel));
        }
Exemplo n.º 9
0
        public async Task <PersonPhoneResponse> AddPersonPhone(PersonPhoneDto personPhone)
        {
            var person = await _personService.Find(personPhone.PersonId);

            var newPersonPhone = new PersonPhone
            {
                PhoneNumber     = personPhone.PhoneNumber,
                PhoneNumberType = await _phoneNumberTypeService.Find(x => x.Name == personPhone.PhoneNumberType),
                Person          = person
            };

            await _personPhoneService.Add(newPersonPhone);


            var response = new PersonPhoneResponse
            {
                PersonPhoneObject = new PersonPhoneDto
                {
                    BusinessEntityID = newPersonPhone.BusinessEntityID,
                    PersonId         = newPersonPhone.Person.BusinessEntityID,
                    PhoneNumber      = newPersonPhone.PhoneNumber,
                    PhoneNumberType  = newPersonPhone.PhoneNumberType.Name
                }
            };

            return(response);
        }
Exemplo n.º 10
0
        // POST: odata/PersonPhones
        public IHttpActionResult Post(PersonPhone personPhone)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _db.PersonPhones.Add(personPhone);

            try
            {
                _db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (PersonPhoneExists(personPhone.BusinessEntityID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created(personPhone));
        }
Exemplo n.º 11
0
        public override Person PopulateRecord(SqlDataReader reader)
        {
            EmailAddress emailAddress = new EmailAddress
            {
                EmailAddress1 = (string)reader["EmailAddress"]
            };

            PersonPhone phone = new PersonPhone
            {
                PhoneNumber = (string)reader["PhoneNumber"],
            };

            return(new Person
            {
                BusinessEntityID = Convert.ToInt32((int)reader["BusinessEntityID"]),
                FirstName = reader["FirstName"].ToString(),
                MiddleName = reader["MiddleName"].ToString(),
                LastName = reader["LastName"].ToString(),
                Suffix = reader["Suffix"].ToString(),
                PersonType = reader["PersonType"].ToString(),
                NameStyle = (bool)reader["NameStyle"],
                Title = reader["Title"].ToString(),
                EmailPromotion = Convert.ToInt32((int)reader["EmailPromotion"]),
                ModifiedDate = (DateTime)reader["ModifiedDate"],
                rowguid = (Guid)reader["rowguid"],
                EmailAddress = emailAddress,
                PersonPhone = phone
            });
        }
Exemplo n.º 12
0
        public static PersonPhone Translate(DataRow row)
        {
            var phone = new PersonPhone();

            phone.PersonId = row.Field <int>("IndividualId");

            phone.PhoneNumber = row.Field <string>("Phone");
            phone.IsUnlisted  = row.Field <bool?>("Unlisted").Value;

            var phoneType = row.Field <string>("Description");

            switch (phoneType)
            {
            case "Cell":
                phone.PhoneType = "Mobile";
                break;

            case "Home":
                phone.PhoneType = "Home";
                break;

            case "Business":
                phone.PhoneType = "Work";
                break;

            default:
                phone.PhoneType = phoneType;
                break;
            }

            return(phone);
        }
Exemplo n.º 13
0
        public async Task ProccesOrderAuthenticatedAsync(IEnumerable <CartLineDTO> cart, ShippingDetailsDTO shippingDetails, string userId)
        {
            var person = unitOfWork.Person.GetList(i => i.UserID == userId).FirstOrDefault();

            var busEntity = unitOfWork.BusinessEntity.Get(person.BusinessEntityID);

            var personPhone = new PersonPhone()
            {
                PhoneNumber       = shippingDetails.MobilePhone,
                PhoneNumberTypeID = 1,
                ModifiedDate      = DateTime.Now
            };

            var emailAddress = new EmailAddress()
            {
                EmailAddress1 = shippingDetails.Email,
                rowguid       = Guid.NewGuid(),
                ModifiedDate  = DateTime.Now
            };

            person.EmailAddresses.Add(emailAddress);
            person.PersonPhones.Add(personPhone);

            var orderHeader = ProcessOrderHeader(cart, shippingDetails);

            busEntity.PurchaseOrderHeaders.Add(orderHeader);
            unitOfWork.Save();

            await emailService.SendEmailAsync(orderHeader.PurchaseOrderID);
        }
Exemplo n.º 14
0
        public async Task <PersonPhone> PutAsync(PersonPhone personPhone)
        {
            personPhone = await Task.Run(() => _context.PersonPhone.Update(personPhone).Entity);

            await _context.SaveChangesAsync();

            return(personPhone);
        }
        public void GetPhoneNumberByIDsTest()
        {
            var context     = new Entities();
            var personPhone = new PersonPhone(context);
            var phoneRecord = personPhone.GetPhoneNumberByIDs(10);

            Assert.AreEqual("330-555-2568", phoneRecord.PhoneNumber);
        }
        public async Task <IActionResult> CreateVendorContactPhone([FromBody] PersonPhone phone)
        {
            await _repository.Telephone.CreatePhone(phone);

            return(CreatedAtRoute(nameof(GetVendorContactPhone),
                                  new { entityID = phone.BusinessEntityID, phoneNumber = phone.PhoneNumber, phoneTypeID = phone.PhoneNumberTypeID }
                                  , phone));
        }
        public ActionResult Delete(string id)
        {
            string[]    ids            = id.Split('X');
            PersonPhone objPersonPhone = new PersonPhone();

            objPersonPhone = _personPhone.GetPersonPhoneById(Convert.ToInt32(ids[2]), ids[1], Convert.ToInt32(ids[0]));
            _personPhone.Delete(objPersonPhone);
            return(RedirectToAction("Index", new { id = Convert.ToInt32(ids[0]) }));
        }
Exemplo n.º 18
0
 public async Task <PersonPhone> PutAsync(string previosKeys, PersonPhone personPhone) => await Task.Run(() =>
 {
     PersonPhone previos = JsonConvert.DeserializeObject <PersonPhone>(previosKeys);
     var keyValues       = new object[] { previos.BusinessEntityID, previos.PhoneNumber, previos.PhoneNumberTypeID };
     var entity          = _context.PersonPhone.Find(keyValues);
     _context.Entry <PersonPhone>(entity).State = EntityState.Deleted;
     _context.PersonPhone.Add(personPhone);
     _context.SaveChanges();
     return(personPhone);
 });
Exemplo n.º 19
0
 public async Task DeleteAsync(PersonPhone personPhone) => await Task.Run(() =>
 {
     var keyValues = new object[] { personPhone.BusinessEntityID, personPhone.PhoneNumber, personPhone.PhoneNumberTypeID };
     var entity    = _context.PersonPhone.Find(keyValues);
     if (entity == null)
     {
         throw new Exception($"key not found: {personPhone.BusinessEntityID}-{personPhone.PhoneNumber}-{personPhone.PhoneNumberType}");
     }
     _context.PersonPhone.Remove(entity);
     _context.SaveChanges();
 });
Exemplo n.º 20
0
        public async Task <bool> RemovePersonPhone(PersonPhone personPhone)
        {
            var entity = _context.PersonPhone.Where(x => x.BusinessEntityID == personPhone.BusinessEntityID &&
                                                    x.PhoneNumber == personPhone.PhoneNumber &&
                                                    x.PhoneNumberTypeID == personPhone.PhoneNumberTypeID).FirstOrDefault();

            _context.PersonPhone.Attach(entity);
            _context.PersonPhone.Remove(entity);

            return(await _context.SaveChangesAsync() > 0);
        }
        public IHttpActionResult GetPersonPhone(int id)
        {
            PersonPhone personPhone = db.Phones.Find(id);

            if (personPhone == null)
            {
                return(NotFound());
            }

            return(Ok(personPhone));
        }
        public void Add()
        {
            PersonPhone personPhone = new PersonPhone()
            {
                CountryId = 1,
                Number    = "0557894561"
            };

            var result = _unitOfWork.Repository <PersonPhone>().Add(personPhone);

            Assert.IsTrue(result.IsSuccess);
        }
Exemplo n.º 23
0
        public async Task <IActionResult> Create([Bind("PersonPhoneId,PersonId,PhoneNumber")] PersonPhone personPhone)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personPhone);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Clients", new { id = personPhone.PersonId }, null));
            }
            ViewData["PersonId"] = new SelectList(_context.Persons, "PersonId", "FirstName", personPhone.PersonId);
            return(View(personPhone));
        }
Exemplo n.º 24
0
        public bool Insert(PersonPhone personphone)
        {
            int            autonumber           = 0;
            PersonPhoneDAC personphoneComponent = new PersonPhoneDAC();
            bool           endedSuccessfuly     = personphoneComponent.InsertNewPersonPhone(ref autonumber, personphone.BusinessEntityId, personphone.PhoneNumber, personphone.PhoneNumberTypeId, DateTime.Now, personphone.PhoneVerified, personphone.PhoneVerificationCode);

            if (endedSuccessfuly)
            {
                personphone.Id = autonumber;
            }
            return(endedSuccessfuly);
        }
        // PUT api/awbuildversion/5
        public void Put(PersonPhone value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.PersonPhoneDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.PersonPhoneUpdate(value);
            }
        }
Exemplo n.º 26
0
 public ActionResult Edit([Bind(Include = "BusinessEntityID,PhoneNumber,PhoneNumberTypeID,ModifiedDate,isDeleted")] PersonPhone personPhone)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personPhone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BusinessEntityID  = new SelectList(db.People, "BusinessEntityID", "PersonType", personPhone.BusinessEntityID);
     ViewBag.PhoneNumberTypeID = new SelectList(db.PhoneNumberTypes, "PhoneNumberTypeID", "Name", personPhone.PhoneNumberTypeID);
     return(View(personPhone));
 }
Exemplo n.º 27
0
        private void SetInfo()
        {
            ddlState.SelectedIndex = -1;

            // Load Person Values
            tbFirstName.Text = person.FirstName;
            tbLastName.Text  = person.LastName;

            PersonPhone phone = person.Phones.FindByType(SystemLookup.PhoneType_Home);

            if (phone != null)
            {
                tbHomePhone.Text = phone.Number;
            }
            phone = person.Phones.FindByType(SystemLookup.PhoneType_Cell);
            if (phone != null)
            {
                tbCellPhone.Text  = phone.Number;
                cbCellSMS.Checked = phone.SMSEnabled;
            }

            tbEmail.Text = person.Emails.FirstActive;

            // Load Spouse Values
            tbSpouseFirstName.Text = spouse.FirstName;
            tbSpouseLastName.Text  = spouse.LastName;

            phone = spouse.Phones.FindByType(SystemLookup.PhoneType_Home);
            if (phone != null)
            {
                tbSpouseHomePhone.Text = phone.Number;
            }
            phone = spouse.Phones.FindByType(SystemLookup.PhoneType_Cell);
            if (phone != null)
            {
                tbSpouseCellPhone.Text = phone.Number;
                cbSpouseSMS.Checked    = phone.SMSEnabled;
            }

            tbSpouseEmail.Text = spouse.Emails.FirstActive;

            if (person.PrimaryAddress != null && person.PrimaryAddress.AddressID != -1)
            {
                tbStreetAddress.Text = person.PrimaryAddress.StreetLine1;
                tbCity.Text          = person.PrimaryAddress.City;
                ListItem li = ddlState.Items.FindByValue(person.PrimaryAddress.State);
                if (li != null)
                {
                    li.Selected = true;
                }
                tbZipCode.Text = person.PrimaryAddress.PostalCode;
            }
        }
Exemplo n.º 28
0
        private static PersonPhone PersonPhone(Person person, Guid phoneType)
        {
            PersonPhone personPhone = person.Phones.FindByType(phoneType);

            if (personPhone == null)
            {
                personPhone           = new PersonPhone();
                personPhone.PhoneType = new Lookup(phoneType);
                person.Phones.Add(personPhone);
            }
            return(personPhone);
        }
Exemplo n.º 29
0
        public virtual PersonPhone MapBOToEF(
            BOPersonPhone bo)
        {
            PersonPhone efPersonPhone = new PersonPhone();

            efPersonPhone.SetProperties(
                bo.BusinessEntityID,
                bo.ModifiedDate,
                bo.PhoneNumber,
                bo.PhoneNumberTypeID);
            return(efPersonPhone);
        }
Exemplo n.º 30
0
        public virtual BOPersonPhone MapEFToBO(
            PersonPhone ef)
        {
            var bo = new BOPersonPhone();

            bo.SetProperties(
                ef.BusinessEntityID,
                ef.ModifiedDate,
                ef.PhoneNumber,
                ef.PhoneNumberTypeID);
            return(bo);
        }
        public IHttpActionResult PostPersonPhone(PersonPhone personPhone)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Phones.Add(personPhone);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = personPhone.Id }, personPhone));
        }
        public void AddPhoneNumber(BusinessObjects.PersonPhone phoneNumber)
        {
            // Create new entity to add
            var newNumber = new PersonPhone();

            // Map the BO data onto this new entity
            phoneNumber.MapOntoEntity(newNumber);

            // Add this entity to the context
            Db.PersonPhones.Add(newNumber);

            // Save the changes
            Db.SaveChanges();
        }
 // POST api/awbuildversion
 public void Post(PersonPhone value)
 {
     adventureWorks_BC.PersonPhoneAdd(value);
 }
 public static void MapOntoEntity(this BusinessObjects.PersonPhone source, PersonPhone target)
 {
     target.BusinessEntityID = source.BusinessEntityId;
     target.PhoneNumber = source.PhoneNumber;
     target.PhoneNumberTypeID = (int)source.PhoneNumberType;
 }
        protected int GetPersonIdFromInputData()
        {
            string sFirstName = tbFirstName.Text;
            string sLastName = tbLastName.Text;
            string sEmail = tbEmail.Text;
            string sAddress = tbAddress1.Text;
            string sCity = tbCity.Text;
            string sState = tbState.Text;
            string sZip = tbZip.Text;
            string sPhone = tbPhone.Text;

            PersonCollection personCollection = new PersonCollection();
            personCollection.LoadByEmail(sEmail);

            int iFoundPersonId = -1;
            foreach (Person person in personCollection)
            {
                PersonPhone phoneSearch = new PersonPhone(person.PersonID, FormatPhone(sPhone));

                if ((phoneSearch.PersonID == person.PersonID) && (person.LastName.ToLower() == sLastName.ToLower()))
                {
                    this.currentAddress = person.Addresses.FindByType(41);
                    if(this.currentAddress.Address.PostalCode.Substring(0,5) == sZip )
                    {
                        iFoundPersonId = person.PersonID;
                    }
                }
            }

            if (iFoundPersonId > 0)
            {
                //person in the db
                //easy ride...
            }
            else
            {
                //create the family for the person
                Family family = new Family();
                family.OrganizationID = CurrentArenaContext.Organization.OrganizationID;
                family.FamilyName = sLastName + " Family";

                //add person to the family
                FamilyMember familyMember = new FamilyMember();
                family.FamilyMembers.Add(familyMember);

                //
                // Ensure some of the basics are set correctly.
                //
                if ((familyMember.Campus == null || familyMember.Campus.CampusId == -1) && NewPersonCampusSetting != -1)
                    familyMember.Campus = new Campus(NewPersonCampusSetting);
                if (familyMember.MemberStatus == null || familyMember.MemberStatus.LookupID == -1)
                    familyMember.MemberStatus = new Lookup(NewPersonStatusSetting);
                if (familyMember.RecordStatus == Arena.Enums.RecordStatus.Undefined)
                    familyMember.RecordStatus = Arena.Enums.RecordStatus.Pending;

                //add person to the db
                familyMember.FirstName = sFirstName;
                familyMember.FirstName = sFirstName;
                familyMember.LastName = sLastName;
                familyMember.FamilyRole = new Lookup(new Guid("e410e1a6-8715-4bfb-bf03-1cd18051f815"));
                familyMember.Gender = Arena.Enums.Gender.Unknown;
                familyMember.MaritalStatus = new Lookup(new Guid("9C000CF2-677B-4725-981E-BD555FDAFB30"));

                //add email to db and person to email
                PersonEmail personEmail = new PersonEmail();
                personEmail.Email = sEmail;
                personEmail.Active = true;
                familyMember.Emails.Add(personEmail);

                //add address to db and person to address
                PersonAddress personAddress = new PersonAddress();
                personAddress.Address.StreetLine1 = sAddress;
                personAddress.Address.City = sCity;
                personAddress.Address.State = sState;
                personAddress.Address.PostalCode = sZip;
                personAddress.AddressType = new Lookup(41);
                personAddress.Address.Standardize();
                this.currentAddress = personAddress;
                familyMember.Addresses.Add(personAddress);

                //add phone to db and person to phone
                PersonPhone personPhone = new PersonPhone();
                personPhone.PhoneType = new Lookup(new Guid("f2a0fba2-d5ab-421f-a5ab-0c67db6fd72e"));
                familyMember.Phones.Add(personPhone);
                personPhone.Number = FormatPhone(sPhone);

                //Save All
                family.Save(ModuleUserName);
                familyMember.Save(CurrentOrganization.OrganizationID, ModuleUserName, true);
                familyMember.SaveEmails(CurrentPortal.OrganizationID, ModuleUserName);
                familyMember.SaveAddresses(CurrentPortal.OrganizationID, ModuleUserName);
                familyMember.SavePhones(CurrentPortal.OrganizationID, ModuleUserName);
                familyMember.Save(CurrentUser.Identity.Name);

                iFoundPersonId = familyMember.PersonID;
            }

            return iFoundPersonId;
        }