public ContainerType Create(long structureId, string name, string parent) { ContainerType parentCp = null; var cp = new ContainerType {StructureId = structureId, Name = name}; if (!string.IsNullOrEmpty(parent)) parentCp = Get(structureId, parent); if (parentCp != null) parentCp.Childs.Add(cp); else _dbManager.DbContext.ContainerPrototypes.Add(cp); _dbManager.DbContext.SaveChanges(); return cp; }
private void InvokeOnDeleteContainer(Container container, ContainerType containerType) { var eventArgs = new ContainerEventArgs(container, containerType); if (_onDeleteContainer != null) try { _onDeleteContainer(this, eventArgs); }catch(Exception e) { DataBaseManager.Logger.Log(String.Format("InvokeOnDeleteContainer fail - {0}", e.Message)); } }
public ContainerEventArgs(Container container, ContainerType containerType) { Container = container; Type = containerType; }