/// <summary> /// Updates the photo. /// </summary> /// <param name="productId">The product id.</param> protected void UpdateProductPhotos(Guid productId) { foreach (var productPhoto in UploadedProductPhoto) { productPhoto.ProductId = productId; DataManager.ProductPhoto.Save(productPhoto); } var photos = labitecImageGallery.Photos; foreach (var photo in photos) { var productPhoto = DataManager.ProductPhoto.Select(photo.PhotoId); if (photo.IsDeleted) { FileStorageProvider.Delete(BusinessLogicLayer.Configuration.Settings.ProductImageAbsolutePath(CurrentUser.Instance.SiteID), productPhoto.Photo); FileStorageProvider.Delete(BusinessLogicLayer.Configuration.Settings.ProductImageAbsolutePath(CurrentUser.Instance.SiteID), productPhoto.Preview); DataManager.ProductPhoto.Delete(photo.PhotoId); } else { DataManager.ProductPhoto.Save(productPhoto.Id, productPhoto.ProductId, productPhoto.Photo, productPhoto.Preview, photo.Description, photo.IsMain); } } }
String PerformStorageAction(String schema) { InvokeResultDescriptor result = new InvokeResultDescriptor(); String res = String.Empty; try { StorageActionArgs args = XmlSerializationUtility.XmlStr2Obj <StorageActionArgs>(schema); if (args != null) { FileStorageProvider storageProvider = new FileStorageProvider(); switch (args.ActionType) { case StorageActionTypes.Save: args.FileDescription.ContentFileName = args.FileDescription.Description.Name + ".content." + FileStorageProvider.GetFilteExtension(args.ContentType); storageProvider.Save(HttpContext.Current.User, args.FileDescription.Description.Name + "." + FileStorageProvider.GetFilteExtension(args.ContentType), XmlSerializationUtility.Obj2XmlStr(args.FileDescription)); storageProvider.Save(HttpContext.Current.User, args.FileDescription.ContentFileName, args.Content); break; case StorageActionTypes.Load: res = storageProvider.Load(HttpContext.Current.User, args.FileDescription.ContentFileName); break; case StorageActionTypes.GetList: res = XmlSerializationUtility.Obj2XmlStr(storageProvider.GetList(HttpContext.Current.User, "*." + FileStorageProvider.GetFilteExtension(args.ContentType)), Common.Namespace); break; case StorageActionTypes.Clear: res = XmlSerializationUtility.Obj2XmlStr(storageProvider.Clear(HttpContext.Current.User, "*." + FileStorageProvider.GetFilteExtension(args.ContentType))); break; case StorageActionTypes.Delete: storageProvider.Delete(HttpContext.Current.User, args.FileDescription.Description.Name + "." + FileStorageProvider.GetFilteExtension(args.ContentType)); storageProvider.Delete(HttpContext.Current.User, args.FileDescription.ContentFileName); res = XmlSerializationUtility.Obj2XmlStr(storageProvider.GetList(HttpContext.Current.User, "*." + FileStorageProvider.GetFilteExtension(args.ContentType)), Common.Namespace); break; } } result.Content = res; } catch (Exception) { throw; } return(InvokeResultDescriptor.Serialize(result)); }