public PersonExistanceCheckNededEventArgs(Person person)
 {
     Person = person;
 }
		private void attach_persons(Person entity)
		{
			this.SendPropertyChanging();
			entity.Img = this;
		}
		private void detach_persons(Person entity)
		{
			this.SendPropertyChanging();
			entity.Img = null;
		}
 partial void DeletePerson(Person instance);
 partial void UpdatePerson(Person instance);
 partial void InsertPerson(Person instance);
 private void UpdatePersonPhoto(Person person, byte[] image)
 {
     if (!person.ImageID.HasValue)
     {
         if (image != null)
         {
             var imgID = Guid.NewGuid();
             person.ImageID = imgID;
             UpdateImage(imgID, image, "Photo");
         }
     }
     else
     {
         if (image != null)
         {
             UpdateImage(person.ImageID.Value, image, "Photo");
         }
         else
         {
             DeleteImage(person.ImageID.Value);
         }
     }
 }
        public void UpdateOrInsertPerson(PersonList person)
        {
            if (person == null) return;

            var curPerson = Persons.Where(p => p.PersonID == person.PersonID).SingleOrDefault();

            if (curPerson == null)
            {
                curPerson = new Person {PersonID = person.PersonID};

                Persons.InsertOnSubmit(curPerson);
            }

            curPerson.PersonID = person.PersonID;
            curPerson.Description = person.Description;
            curPerson.Email = person.Email;
            curPerson.FirstName = person.FirstName;
            curPerson.LastName = person.LastName;
            curPerson.Surname = person.Surname;
            curPerson.Sex = person.Sex;
            curPerson.Icq = person.Icq;
            curPerson.Phone = person.Phone;
            curPerson.Mobile = person.Mobile;

            SubmitChanges();

            UpdatePersonOrganizationRelation(person);

            UpdatePersonPhoto(curPerson, person.Image);
        }