Exemple #1
0
        public bool UpdatePersonContact(PersonContact contact)
        {
            bool isUpdated = false;

            try
            {
                using (EVO_PersonDBEntities context = new EVO_PersonDBEntities())
                {
                    PersonContact personContact = (from PC in context.PersonContacts
                                                   where PC.PersonID == contact.PersonID
                                                   select PC).FirstOrDefault();

                    if (personContact != null)
                    {
                        personContact.EmailAddress     = contact.EmailAddress;
                        personContact.PrimaryContactNo = contact.PrimaryContactNo;
                        context.SaveChanges();
                        isUpdated = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(isUpdated);
        }
Exemple #2
0
        public bool AddPersonContact(PersonContact contactDetails)
        {
            bool          isAdded       = false;
            PersonContact personContact = null;

            try
            {
                using (EVO_PersonDBEntities context = new EVO_PersonDBEntities())
                {
                    personContact = new PersonContact();

                    personContact.PersonID         = contactDetails.PersonID;
                    personContact.EmailAddress     = contactDetails.EmailAddress;
                    personContact.PrimaryContactNo = contactDetails.PrimaryContactNo;
                    personContact.CreatedBy        = 0;
                    personContact.ModifiedBy       = 0;
                    personContact.CreatedDate      = DateTime.UtcNow;
                    personContact.ModifiedDate     = DateTime.UtcNow;
                    context.PersonContacts.Add(personContact);
                    context.SaveChanges();
                    isAdded = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(isAdded);
        }
Exemple #3
0
        public bool UpdatePerson(PersonReport personDetails)
        {
            bool          isUpdated     = false;
            PersonContact personContact = null;

            try
            {
                using (EVO_PersonDBEntities context = new EVO_PersonDBEntities())
                {
                    Person person = (from P in context.Person
                                     where P.ID == personDetails.PersonID
                                     select P).FirstOrDefault();

                    if (person != null)
                    {
                        person.FirstName = personDetails.FirstName;
                        person.LastName  = personDetails.LastName;
                        person.Gender    = personDetails.Gender;
                        //  person.DateOfBirth = personDetails.DateOfBirth;
                        personDetails.IsActive = personDetails.IsActive;

                        context.SaveChanges();

                        personContact = new PersonContact();


                        personContact.PersonID         = person.ID;
                        personContact.EmailAddress     = personDetails.EmailAddress;
                        personContact.PrimaryContactNo = personDetails.PhoneNumber;

                        UpdatePersonContact(personContact);


                        isUpdated = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(isUpdated);
        }
Exemple #4
0
        public bool AddPerson(PersonReport personDetails)
        {
            bool          isAdded       = false;
            Person        person        = null;
            PersonContact personContact = null;

            try
            {
                using (EVO_PersonDBEntities context = new EVO_PersonDBEntities())
                {
                    person = new Person();

                    person.FirstName = personDetails.FirstName;
                    person.LastName  = personDetails.LastName;
                    person.Gender    = personDetails.Gender;
                    //       person.DateOfBirth = personDetails.DateOfBirth;
                    person.IsActive     = personDetails.IsActive;
                    person.CreatedBy    = 0;
                    person.ModifiedBy   = 0;
                    person.CreatedDate  = DateTime.UtcNow;
                    person.ModifiedDate = DateTime.UtcNow;

                    context.Person.Add(person);
                    context.SaveChanges();

                    personContact = new PersonContact();


                    personContact.PersonID         = person.ID;
                    personContact.EmailAddress     = personDetails.EmailAddress;
                    personContact.PrimaryContactNo = personDetails.PhoneNumber;
                    AddPersonContact(personContact);

                    isAdded = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(isAdded);
        }