protected void btnCleanUpBD_Click(object sender, EventArgs e) { var res = new StringBuilder(); try { foreach (var photoName in PhotoService.GetNamePhotos(0, PhotoType.Product)) { if ((((!File.Exists(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Big, photoName))) || (!File.Exists(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Middle, photoName)))) || (!File.Exists(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Small, photoName)))) || (!File.Exists(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.XSmall, photoName)))) { if (chboxMakeNull.Checked) { PhotoService.DeleteProductPhotoWithPath(photoName); res.AppendFormat("Link to product photo {0} was deleted<br />", photoName); } else { res.AppendFormat("No product photos {0}<br />", photoName); } res.Append(CheckProductFile(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Big, photoName))); res.Append(CheckProductFile(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Middle, photoName))); res.Append(CheckProductFile(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Small, photoName))); res.Append(CheckProductFile(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.XSmall, photoName))); } } foreach (var photoName in PhotoService.GetNamePhotos(0, PhotoType.CategoryBig)) { res.Append(CheckCategoryFile(photoName)); res.Append(CheckCategoryFile(photoName)); } foreach (var photoName in PhotoService.GetNamePhotos(0, PhotoType.CategorySmall)) { res.Append(CheckCategoryFile(photoName)); res.Append(CheckCategoryFile(photoName)); } } catch (Exception ex) { Debug.LogError(ex); } if (!chboxMakeNull.Checked) { lDBCleanupCompleted.Text = @"Analysis successfully completed"; } lDBCleanupCompleted.Visible = true; lDBResult.Text = string.IsNullOrEmpty(res.ToString()) ? @"No items to correct" : res.ToString(); }