public WindowAddTo(Canvas parent, bool revert, AddTo addTo)
        {
            IsClosed = false;
            bool ifAdd = false;

            parentCanvas = parent;
            windowAddTo  = addTo;

            if (parent.Tag is int)
            {
                idMembership = Convert.ToInt32(parent.Tag);
            }
            if (idMembership == 0)
            {
                idApplication = parent.Name.Replace("ID_", "");
            }

            timerAnimation          = new DispatcherTimer();
            timerAnimation.Interval = new TimeSpan(0, 0, 0, 0, 10);
            repeatIntervals         = 0;

            if (windowAddTo == AddTo.Activity && idMembership == 0)
            {
                if (ActiveApplication_db.AddActivityToApplication(idApplication, "1"))
                {
                    ifAdd = true;
                }
            }
            if (addTo == AddTo.Group)
            {
                if (ActiveApplication_db.AddGroupToApplication(idApplication, "NULL"))
                {
                    ifAdd = true;
                }
            }
            if (windowAddTo == AddTo.Activity && idMembership > 0)
            {
                if (ActiveApplication_db.AddActivityToApplicationGroup(idMembership, "1"))
                {
                    ifAdd = true;
                }
            }

            if (ifAdd)
            {
                ((Label)(parentCanvas.Children[7])).Content = "+";
                Canvas.SetTop((Label)(parentCanvas.Children[7]), 28);
                timerAnimation.Tick += new EventHandler(AnimationButtonRestart);
                timerAnimation.Start();
            }
        }
 private bool ActionOnBase(string idActivity)
 {
     if (windowAddTo == AddTo.Activity && idMembership == 0)
     {
         return(ActiveApplication_db.AddActivityToApplication(idApplication, idActivity));
     }
     else if (windowAddTo == AddTo.Group)
     {
         return(ActiveApplication_db.AddGroupToApplication(idApplication, idActivity));
     }
     if (windowAddTo == AddTo.Activity && idMembership > 0)
     {
         return(ActiveApplication_db.AddActivityToApplicationGroup(idMembership, idActivity));
     }
     else
     {
         return(false);
     }
 }