public void DoSaveChanges(WebContext dc) { try { dc.SaveChanges(); } catch (OptimisticConcurrencyException) { dc.Refresh(RefreshMode.ClientWins, this); dc.SaveChanges(); } dc.Refresh(RefreshMode.StoreWins, this); }
public bool SaveChanges() { WebContext dc = ContextManager.WebContext; if (!string.IsNullOrEmpty(this.Nazwa)) { if (EntityState == EntityState.Detached) { dc.AddToStatusyZamowien(this); } if (EntityState == EntityState.Added || EntityState == EntityState.Modified) { if (EntityState == EntityState.Added) { Synchronizacja = (int)RowSynchronizeOld.NotsynchronizedNew; } else { switch ((RowSynchronizeOld)Synchronizacja) { case RowSynchronizeOld.NotsynchronizedDelete: case RowSynchronizeOld.Synchronized: Synchronizacja = (int)RowSynchronizeOld.NotsynchronizedEdit; break; } } Stamp = DateTime.Now; dc.SaveChanges(); } return(true); } return(false); }
public bool DeleteRecord() { if (EntityState != EntityState.Deleted && EntityState != EntityState.Detached) { if ((bool)BlokadaUsuniecia) { MessageBox.Show("Nie można usunąć statusu, ponieważ posiada blokade usunięcia.", "EnovaTools", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (HistorieZamowien.Count > 0) { MessageBox.Show("Nie można usunąć statusu, ponieważ isnieją powiązane recordy.", "EnovaTools", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { WebContext dc = ContextManager.WebContext; if (EntityState == EntityState.Added) { dc.DeleteObject(this); } else { this.Synchronizacja = (int)RowSynchronizeOld.NotsynchronizedDelete; dc.SaveChanges(); } return(true); } } return(false); }
public bool DeleteRecord() { WebContext dc = Core.ContextManager.WebContext; foreach (var adres in this.Adresy.ToList()) { dc.DeleteObject(adres); } dc.DeleteObject(this); dc.SaveChanges(); return(true); }
public bool SaveChanges() { WebContext dc = ContextManager.WebContext; if (EntityState == EntityState.Detached) { dc.AddToRodzajeKorespondencji(this); } dc.SaveChanges(); return(true); }
public bool SaveChanges() { WebContext dc = Core.ContextManager.WebContext; Adres adresKor = DomyslnyAdresWysylki; if (adresKor != null && adresKor.EntityState == EntityState.Added && string.IsNullOrEmpty(adresKor.KodPocztowy)) { dc.DeleteObject(adresKor); } dc.SaveChanges(); return(true); }