Inheritance: Item
示例#1
0
 public PlateObject(Plate plate)
 {
    this.Id = plate.Id;
    this.IsActive = plate.IsActive;
    this.Number = plate.Number;
    this.Thickness = plate.Thickness;
    this.Heat = plate.Heat;
 }
        private bool SeedOptional()
        {
            //Required seed hasn't been performed for Master worksration type, but data are used in optional seed
            if (viewModel.Project.WorkstationType == WorkstationType.Master)
            {
                SeedRequired();
            }

            firstSetupRepo.BeginTransaction();
            #region PlateManufacturers
            PlateManufacturer[] plateManufacturers = 
            {
                new PlateManufacturer {Name = "Алапаевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Альметьевский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Борский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Волжский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Волгоградский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Гурьевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Завод Точлит", IsActive = true}
            };
            Array.ForEach(plateManufacturers, s => firstSetupRepo.PlateManRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Heat
            List<Heat> heats = new List<Heat>();
            for(int i = 0; i < HEATCOUNT; i++)
            {
                heats.Add
                    (
                    new Heat ()
                    {
                        Number = RndString(8),
                        SteelGrade = RndString(6),
                        PlateManufacturer = plateManufacturers[rnd.Next(plateManufacturers.Length - 1)],
                        IsActive = true                      
                    }
                    );
                firstSetupRepo.HeatRepo.Save(heats[i]);
            }

            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region PurchaseOrder
            List<PurchaseOrder> orders = new List<PurchaseOrder>
            {
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true}
            };
            orders.ForEach(s => firstSetupRepo.PurchaseRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region MillPipe
            List<Pipe> pipes = new List<Pipe>();
            for(int i = 0; i < PIPECOUNT; i++)
            {
                var plate = new Plate
                    {
                        Number = RndString(8),
                        Thickness = rnd.Next(2000),
                        Heat = heats[rnd.Next(heats.Count - 1)],
                        IsActive = true
                    };
                firstSetupRepo.PlateRepo.Save(plate);

                var pipe = new Pipe
                {
                    Number = RndString(8),
                    Plate = plate,
                    Mill = viewModel.MillName,
                    Diameter = types[0].Diameter,
                    WallThickness = types[0].Thickness,
                    Type = types[rnd.Next(1)],
                    PurchaseOrder = orders[orders.Count - 1],
                    Project = viewModel.Project,
                    Status = PipeMillStatus.Produced,
                    ProductionDate = DateTime.Now.AddDays(-rnd.Next(20)),
                    IsActive = true
                };
                pipe.RecalculateWeight();

                var results = new List<PipeTestResult>();
                foreach(var item in tests.Where(x => x.pipeType == pipe.Type))
                {
                    var testResult = new PipeTestResult
                    {
                        Operation = item,
                        Pipe = pipe,
                        Status = PipeTestResultStatus.Scheduled
                    };
                    results.Add(testResult);
                    firstSetupRepo.PipeTestResultRepo.Save(testResult);
                }
                pipe.PipeTestResult = results;
                pipes.Add(pipe);
                if(pipes.Count % 2 == 0)
                {
                    foreach(var item in pipe.PipeTestResult)
                    {
                        item.Status = PipeTestResultStatus.Accepted;
                        if(item.Operation.Category.Type == FixedCategory.Length)
                        {
                            item.Value = PIPELENGHT.ToString();
                        }
                    }
                    pipe.Length = PIPELENGHT;
                    pipe.Status = PipeMillStatus.Stocked;
                    pipe.ConstructionStatus = PartConstructionStatus.Pending;
                    pipe.IsAvailableToJoint = true;
                    pipe.ToExport = true;
                    pipe.WallThickness = 12;
                    pipe.RecalculateWeight();

                }


                firstSetupRepo.PipeRepo.Save(pipe);
            };
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Inspector
            List<Inspector> inspectors = new List<Inspector>();
            for(int i = 0; i < INSPECTORCOUNT; i++)
            {
                var insp = new Inspector
                    {
                        Name = new PersonName
                        {
                            FirstName = RndName(fNames),
                            LastName = RndName(lNames),
                            MiddleName = RndName(mNames),
                        },
                        IsActive = true
                    };
                insp.Certificates = CreateInspectorCertificates(insp, inspetorCertTypes);
                inspectors.Add(insp);
                firstSetupRepo.InspectorRepo.Save(insp);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Welder
            List<Welder> welders = new List<Welder>();

            for(int i = 0; i < WELDERCOUNT; i++)
            {
                var welder = new Welder
                    {
                        Grade = rnd.Next(6),
                        Name = new PersonName
                        {
                            FirstName = RndName(fNames),
                            LastName = RndName(lNames),
                            MiddleName = RndName(mNames),
                        },
                        Stamp = RndString(12),
                        Certificate = new Certificate
                        {
                            Number = RndString(14),
                            ExpirationDate = DateTime.Now.AddDays(rnd.Next(60)),
                            IsActive = true
                        },
                        IsActive = true
                    };
                welders.Add(welder);
                firstSetupRepo.WelderRepo.Save(welder);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region ComponentType
            ComponentType[] componentTypes = 
            {
                new ComponentType{Name = "Заглушка",ConnectorsCount = 1, IsActive = true},
                new ComponentType{Name = "Переходник",ConnectorsCount = 2, IsActive = true},
                new ComponentType{Name = "Т - Соединение",ConnectorsCount = 3, IsActive = true},
                new ComponentType{Name = "Тройник",ConnectorsCount = 3, IsActive = true}
            };
            foreach(var item in componentTypes)
            {
                firstSetupRepo.ComponentTypeRepo.Save(item);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Component
            List<Domain.Entity.Construction.Component> components = new List<Domain.Entity.Construction.Component>();

            foreach(var type in componentTypes)
            {
                for(int i = 0; i < COMPONENTCOUNT; i++)
                {
                    var component = CreateComponent(type);
                    firstSetupRepo.ComponentRepo.Save(component);
                    components.Add(component);
                }
            }

            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Release
            List<Prizm.Domain.Entity.Mill.ReleaseNote> releases = new List<Prizm.Domain.Entity.Mill.ReleaseNote>();
            for(int i = 0; i < RELEASECOUNT; i++)
            {
                Prizm.Domain.Entity.Mill.ReleaseNote release = new Prizm.Domain.Entity.Mill.ReleaseNote
                {
                    Number = RndString(10),
                    Shipped = false,
                    Date = DateTime.Now.AddDays(-rnd.Next(10)),
                    IsActive = true
                };
                release.Railcars = CreateRailcars(rnd.Next(2, 5));
                firstSetupRepo.ReleaseRepo.Save(release);
            }
            #endregion
            firstSetupRepo.Commit();

            return false;
        }
示例#3
0
        private bool SeedOptional()
        {
            //Required seed hasn't been performed for Master worksration type, but data are used in optional seed
            if (viewModel.Project.WorkstationType == WorkstationType.Master)
            {
                SeedRequired();
            }
            firstSetupRepo.BeginTransaction();
            #region SeamTypes
            seamTypes = new List<SeamType>
            {
                new SeamType{Name = "Бесшовный", IsActive = true, IsNative = true, Project = viewModel.Project},
                new SeamType{Name = "Прямой", IsActive = true, IsNative = true, Project = viewModel.Project},
                new SeamType{Name = "Спиралевидный", IsActive = true, IsNative = true, Project = viewModel.Project},
            };
            foreach (var item in seamTypes)
            {
                firstSetupRepo.SeemTypeRepo.Save(item);
            }
            #endregion
            firstSetupRepo.Commit();

            firstSetupRepo.BeginTransaction();
            #region InspectorCertificateTypes
            inspetorCertTypes = new List<InspectorCertificateType>
            {
                new InspectorCertificateType {Name = "Покрытия (Coating)",IsActive = true},
                new InspectorCertificateType {Name = "РК (RT)",IsActive = true},
                new InspectorCertificateType {Name = "ВИК (VT)",IsActive = true},
                new InspectorCertificateType {Name = "УК (UT)",IsActive = true},
                new InspectorCertificateType {Name = "НАКС (Welding Engineer)",IsActive = true},
                new InspectorCertificateType {Name = "МК (MT)",IsActive = true}
            };
            inspetorCertTypes.ForEach(s => firstSetupRepo.CertificateTypeRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();

            firstSetupRepo.BeginTransaction();
            #region PipeMillSyzeType
            types = new List<PipeMillSizeType>
            {
                new PipeMillSizeType
                {
                    Type = "1500 X 100500 X 50 - бесшовный",
                    IsActive = true,
                    Length = 9090,
                    Diameter = 1212,
                    Thickness = 12,
                    SeamType = seamTypes[0],
                    IsNative = true,
                    Project = viewModel.Project
                },
                new PipeMillSizeType
                {
                    Type = "1500 X 100500 X 50 - Прямой",
                    IsActive = true,
                    Length = 9090,
                    Diameter = 1212,
                    Thickness = 12,
                    SeamType = seamTypes[1],
                    IsNative = true,
                    Project = viewModel.Project
                },
            };
            types.ForEach(s => firstSetupRepo.SizeTypeRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();

            firstSetupRepo.BeginTransaction();
            #region PipeTestCategory
            categories = new List<Category>
            {
                #region creating pipe test category
                new Category { Name = "Категория - 1", Fixed = false, Type = FixedCategory.Undefined, IsActive = true},
                new Category { Name = "Категория - 2", Fixed = false, Type = FixedCategory.Undefined, IsActive = true},
                new Category { Name = "Измерение длины", IsActive = true , Fixed=true, ResultType="int", Type=FixedCategory.Length},
                new Category { Name = "Контроль сварки", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.Weld },
                new Category { Name = "Контроль внешнего покрытия", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.ExternalCoat },
                new Category { Name = "Контроль внутреннего покрытия", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.InternalCoat }
	            #endregion
            };
            foreach (var category in categories)
            {
                firstSetupRepo.CategoryRepo.Save(category);
            }
            #endregion
            firstSetupRepo.Commit();

            firstSetupRepo.BeginTransaction();
            #region PipeTest
            tests = new List<PipeTest>
            {
                #region creating pipetests for first pipe size type
                new PipeTest 
                {
                    Code = "01",
                    Name = "Входной контроль листа",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "02",
                    Name = "Сварка технологического шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "03",
                    Name = "Сварка наружного шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "04",
                    Name = "Сварка внутреннего шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "05",
                    Name = "Экспандирование",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Review,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "06",
                    Name = "Обработка торцов",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "07",
                    Name = "Гидроиспытание",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "08",
                    Name = "Рентген сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "09",
                    Name = "АУЗК сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "10",
                    Name = "РУЗК концов сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "11",
                    Name = "МПК фаски",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "12",
                    Name = "Наружный диаметр",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.Diapason,
                    MinExpected = 1217,
                    MaxExpected = 1221,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "13",
                    Name = "Длина трубы",
                    Category = categories[2],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Diapason,
                    MinExpected = 9000,
                    MaxExpected = 12400,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "21",
                    Name = "Нанесение наружного покрытия",
                    Category = categories[4],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "31",
                    Name = "Нанесение внутреннего покрытия",
                    Category = categories[5],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "41",
                    Name = "Складирование",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[0],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                }, 
	            #endregion

                #region creating pipetests for second pipe size type
                new PipeTest 
                {
                    Code = "01",
                    Name = "Входной контроль листа",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "02",
                    Name = "Сварка технологического шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "03",
                    Name = "Сварка наружного шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "04",
                    Name = "Сварка внутреннего шва",
                    Category = categories[3],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "05",
                    Name = "Экспандирование",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Review,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "06",
                    Name = "Обработка торцов",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "07",
                    Name = "Гидроиспытание",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "08",
                    Name = "Рентген сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "09",
                    Name = "АУЗК сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "10",
                    Name = "РУЗК концов сварного шва",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "11",
                    Name = "МПК фаски",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.String,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "12",
                    Name = "Наружный диаметр",
                    Category = categories[1],
                    ControlType = PipeTestControlType.Witness,
                    ResultType = PipeTestResultType.Diapason,
                    MinExpected = 1217,
                    MaxExpected = 1221,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "13",
                    Name = "Длина трубы",
                    Category = categories[2],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Diapason,
                    MinExpected = 9000,
                    MaxExpected = 12400,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "21",
                    Name = "Нанесение наружного покрытия",
                    Category = categories[4],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "31",
                    Name = "Нанесение внутреннего покрытия",
                    Category = categories[5],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                },

                new PipeTest 
                {
                    Code = "41",
                    Name = "Складирование",
                    Category = categories[0],
                    ControlType = PipeTestControlType.Monitor,
                    ResultType = PipeTestResultType.Boolean,
                    pipeType = types[1],
                    IsActive = true,
                    FrequencyType = InspectionFrequencyType.R
                } 
                #endregion
            };

            foreach (var test in tests)
            {
                firstSetupRepo.TestRepo.Save(test);
            }
            #endregion
            firstSetupRepo.Commit();

            firstSetupRepo.BeginTransaction();
            #region PlateManufacturers
            PlateManufacturer[] plateManufacturers = 
            {
                new PlateManufacturer {Name = "Алапаевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Альметьевский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Борский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Волжский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Волгоградский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Гурьевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project},
                new PlateManufacturer {Name = "Завод Точлит", IsActive = true}
            };
            Array.ForEach(plateManufacturers, s => firstSetupRepo.PlateManRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Heat
            List<Heat> heats = new List<Heat>();
            for(int i = 0; i < HEATCOUNT; i++)
            {
                heats.Add
                    (
                    new Heat ()
                    {
                        Number = RndString(8),
                        SteelGrade = RndString(6),
                        PlateManufacturer = plateManufacturers[rnd.Next(plateManufacturers.Length - 1)],
                        IsActive = true                      
                    }
                    );
                firstSetupRepo.HeatRepo.Save(heats[i]);
            }

            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region PurchaseOrder
            List<PurchaseOrder> orders = new List<PurchaseOrder>
            {
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true},
                new PurchaseOrder {Number = RndString(5),Date = DateTime.Now.AddMonths(-rnd.Next(10)),IsActive=true}
            };
            orders.ForEach(s => firstSetupRepo.PurchaseRepo.Save(s));
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region MillPipe
            List<Pipe> pipes = new List<Pipe>();
            for(int i = 0; i < PIPECOUNT; i++)
            {
                var plate = new Plate
                    {
                        Number = RndString(8),
                        Thickness = rnd.Next(2000),
                        Heat = heats[rnd.Next(heats.Count - 1)],
                        IsActive = true
                    };
                firstSetupRepo.PlateRepo.Save(plate);

                var pipe = new Pipe
                {
                    Number = RndString(8),
                    Plate = plate,
                    Mill = viewModel.MillName,
                    Diameter = types[0].Diameter,
                    WallThickness = types[0].Thickness,
                    Type = types[rnd.Next(1)],
                    PurchaseOrder = orders[orders.Count - 1],
                    Project = viewModel.Project,
                    Status = PipeMillStatus.Produced,
                    ProductionDate = DateTime.Now.AddDays(-rnd.Next(20)),
                    IsActive = true
                };
                pipe.RecalculateWeight();

                var results = new List<PipeTestResult>();
                foreach(var item in tests.Where(x => x.pipeType == pipe.Type))
                {
                    var testResult = new PipeTestResult
                    {
                        Operation = item,
                        Pipe = pipe,
                        Status = PipeTestResultStatus.Scheduled
                    };
                    results.Add(testResult);
                    firstSetupRepo.PipeTestResultRepo.Save(testResult);
                }
                pipe.PipeTestResult = results;
                pipes.Add(pipe);
                if(pipes.Count % 2 == 0)
                {
                    foreach(var item in pipe.PipeTestResult)
                    {
                        item.Status = PipeTestResultStatus.Accepted;
                        if(item.Operation.Category.Type == FixedCategory.Length)
                        {
                            item.Value = PIPELENGHT.ToString();
                        }
                    }
                    pipe.Length = PIPELENGHT;
                    pipe.Status = PipeMillStatus.Stocked;
                    pipe.ConstructionStatus = PartConstructionStatus.Pending;
                    pipe.IsAvailableToJoint = true;
                    pipe.ToExport = true;
                    pipe.WallThickness = 12;
                    pipe.RecalculateWeight();

                }


                firstSetupRepo.PipeRepo.Save(pipe);
            };
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Inspector
            List<Inspector> inspectors = new List<Inspector>();
            for(int i = 0; i < INSPECTORCOUNT; i++)
            {
                var insp = new Inspector
                    {
                        Name = new PersonName
                        {
                            FirstName = RndName(fNames),
                            LastName = RndName(lNames),
                            MiddleName = RndName(mNames),
                        },
                        IsActive = true
                    };
                insp.Certificates = CreateInspectorCertificates(insp, inspetorCertTypes);
                inspectors.Add(insp);
                firstSetupRepo.InspectorRepo.Save(insp);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Welder
            List<Welder> welders = new List<Welder>();

            for(int i = 0; i < WELDERCOUNT; i++)
            {
                var welder = new Welder
                    {
                        Grade = rnd.Next(6),
                        Name = new PersonName
                        {
                            FirstName = RndName(fNames),
                            LastName = RndName(lNames),
                            MiddleName = RndName(mNames),
                        },
                        Stamp = RndString(12),
                        Certificate = new Certificate
                        {
                            Number = RndString(14),
                            ExpirationDate = DateTime.Now.AddDays(rnd.Next(60)),
                            IsActive = true
                        },
                        IsActive = true
                    };
                welders.Add(welder);
                firstSetupRepo.WelderRepo.Save(welder);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region ComponentType
            ComponentType[] componentTypes = 
            {
                new ComponentType{Name = "Заглушка",ConnectorsCount = 1, IsActive = true},
                new ComponentType{Name = "Переходник",ConnectorsCount = 2, IsActive = true},
                new ComponentType{Name = "Т - Соединение",ConnectorsCount = 3, IsActive = true},
                new ComponentType{Name = "Тройник",ConnectorsCount = 3, IsActive = true}
            };
            foreach(var item in componentTypes)
            {
                firstSetupRepo.ComponentTypeRepo.Save(item);
            }
            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Component
            List<Domain.Entity.Construction.Component> components = new List<Domain.Entity.Construction.Component>();

            foreach(var type in componentTypes)
            {
                for(int i = 0; i < COMPONENTCOUNT; i++)
                {
                    var component = CreateComponent(type);
                    firstSetupRepo.ComponentRepo.Save(component);
                    components.Add(component);
                }
            }

            #endregion
            firstSetupRepo.Commit();
            firstSetupRepo.BeginTransaction();
            #region Release
            List<Prizm.Domain.Entity.Mill.ReleaseNote> releases = new List<Prizm.Domain.Entity.Mill.ReleaseNote>();
            for(int i = 0; i < RELEASECOUNT; i++)
            {
                Prizm.Domain.Entity.Mill.ReleaseNote release = new Prizm.Domain.Entity.Mill.ReleaseNote
                {
                    Number = RndString(10),
                    Shipped = false,
                    Date = DateTime.Now.AddDays(-rnd.Next(10)),
                    IsActive = true
                };
                release.Railcars = CreateRailcars(rnd.Next(2, 5));
                firstSetupRepo.ReleaseRepo.Save(release);
            }
            #endregion
            firstSetupRepo.Commit();

            return false;
        }