Example #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (this.txtFirstName.Text.Length == 0 || this.txtLastname.Text.Length == 0)
              {
            MessageBox.Show("Please fill in all required fields", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            return;
              }

              Person newperson = new Person()
            {
              LastName = this.txtLastname.Text,
              FirstName = this.txtFirstName.Text,
              EnrollmentDate = this.datEnrollement.SelectedDate,
              HireDate = this.datHiredate.SelectedDate
            };

              Logic.SavePerson(newperson);
              isSaved = true;
              this.Close();
        }
Example #2
0
 /// <summary>
 /// Create a new Person object.
 /// </summary>
 /// <param name="personID">Initial value of the PersonID property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 public static Person CreatePerson(global::System.Int32 personID, global::System.String lastName, global::System.String firstName)
 {
     Person person = new Person();
     person.PersonID = personID;
     person.LastName = lastName;
     person.FirstName = firstName;
     return person;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Person EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPerson(Person person)
 {
     base.AddObject("Person", person);
 }
Example #4
0
 /// <summary>
 /// Saves the person.
 /// </summary>
 /// <param name="person">The person.</param>
 public static void SavePerson(Person person)
 {
     db.Person.AddObject(person);
       db.SaveChanges();
 }