public void Delete(ArticleImage Obj) { Model.Local.AttributeArticleImageRepository AttributeArticleImageRepository = new AttributeArticleImageRepository(); AttributeArticleImageRepository.DeleteAll(AttributeArticleImageRepository.ListImageArticle(Obj.ImaArt_Id)); Model.Local.CompositionArticleImageRepository CompositionArticleImageRepository = new CompositionArticleImageRepository(); CompositionArticleImageRepository.DeleteAll(CompositionArticleImageRepository.ListImageArticle(Obj.ImaArt_Id)); this.DBLocal.ArticleImage.DeleteOnSubmit(Obj); this.Save(); }
public void ExecImage(Model.Local.ArticleImage ArticleImage) { this.Semaphore.WaitOne(); try { string localPath = ArticleImage.advanced_folder; String extension = Path.GetExtension(ArticleImage.ImaArt_Image); String FileName = String.Format("{0}" + extension, ArticleImage.ImaArt_Id); String PathImgTmp = System.IO.Path.Combine(Core.Global.GetConfig().Folders.TempArticle, FileName); if (System.IO.File.Exists(PathImgTmp)) { File.Move(PathImgTmp, System.IO.Path.Combine(localPath, FileName)); } String PathImgSmall = System.IO.Path.Combine(Core.Global.GetConfig().Folders.SmallArticle, FileName); if (System.IO.File.Exists(PathImgSmall)) { File.Move(PathImgSmall, System.IO.Path.Combine(localPath, FileName.Replace(extension, "_small" + extension))); } List <String> FileList = System.IO.Directory.GetFiles(Core.Global.GetConfig().Folders.RootArticle, (ArticleImage.ImaArt_Id + "-*")).ToList(); foreach (String file in FileList) { File.Move(file, file.Replace(Core.Global.GetConfig().Folders.RootArticle, localPath)); } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } lock (this) { this.CurrentCount += 1; } this.ReportProgress(this.CurrentCount * 100 / this.ListCount); this.Semaphore.Release(); }
public void Add(ArticleImage Obj) { this.DBLocal.ArticleImage.InsertOnSubmit(Obj); this.Save(); }