public bool DeleleUnusedPic(ref Int64 canSavedSpace) { string picIDs = ""; if (CanDeleteClearPic != null && CanDeleteClearPic.Count > 0) { for (int i = 0; i < CanDeleteClearPic.Count; i++) { picIDs += CanDeleteClearPic[i].ToString() + ","; List <Picture> lst = ClearTop.GetPicsByPicID(Convert.ToInt64(CanDeleteClearPic[i].ToString())); if (lst != null && lst.Count == 1) { canSavedSpace += lst[0].Sizes; } } } if (!string.IsNullOrEmpty(picIDs)) { //有删除的垃圾图片 picIDs = picIDs.Substring(0, picIDs.Length - 1); bool falg = ClearTop.DeleleInvalidPic(picIDs); if (falg) { System.Web.HttpContext.Current.Session["CanDeleteClearPic"] = null; } return(falg); } return(false); }
public Int64 GetNeedClearPicCount(long picture_category_id) { List <Picture> lstPic = ClearTop.GetPicsBySeller(CurrentPage, PageSize, picture_category_id, ref total); if (lstPic != null && lstPic.Count > 0) { DataTable tb = Utility.EntityListToDataTable <Picture>(lstPic); DataRow[] rwCanDelete = tb.Select("Referenced = False"); totalCanClearPic += rwCanDelete.Length; foreach (DataRow r in rwCanDelete) { if (CanDeleteClearPic == null) { CanDeleteClearPic = new ArrayList(); } if (!CanDeleteClearPic.Contains(r["PictureId"].ToString())) { CanDeleteClearPic.Add(r["PictureId"].ToString()); } } } PageNo = PageNo + PageSize; if (PageNo < total) { CurrentPage = CurrentPage + 1; GetNeedClearPicCount(picture_category_id); } PageNo = 0; CurrentPage = 1; PageSize = 100; return(totalCanClearPic); }