예제 #1
0
        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;
        }
예제 #2
0
        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));
                }
        }
예제 #3
0
 public ContainerEventArgs(Container container, ContainerType containerType)
 {
     Container = container;
     Type = containerType;
 }