Пример #1
0
        public static TECInternalNote TestInternalNote(Random rand)
        {
            TECInternalNote labeled = new TECInternalNote();

            labeled.AssignTestLabel();
            return(labeled);
        }
        private void addNewExecute()
        {
            TECInternalNote newNote = new TECInternalNote();

            newNote.Label = NewText;
            Bid.InternalNotes.Add(newNote);
            SelectedNote = newNote;
            NewText      = "";
        }
Пример #3
0
        public static TECBid CreateTestBid()
        {
            TECBid bid = new TECBid();

            //Bid Info
            bid.Name        = "Bid Name";
            bid.BidNumber   = "1701-117";
            bid.DueDate     = DateTime.Now;
            bid.Salesperson = "Mrs. Test";
            bid.Estimator   = "Mr. Test";

            //Bid Objects
            bid.ExtraLabor = CreateTestExtraLabor(bid.Guid);
            bid.Parameters = CreateTestParameters(bid.Guid);
            bid.Catalogs   = CreateTestCatalogs();

            //Internal Notes
            TECInternalNote internalNote = new TECInternalNote();

            internalNote.Label = "Test internal";
            internalNote.Body  = "Test body";
            bid.InternalNotes.Add(internalNote);

            //Locations
            var cellar = new TECLocation();

            cellar.Name  = "Cellar";
            cellar.Label = "C";

            var location1 = new TECLocation();

            location1.Name  = "1st Floor";
            location1.Label = "1";

            var location2 = new TECLocation();

            location2.Name  = "2nd Floor";
            location2.Label = "2";

            var location3 = new TECLocation();

            location3.Name  = "3rd Floor";
            location3.Label = "3";

            bid.Locations.Add(cellar);
            bid.Locations.Add(location1);
            bid.Locations.Add(location2);
            bid.Locations.Add(location3);


            //Scope Branches
            var branch1 = new TECScopeBranch(false);

            branch1.Label = "Branch 1";
            var branch2 = new TECScopeBranch(false);

            branch2.Label = "Branch 2";
            var branch3 = new TECScopeBranch(false);

            branch3.Label = "Branch 3";

            bid.ScopeTree.Add(branch1);
            branch1.Branches.Add(branch2);
            branch2.Branches.Add(branch3);

            //Notes
            var note1 = new TECLabeled();

            note1.Label = "Note 1";

            bid.Notes.Add(note1);

            //Exclusions
            var exclusion1 = new TECLabeled();

            exclusion1.Label = "Exclusion 1";

            bid.Exclusions.Add(exclusion1);

            //Controller
            TECController expectedController = new TECProvidedController(Guid.NewGuid(), bid.Catalogs.ControllerTypes[0], false);

            expectedController.Name        = "Test Controller";
            expectedController.Description = "Test description";

            bid.AddController(expectedController);

            //Misc Cost
            TECMisc cost = new TECMisc(CostType.TEC, false);

            cost.Name     = "Test Cost";
            cost.Cost     = 69.69;
            cost.Quantity = 69;

            bid.MiscCosts.Add(cost);

            //Misc wiring
            TECMisc wiring = new TECMisc(CostType.Electrical, false);

            wiring.Name     = "Test Wiring";
            wiring.Cost     = 69.69;
            wiring.Quantity = 69;

            bid.MiscCosts.Add(wiring);

            //Panels
            TECPanel panel = new TECPanel(bid.Catalogs.PanelTypes[0], false);

            panel.Name = "Test Panel";
            panel.Controllers.Add(expectedController);
            panel.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);
            panel.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);

            bid.Panels.Add(panel);

            //Systems
            var system1 = CreateTestTypical(bid.Catalogs);

            system1.Name        = "System 1";
            system1.Description = "Locations all the way";
            system1.Location    = cellar;

            var system2 = CreateTestTypical(bid.Catalogs);

            system2.Name        = "System 2";
            system2.Description = "Description 2";

            var system3 = CreateTestTypical(bid.Catalogs);

            system3.Name        = "System 3";
            system3.Description = "";

            bid.Systems.Add(system1);
            bid.Systems.Add(system2);
            bid.Systems.Add(system3);

            system1.AddInstance(bid);
            system2.AddInstance(bid);
            system3.AddInstance(bid);

            system1.AddInstance(bid);
            system2.AddInstance(bid);
            system3.AddInstance(bid);

            //Equipment
            var equipment1 = new TECEquipment(true);

            equipment1.Name        = "Equipment 1";
            equipment1.Description = "Description 1";

            var equipment2 = new TECEquipment(true);

            equipment2.Name        = "Equipment 2";
            equipment2.Description = "Description 2";

            system1.Equipment.Add(equipment1);
            system3.Equipment.Add(equipment2);

            //SubScope
            var subScope1 = new TECSubScope(true);

            subScope1.Name        = "SubScope 1";
            subScope1.Description = "Description 1";
            subScope1.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);
            subScope1.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);
            subScope1.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);

            var subScope2 = new TECSubScope(true);

            subScope2.Name        = "Empty SubScope";
            subScope2.Description = "Description 2";
            subScope2.AssociatedCosts.Add(bid.Catalogs.AssociatedCosts[0]);

            equipment1.SubScope.Add(subScope1);
            equipment2.SubScope.Add(subScope2);

            //Points
            var point1 = new TECPoint(true);

            point1.Label    = "Point 1";
            point1.Type     = IOType.AI;
            point1.Quantity = 2;

            subScope1.Points.Add(point1);

            var point2 = new TECPoint(true);

            point2.Label    = "Point 2";
            point2.Type     = IOType.AI;
            point2.Quantity = 2;

            subScope2.Points.Add(point2);

            //Devices
            subScope1.Devices.Add(bid.Catalogs.Devices[0]);

            //Connections
            TECSubScope           instanceSubScope = system1.GetInstancesFromTypical(subScope1)[0];
            IControllerConnection testConnection   = expectedController.Connect(instanceSubScope, (instanceSubScope as IConnectable).AvailableProtocols.First());

            testConnection.ConduitType = bid.Catalogs.ConduitTypes[0];
            testConnection.Length      = 42;

            AssignAllSecondaryProperties(bid);

            TECTypical noLocation = new TECTypical();

            noLocation.Name = "No Location";
            noLocation.Equipment.Add(new TECEquipment(true));
            noLocation.Equipment[0].SubScope.Add(new TECSubScope(true));
            bid.Systems.Add(noLocation);

            return(bid);
        }