Ejemplo n.º 1
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            var ctx = PublicBoardCtx.Get();

            foreach (var p in persons)
            {
                bool   prevExists;
                Person prev = DaoUtils.PersonSingleton(p, out prevExists);
                if (!prevExists)
                {
                    try
                    {
                        ctx.AddToPerson(prev);
                    }
                    catch (Exception)
                    {
                        //persons in modified are ignored
                    }
                }
            }

            ctx.SaveChanges();

            if (changesExist)
            {
                _sharedClient.clienRt.SendUserAccPlusMinus();
            }

            Close();
        }
Ejemplo n.º 2
0
        private void SaveParticipants(Topic t = null)
        {
            if (t == null)
            {
                t = EditedTopic;
            }
            if (t == null || EditedDiscussion == null)
            {
                return;
            }

            foreach (Topic top in EditedDiscussion.Topic)
            {
                top.Person.Clear();

                foreach (var p in tmpPersons)
                {
                    if (p.Name == "Name")
                    {
                        continue;
                    }

                    bool   prevExists;
                    Person prev = DaoUtils.PersonSingleton(p, out prevExists);

                    if (!top.Person.Contains(prev))
                    {
                        top.Person.Add(prev);
                    }
                }
            }

            PublicBoardCtx.Get().SaveChanges();
        }