public override void Call() { Progress.Caption = "Actualizando metadatos"; Progress.Total = 1; PublicId.SetId(current.Contact); PublicId.SetId(current.Institution); PublicId.SetId(current); context.Data.Session.SaveOrUpdate(current.Contact); context.Data.Session.SaveOrUpdate(current.Institution); if (current.MetadataSources != null) { foreach (var src in current.MetadataSources) { PublicId.SetId(src.Source.Contact); PublicId.SetId(src); PublicId.SetId(src.Source.Institution); PublicId.SetId(src.Source); context.Data.Session.SaveOrUpdate(src.Source.Contact); context.Data.Session.SaveOrUpdate(src.Source.Institution); context.Data.Session.SaveOrUpdate(src.Source); context.Data.Session.SaveOrUpdate(src); } } context.Data.Session.SaveOrUpdate(current); foreach (var file in current.Files) { if (file.FileAdded && file.File != null) { FileSave fs = new FileSave(this, file.File); fs.Call(); } } }
public override void Call() { Progress.Caption = "Actualizando copia de archivo"; Progress.Total = 2; Progress.Increment(); List <FileChunk> keepItems = new List <FileChunk>(); if (current.FileChunks.Count > 0 && current.FileChunks[0].Id.HasValue == false) { // has nuevos keepItems.AddRange(current.FileChunks); int totalSize = 0; foreach (var v in current.FileChunks) { totalSize += v.Content.Length; } current.Size = totalSize; current.FileChunks.Clear(); } else { PublicId.SetId(current); context.Data.Session.SaveOrUpdate(current); return; } Progress.Total = keepItems.Count + 1; PublicId.SetId(current); context.Data.Session.SaveOrUpdate(current); foreach (var chunk in keepItems) { current.FileChunks.Add(chunk); PublicId.SetId(chunk); context.Data.Session.SaveOrUpdate(chunk); Progress.Increment(); } }