using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.Generic;

namespace RadDataFormAndRadGridViewIntegration
{
	public class Person : INotifyPropertyChanged, IEditableObject
	{
		private string firstName;
		public string FirstName
		{
			get
			{
				return firstName; 
			}
			set 
			{
				if (firstName != value)
				{
					firstName = value;
					this.OnPropertyChanged("FirstName");
				}
			}
		}

		private string lastName;
		public string LastName
		{
			get
			{
				return lastName;
			}
			set
			{
				if (lastName != value)
				{
					lastName = value;
					this.OnPropertyChanged("LastName");
				}
			}
		}

		public event PropertyChangedEventHandler PropertyChanged;
		private void OnPropertyChanged(string propertyName)
		{
			if (this.PropertyChanged != null)
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}

		private string oldFirstName;
		private string oldLastName;
		public void BeginEdit()
		{
			this.oldFirstName = this.FirstName;
			this.oldLastName = this.LastName;
		}

		public void CancelEdit()
		{
			this.FirstName = this.oldFirstName;
			this.LastName = this.oldLastName;
		}

		public void EndEdit()
		{
		}

		public static List<Person> GetSampleListOfPersons()
		{
			List<Person> persons = new List<Person>();

			persons.Add(new Person() { FirstName = "John", LastName = "Smith" });
			persons.Add(new Person() { FirstName = "Nancy", LastName = "Davolio" });
			persons.Add(new Person() { FirstName = "Peter", LastName = "Johanson" });

			return persons;
		}

	}
}
