コード例 #1
0
ファイル: CarFactory.cs プロジェクト: DKlenye/Naftan.CMMS
        protected override void Build(IRepository repository)
        {
            new SpecificationFactory(repository);
            new MaintenanceTypeFactory(repository);
            new MeasureUnitFactory(repository);

            var ts = new RepairObjectGroup {
                Name = "Транспортные средства"
            };

            ts.AddSpecification(new GroupSpecification(SpecificationFactory.RegistrationNumber));
            ts.AddSpecification(new GroupSpecification(SpecificationFactory.EngineVolume));

            var cars = new RepairObjectGroup {
                Name = "Легковые автомобили"
            };
            var engine_1_8 = new RepairObjectGroup {
                Name = "Объём двигателя от 1,8 л до 3,5 л"
            };

            cars.AddChild(engine_1_8);
            ts.AddChild(cars);

            repository.Save(ts);
            repository.Save(cars);
            repository.Save(engine_1_8);

            //Интервал ТО-1 10 ткм, либо 1 раз в 2 года
            var Interval_TO1 = new MaintenanceInterval(
                engine_1_8,
                MaintenanceTypeFactory.TO1_Repair,
                TimePeriod.Year, 2,
                MeasureUnitFactory.Km, 10000
                );

            //Интервал ТО-2 20 ткм
            var Interval_TO2 = new MaintenanceInterval(
                engine_1_8,
                MaintenanceTypeFactory.TO2_Repair,
                MeasureUnitFactory.Km,
                20000
                );

            repository.Save(Interval_TO1);
            repository.Save(Interval_TO2);

            Car = new RepairObject(engine_1_8, "999", DateTime.Now);
            repository.Save(Car);
        }
コード例 #2
0
        protected override void Build(IRepository repository)
        {
            new MaintenanceTypeFactory(repository);
            new SpecificationFactory(repository);
            new MeasureUnitFactory(repository);

            var eMotors = new RepairObjectGroup {
                Name = "Электродвигатели"
            };
            var eMotorType = new RepairObjectGroup {
                Name = "ЭД синхронный с к.з. ротором"
            };
            var eMotorModel = new RepairObjectGroup {
                Name = "1AN3R-355Z-6"
            };

            eMotors.AddChild(eMotorType);
            eMotorType.AddChild(eMotorModel);

            var interval_T = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.T_Repair,
                MeasureUnitFactory.WorkHours,
                8000,
                8760,
                12
                );

            var interval_C = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.C_Repair,
                MeasureUnitFactory.WorkHours,
                42000,
                43800,
                2
                );

            var interval_K = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.K_Repair,
                MeasureUnitFactory.WorkHours,
                130000,
                131400,
                1
                );

            repository.Save(interval_T);
            repository.Save(interval_C);
            repository.Save(interval_K);

            eMotors.AddSpecification(new GroupSpecification(SpecificationFactory.Power));
            eMotors.AddSpecification(new GroupSpecification(SpecificationFactory.RPM));

            repository.Save(eMotors);

            var eMotor = new RepairObject(eMotorModel, "К-401В", DateTime.Now)
            {
                FactoryNumber   = "3452",
                InventoryNumber = "123456678"
            };

            eMotor.AddSpecification(new ObjectSpecification(SpecificationFactory.Execution, "1"));

            ElectroMotor = eMotor;
        }