Пример #1
0
        public void SaveTags(String tagList, int viewerId, User owner)
        {
            String[] arrTags = tagList.Split(new char[] { ',', ',', '、' });

            foreach (String tag in arrTags)
            {
                if (strUtil.IsNullOrEmpty(tag))
                {
                    continue;
                }

                String name = strUtil.SqlClean(tag.Trim(), 10);

                UserTag ut = GetTagByName(name);
                if (ut == null)
                {
                    ut           = new UserTag();
                    ut.CreatorId = viewerId;
                    ut.Name      = strUtil.SubString(tag.Trim(), 10);
                    ut.insert();
                }

                UserTagShip uts = UserTagShip.find("UserId=" + owner.Id + " and TagId=" + ut.Id).first();
                if (uts != null)
                {
                    continue;
                }


                uts      = new UserTagShip();
                uts.User = owner;
                uts.Tag  = ut;
                uts.insert();

                ut.UserCount++;
                ut.update();
            }
        }
Пример #2
0
        public List <UserTagShip> GetPage(int ownerId)
        {
            List <UserTagShip> us = UserTagShip.find("UserId=" + ownerId).list();

            return(us);
        }
Пример #3
0
        public virtual List <UserTagShip> GetPage(long ownerId)
        {
            List <UserTagShip> us = UserTagShip.find("UserId=" + ownerId).list();

            return(us);
        }