Exemple #1
0
        public static void CreateFile(FileItem f)
        {
            f.insert();

            int count = FileItem.count("CategoryId=" + f.CategoryId);

            FileCategory c = FileCategory.GetById(f.CategoryId);

            c.DataCount = count;
            c.update();
        }
Exemple #2
0
        public static void DeleteFile(FileItem f)
        {
            int categoryId = f.CategoryId;

            f.delete();


            int count = FileItem.count("CategoryId=" + categoryId);

            FileCategory c = FileCategory.GetById(categoryId);

            c.DataCount = count;
            c.update();
        }
Exemple #3
0
        public static DataPage <FileItem> GetPage(int appId, int categoryId)
        {
            FileCategory c = FileCategory.GetById(categoryId);

            if (c.ParentId == 0)
            {
                List <FileCategory> list = FileCategory.GetByParentId(c.Id);
                String ids = "";
                for (int i = 0; i < list.Count; i++)
                {
                    ids += list[i].Id;
                    if (i < list.Count - 1)
                    {
                        ids += ",";
                    }
                }

                return(FileItem.findPage("AppId=" + appId + " and CategoryId in (" + ids + ")"));
            }
            else
            {
                return(FileItem.findPage("AppId=" + appId + " and CategoryId=" + categoryId));
            }
        }