public static void SaveChanges(Dme.Core.DmeEntities entities) { try { entities.SaveChanges(); } catch (DbEntityValidationException ex) { StringBuilder sb = new StringBuilder(); foreach (var failure in ex.EntityValidationErrors) { sb.AppendFormat("{0} failed validation\n", failure.Entry.Entity.GetType()); foreach (var error in failure.ValidationErrors) { sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage); sb.AppendLine(); } } throw new DbEntityValidationException( "Entity Validation Failed - errors follow:\n" + sb.ToString(), ex ); } }
public void TestPlatformXmlSerializer() { using (var context = new Dme.Core.DmeEntities()) { var order = context.Order.Where(o => o.OrderID == 2499).First(); var doc = new XDocument(Dme.Core.Xml.OrderSerializer.ToXElement(order)); doc.Save(@"c:\temp\snt\test.xml"); } }
public PackageBuilder(string folderName, int recipient) { _FolderName = folderName; using (var context = new Dme.Core.DmeEntities()) { var r1 = (from r in context.Клиенты where r.Код == 1 select r).First(); // СНТ var r2 = (from r in context.Клиенты where r.Код == recipient select r).First(); SenderINN = r1.ИНН; SenderKPP = r1.КПП; RecipientINN = r2.ИНН; RecipientKPP = r2.КПП; } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _Context.Dispose(); _Context = null; } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public InboundService() { _Context = new Core.DmeEntities(); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _Context.Dispose(); _Context = null; } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public OutboundService() { _Context = new Core.DmeEntities(); }
public InventoryService() { _Context = new Core.DmeEntities(); }