示例#1
0
        private void handleLoadedTemplates(TECTemplates templates)
        {
            if (ReplaceScope)
            {
                bid.Templates.Unionize(templates.Templates);
            }
            else
            {
                bid.Templates.Fill(templates.Templates);
            }

            if (ReplaceCatalogs)
            {
                bid.Catalogs.Unionize(templates.Catalogs);
            }
            else
            {
                bid.Catalogs.Fill(templates.Catalogs);
            }

            if (databaseManager == null && bid.Templates.Parameters.Count > 0)
            {
                bid.Parameters = new TECParameters(bid.Templates.Parameters.First());
            }

            ModelLinkingHelper.LinkBidToCatalogs(bid);

            estimate = new TECEstimator(bid, watcher);

            EditorVM = new EstimateEditorVM(bid, watcher, estimate);

            CurrentVM   = EditorVM;
            ViewEnabled = true;
        }
示例#2
0
        public TECSystem(TECSystem source, Dictionary <Guid, Guid> guidDictionary      = null,
                         ObservableListDictionary <ITECObject> characteristicReference = null,
                         Tuple <TemplateSynchronizer <TECEquipment>, TemplateSynchronizer <TECSubScope> > synchronizers = null) : this()
        {
            if (guidDictionary == null)
            {
                guidDictionary = new Dictionary <Guid, Guid>();
            }

            guidDictionary[_guid] = source.Guid;
            foreach (TECEquipment equipment in source.Equipment)
            {
                var toAdd = new TECEquipment(equipment, guidDictionary, characteristicReference, ssSynchronizer: synchronizers?.Item2);
                if (synchronizers != null && synchronizers.Item1.Contains(equipment))
                {
                    synchronizers.Item1.LinkNew(synchronizers.Item1.GetTemplate(equipment), toAdd);
                }
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(equipment, toAdd);
                }
                Equipment.Add(toAdd);
            }
            foreach (TECController controller in source._controllers)
            {
                var toAdd = controller.CopyController(guidDictionary);
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(controller, toAdd);
                }
                _controllers.Add(toAdd);
            }
            foreach (TECPanel panel in source.Panels)
            {
                var toAdd = new TECPanel(panel, guidDictionary);
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(panel, toAdd);
                }
                Panels.Add(toAdd);
            }
            foreach (TECMisc misc in source.MiscCosts)
            {
                var toAdd = new TECMisc(misc);
                MiscCosts.Add(toAdd);
            }
            foreach (TECScopeBranch branch in source.ScopeBranches)
            {
                var toAdd = new TECScopeBranch(branch);
                ScopeBranches.Add(toAdd);
            }
            foreach (TECProposalItem item in source.ProposalItems)
            {
                var toAdd = new TECProposalItem(item, guidDictionary);
                ProposalItems.Add(toAdd);
            }
            this.copyPropertiesFromLocated(source);
            ModelLinkingHelper.LinkSystem(this, guidDictionary);
        }
示例#3
0
        public override object DropData()
        {
            Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>();
            TECTypical outSystem = new TECTypical(this, guidDictionary);

            ModelLinkingHelper.LinkSystem(outSystem, guidDictionary);
            return(outSystem);
        }
示例#4
0
        public TECSystem AddInstance()
        {
            Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>();
            var newSystem = new TECSystem();

            newSystem.CopyPropertiesFromScope(this);
            if (this.Location != null)
            {
                newSystem.Location = this.Location;
            }
            foreach (TECEquipment equipment in Equipment)
            {
                var toAdd = new TECEquipment(equipment, guidDictionary, TypicalInstanceDictionary);
                TypicalInstanceDictionary.AddItem(equipment, toAdd);
                newSystem.Equipment.Add(toAdd);
            }
            foreach (TECController controller in Controllers)
            {
                var toAdd = controller.CopyController(guidDictionary);
                TypicalInstanceDictionary.AddItem(controller, toAdd);
                newSystem.AddController(toAdd);
            }
            foreach (TECPanel panel in Panels)
            {
                var toAdd = new TECPanel(panel, guidDictionary);
                TypicalInstanceDictionary.AddItem(panel, toAdd);
                newSystem.Panels.Add(toAdd);
            }
            foreach (TECMisc misc in MiscCosts)
            {
                var toAdd = new TECMisc(misc);
                TypicalInstanceDictionary.AddItem(misc, toAdd);
                newSystem.MiscCosts.Add(toAdd);
            }
            foreach (TECScopeBranch branch in ScopeBranches)
            {
                var toAdd = new TECScopeBranch(branch);
                TypicalInstanceDictionary.AddItem(branch, toAdd);
                newSystem.ScopeBranches.Add(toAdd);
            }
            //Proposal items are not currently synced to instances
            //foreach(TECProposalItem propItem in ProposalItems)
            //{
            //    var toAdd = new TECProposalItem(propItem);
            //    TypicalInstanceDictionary.AddItem(propItem, toAdd);
            //    newSystem.ProposalItems.Add(toAdd);
            //}
            ModelLinkingHelper.LinkSystem(newSystem, guidDictionary);

            Instances.Add(newSystem);
            return(newSystem);
        }
示例#5
0
        public TECTypical(TECSystem system, TECScopeManager manager) : this()
        {
            Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>();

            guidDictionary[_guid] = system.Guid;
            foreach (TECEquipment equipment in system.Equipment)
            {
                var toAdd = new TECEquipment(equipment, guidDictionary);
                Equipment.Add(toAdd);
            }
            foreach (TECController controller in system.Controllers)
            {
                var toAdd = controller.CopyController(guidDictionary);
                AddController(toAdd);
            }
            foreach (TECPanel panel in system.Panels)
            {
                var toAdd = new TECPanel(panel, guidDictionary);
                Panels.Add(toAdd);
            }
            foreach (TECMisc misc in system.MiscCosts)
            {
                var toAdd = new TECMisc(misc);
                MiscCosts.Add(toAdd);
            }
            foreach (TECScopeBranch branch in system.ScopeBranches)
            {
                var toAdd = new TECScopeBranch(branch);
                ScopeBranches.Add(toAdd);
            }
            foreach (TECProposalItem item in system.ProposalItems)
            {
                var toAdd = new TECProposalItem(item, guidDictionary);
                ProposalItems.Add(toAdd);
            }
            copyPropertiesFromLocated(system);
            ModelLinkingHelper.LinkSystem(this, guidDictionary);
        }