public void RemoveSave() { var ctx = Acumulator.Instance().ctx; ctx.Load(ctx.GetOpgeslagenOfferteByIdQuery(Acumulator.Instance().Bouwnr)).Completed += (sender, args) => { var saves = (from s in ctx.OpgeslagenOffertes orderby s.timestamp select s); while (saves.Count() > 0) { if (saves.Last().Volledig == true) { ArchiefOffertes ao = new ArchiefOffertes(); ao.Bouwnummer_NR = saves.Last().Bouwnummer_NR; ao.GebruikerID_Delete = Acumulator.Instance().HuidigGebruiker.ID; ao.GebruikerID_Save = saves.Last().Gebruiker_ID; ao.timestamp_save = saves.Last().timestamp; ao.timestamp_remove = DateTime.Now; ao.Xml_Value = saves.Last().Xml_Value; ao.Versie = saves.Count().ToString(); if (saves.Last().Prijs != null) { ao.Prijs = saves.Last().Prijs; } ctx.ArchiefOffertes.Add(ao); } ctx.OpgeslagenOffertes.Remove(saves.Last()); } ctx.SubmitChanges(); Acumulator.Instance().SavedXml = null; Acumulator.Instance().oOL = null; }; }
public void InsertArchiefOffertes(ArchiefOffertes ao) { ObjectContext.AddToArchiefOffertes(ao); }