Exemplo n.º 1
0
        public static void DeleteDataTag(long dataTagId)
        {
            DataTagShip dt = DataTagShip.findById(dataTagId);

            if (dt == null)
            {
                return;
            }

            long tagId = dt.Tag == null ? 0 : dt.Tag.Id;

            dt.delete();

            if (tagId == 0)
            {
                return;
            }
            int count = DataTagShip.count("TagId=" + tagId);

            Tag tag = Tag.findById(tagId);

            if (tag == null)
            {
                return;
            }
            tag.DataCount = count;
            tag.update();
        }
Exemplo n.º 2
0
 private static void recountTagDatas(List <Tag> tags)
 {
     foreach (Tag tag in tags)
     {
         int count = DataTagShip.find("Tag.Id=" + tag.Id).count();
         tag.DataCount = count;
         tag.update("DataCount");
     }
 }
Exemplo n.º 3
0
        public static void DeleteTag(long tagId)
        {
            Tag tag = Tag.findById(tagId);

            if (tag == null)
            {
                return;
            }

            DataTagShip.deleteBatch("TagId=" + tagId);
            tag.delete();
        }
Exemplo n.º 4
0
        private static void clearDataTags(IAppData data)
        {
            List <DataTagShip> list = DataTagShip.find("DataId=:dataId and TypeFullName=:dataType")
                                      .set("dataId", data.Id)
                                      .set("dataType", data.GetType().FullName)
                                      .list();

            foreach (DataTagShip ship in list)
            {
                db.delete(ship);
            }
        }
Exemplo n.º 5
0
        private void initDataTagList()
        {
            List <DataTagShip> list = DataTagShip.find("DataId=" + _data.Id + " and TypeFullName=:tname order by Id").set("tname", _data.GetType().FullName).list();

            _dataTags = list;

            _tags = new List <Tag>();
            foreach (DataTagShip dt in list)
            {
                _tags.Add(dt.Tag);
            }
        }
Exemplo n.º 6
0
 private static void joinTag_Data(Tag tag, IAppData data)
 {
     if (DataTagShip.find("DataId=:dataId and Tag.Id=:tagId and TypeFullName=:dataType")
         .set("dataId", data.Id)
         .set("tagId", tag.Id)
         .set("dataType", data.GetType().FullName)
         .count() == 0)
     {
         DataTagShip ship = new DataTagShip();
         ship.DataId       = data.Id;
         ship.TypeFullName = data.GetType().FullName;
         ship.Tag          = tag;
         db.insert(ship);
     }
 }