partial void DeletePersonOrganizationRelation(PersonOrganizationRelation instance);
 partial void UpdatePersonOrganizationRelation(PersonOrganizationRelation instance);
 partial void InsertPersonOrganizationRelation(PersonOrganizationRelation instance);
		private void detach_person_organizations(PersonOrganizationRelation entity)
		{
			this.SendPropertyChanging();
			entity.Person = null;
		}
		private void attach_person_organizations(PersonOrganizationRelation entity)
		{
			this.SendPropertyChanging();
			entity.Organization = this;
		}
Пример #6
0
        private void UpdatePersonOrganizationRelation(PersonList person)
        {
            if (person.OrganizationID.Value == Guid.Empty) return;

            PersonOrganizationRelations.DeleteAllOnSubmit(PersonOrganizationRelations.Where(
                    directorRelation =>
                    directorRelation.OrganizationID == person.OrganizationID && directorRelation.Post.ToLower().Equals("генеральный директор")));

            PersonOrganizationRelations.DeleteAllOnSubmit(
                PersonOrganizationRelations.Where(atherPosts => atherPosts.PersonID == person.PersonID));

            SubmitChanges();

            var por = new PersonOrganizationRelation
                          {
                              OrganizationID = person.OrganizationID.Value,
                              PersonID = person.PersonID,
                              Post = person.Post
                          };

            PersonOrganizationRelations.InsertOnSubmit(por);

            SubmitChanges();
        }