Ejemplo n.º 1
0
        /// <summary>
        ///     Checks to see if the person object is already contained in the database.
        /// </summary>
        /// <param name="sender">The Person object of the class</param>
        /// <returns> True if the object exists in the database, false otherwise.</returns>
        public Boolean HasPerson(Person person)
        {
            using (TeamJDBEntities context = new TeamJDBEntities())
            {
                var peopleQuery = from people in context.People
                                  where people.FirstName == person.FirstName
                                  && people.MiddleName == person.MiddleName
                                  && people.LastName == person.LastName
                                  && people.Addr == person.Addr
                                  && people.City == person.City
                                  && people.State == person.State
                                  && people.Zip == person.Zip
                                  && people.Phone == person.Phone
                                  && people.Email == person.Email
                                  select people;

                if (peopleQuery.Count() == 0)
                    return false;
                else
                    return true;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Person object.
 /// </summary>
 /// <param name="personID">Initial value of the PersonID property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 public static Person CreatePerson(global::System.Guid personID, global::System.String firstName, global::System.String lastName)
 {
     Person person = new Person();
     person.PersonID = personID;
     person.FirstName = firstName;
     person.LastName = lastName;
     return person;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Sets the appropriate textbox fields with the information from the Person parameter.
        /// </summary>
        /// <param name="p">The Person object to load into the textbox fields</param>
        public void setPerson(Person p)
        {
            this.person = p;

            this.textBoxFirstName.Text = p.FirstName;
            this.textBoxMiddleName.Text = p.MiddleName;
            this.textBoxLastName.Text = p.LastName;

            this.textBoxEmail.Text = p.Email;
            this.textBoxPhone.Text = p.Phone;

            this.textBoxAddress.Text = p.Addr;
            this.textBoxCity.Text = p.City;
            this.textBoxState.Text = p.State;
            this.textBoxZip.Text = p.Zip;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the People EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPeople(Person person)
 {
     base.AddObject("People", person);
 }