示例#1
0
        public ContentResult TagAll(string tagname, bool?cleartagfirst, QueryModel m)
        {
            // take a query, add all people from the result of that query to the tag specified
            // empty the tag first if requested
            string resultMessage  = string.Empty;
            bool   shouldContinue = true;

            if (shouldContinue)
            {
                var workingTag     = CurrentDatabase.FetchOrCreateTag(Util2.GetValidTagName(tagname), Util.UserPeopleId, DbUtil.TagTypeId_Personal);
                var shouldEmptyTag = cleartagfirst ?? false;

                if (shouldEmptyTag)
                {
                    CurrentDatabase.ClearTag(workingTag);
                }

                m.TagAll(workingTag);

                Util2.CurrentTag = workingTag.Name;

                resultMessage  = "Manage";
                shouldContinue = false;
            }

            return(Content(resultMessage));
        }
示例#2
0
        public ContentResult TagAll(Guid id, string tagname, bool?cleartagfirst)
        {
            if (!tagname.HasValue())
            {
                return(Content("no tag name"));
            }

            CurrentDatabase.SetNoLock();
            var q = CurrentDatabase.PeopleQuery(id);

            if (Util2.CurrentTagName == tagname && !(cleartagfirst ?? false))
            {
                CurrentDatabase.TagAll(q);
                return(Content("Remove"));
            }
            var tag = CurrentDatabase.FetchOrCreateTag(tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal);

            if (cleartagfirst ?? false)
            {
                CurrentDatabase.ClearTag(tag);
            }

            CurrentDatabase.TagAll(q, tag);
            Util2.CurrentTag = tagname;
            CurrentDatabase.TagCurrent();
            return(Content("Manage"));
        }
示例#3
0
        public ActionResult Tag(int id, string tagname, bool?cleartagfirst)
        {
            if (Util2.CurrentTagName == tagname && !(cleartagfirst ?? false))
            {
                Person.Tag(CurrentDatabase, id, Util2.CurrentTagName, Util2.CurrentTagOwnerId, DbUtil.TagTypeId_Personal);
                CurrentDatabase.SubmitChanges();
                return(Content("OK"));
            }
            var tag = CurrentDatabase.FetchOrCreateTag(tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal);

            if (cleartagfirst ?? false)
            {
                CurrentDatabase.ClearTag(tag);
            }

            Person.Tag(CurrentDatabase, id, Util2.CurrentTagName, Util2.CurrentTagOwnerId, DbUtil.TagTypeId_Personal);
            CurrentDatabase.SubmitChanges();
            Util2.CurrentTag = tagname;
            CurrentDatabase.TagCurrent();
            return(Content("OK"));
        }
示例#4
0
        public void TagAll(string tagname, bool?cleartagfirst)
        {
            var workingTag     = CurrentDatabase.FetchOrCreateTag(Util2.GetValidTagName(tagname), CurrentDatabase.UserPeopleId, DbUtil.TagTypeId_Personal);
            var shouldEmptyTag = cleartagfirst ?? false;

            if (shouldEmptyTag)
            {
                CurrentDatabase.ClearTag(workingTag);
            }
            if (workingTag == null)
            {
                throw new ArgumentNullException(nameof(workingTag));
            }

            CurrentDatabase.CurrentTagName    = workingTag.Name;
            CurrentDatabase.CurrentTagOwnerId = workingTag.PersonOwner.PeopleId;

            var q = Senders();

            CurrentDatabase.TagAll(q, workingTag);
        }
示例#5
0
        public ContentResult TagAll(string tagname, bool?cleartagfirst, QueryModel m)
        {
            if (!tagname.HasValue())
            {
                return(Content("error: no tag name"));
            }

            if (Util2.CurrentTagName == tagname && !(cleartagfirst ?? false))
            {
                m.TagAll();
                return(Content("Remove"));
            }
            var tag = CurrentDatabase.FetchOrCreateTag(tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal);

            if (cleartagfirst ?? false)
            {
                CurrentDatabase.ClearTag(tag);
            }

            m.TagAll(tag);
            Util2.CurrentTag = tagname;
            CurrentDatabase.TagCurrent();
            return(Content("Manage"));
        }