Exemplo n.º 1
0
        private void countDataCount(UserFile uFile)
        {
            if (uFile.DataId <= 0 || strUtil.IsNullOrEmpty(uFile.DataType))
            {
                return;
            }

            int fileCount = UserFile.find("DataId=" + uFile.DataId + " and DataType=:dtype")
                            .set("dtype", uFile.DataType)
                            .count();

            EntityInfo ei   = Entity.GetInfo(uFile.DataType);
            IEntity    post = ndb.findById(ei.Type, uFile.DataId);

            if (post != null)
            {
                String propertyName = "AttachmentCount";
                if (ei.GetProperty(propertyName) != null)
                {
                    post.set(propertyName, fileCount);
                    db.update(post);
                }
                else
                {
                    logger.Warn("property 'AttachmentCount' not exist: " + ei.Type.FullName);
                }
            }
        }
Exemplo n.º 2
0
        public List <UserFile> GetPicByIds(string ids, Type t)
        {
            if (strUtil.IsNullOrEmpty(ids))
            {
                return(new List <UserFile>());
            }

            return(UserFile.find("IsPic=1 and DataType='" + t.FullName + "' and Id in (" + ids + ")").list());
        }
Exemplo n.º 3
0
        public List <UserFile> GetByData(Object obj)
        {
            IEntity entity = obj as IEntity;

            return(UserFile.find("DataId=" + entity.Id + " and DataType='" + obj.GetType().FullName + "' order by Id asc").list());
        }