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(); }
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(); }
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)); } }