Esempio n. 1
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();
        }
Esempio n. 2
0
        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);
        }
 public PersonUpdateEventArgs(PersonList person)
 {
     this.person = person;
 }
Esempio n. 4
0
 partial void UpdatePersonList(PersonList instance)
 {
     return;
 }
 partial void DeletePersonList(PersonList instance);
 partial void UpdatePersonList(PersonList instance);
 partial void InsertPersonList(PersonList instance);
        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();
        }
partial         void UpdatePersonList(PersonList instance)
        {
            return;
        }
Esempio n. 10
0
        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);
        }