상속: System.Item
예제 #1
0
        public virtual PipeMillSizeType Clone()
        {
            PipeMillSizeType clone = new PipeMillSizeType();
            var tests = new List <PipeTest>();

            foreach (var item in this.PipeTests)
            {
                tests.Add(new PipeTest()
                {
                    Category       = item.Category,
                    Code           = item.Code,
                    Name           = item.Name,
                    MinExpected    = item.MinExpected,
                    MaxExpected    = item.MaxExpected,
                    StringExpected = item.StringExpected,
                    BoolExpected   = item.BoolExpected,
                    IsRequired     = item.IsRequired,
                    pipeType       = clone,
                    ControlType    = item.ControlType,
                    ResultType     = item.ResultType,
                    IsActive       = item.IsActive
                });
            }

            clone.Type      = this.Type + " Copy";
            clone.PipeTests = new BindingList <PipeTest>(tests);
            clone.IsActive  = this.IsActive;
            clone.Diameter  = this.Diameter;
            clone.Thickness = this.Thickness;
            clone.Length    = this.Length;
            clone.SeamType  = this.SeamType;

            return(clone);
        }
예제 #2
0
 public SizeTypeObject(PipeMillSizeType sizeType)
 {
    this.Id = sizeType.Id;
    this.IsActive = sizeType.IsActive;
    this.Type = sizeType.Type;
    this.Length = sizeType.Length;
    this.Diameter = sizeType.Diameter;
    this.Thickness = sizeType.Thickness;
    this.SeamType = sizeType.SeamType;
    this.Project = sizeType.Project;
 }
예제 #3
0
        private void pipeSize_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxEdit cb = sender as ComboBoxEdit;

            Prizm.Domain.Entity.Setup.PipeMillSizeType currentPipeType
                = cb.SelectedItem as Prizm.Domain.Entity.Setup.PipeMillSizeType;
            RefreshPipeTest(currentPipeType);

            if (currentPipeType != null)
            {
                viewModel.CurrentType = currentPipeType;
            }
        }
예제 #4
0
        public virtual PipeMillSizeType Clone()
        {
            PipeMillSizeType clone = new PipeMillSizeType();
            var tests = new List<PipeTest>();

            foreach(var item in this.PipeTests)
            {
                tests.Add(new PipeTest()
                {
                    Category = item.Category,
                    Code = item.Code,
                    Name = item.Name,
                    MinExpected = item.MinExpected,
                    MaxExpected = item.MaxExpected,
                    StringExpected = item.StringExpected,
                    BoolExpected = item.BoolExpected,
                    FrequencyType = item.FrequencyType,
                    pipeType = clone,
                    ControlType = item.ControlType,
                    ResultType = item.ResultType,
                    IsActive = item.IsActive
                });
            }

            clone.Type = this.Type + " Copy";
            clone.PipeTests = new BindingList<PipeTest>(tests);
            clone.IsActive = this.IsActive;
            clone.Diameter = this.Diameter;
            clone.Thickness = this.Thickness;
            clone.Length = this.Length;
            clone.SeamType = this.SeamType;
            clone.IsNative = this.IsNative;
            clone.Project = this.Project;

            return clone;
        }
예제 #5
0
        private void pipesSizeListGridView_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            viewModel.ModifiableView.UpdateState();
            GridView v = sender as GridView;
            CurrentPipeMillSizeType = v.GetRow(e.RowHandle) as PipeMillSizeType;
            CurrentPipeMillSizeType.IsActive = true;
            CurrentPipeMillSizeType.IsNative = true;
            CurrentPipeMillSizeType.Project = viewModel.CurrentProjectSettings;
            CurrentPipeMillSizeType.SeamType = new SeamType() { IsNative = true, Project = viewModel.CurrentProjectSettings };

            if (CurrentPipeMillSizeType != null)
            {
                viewModel.UpdatePipeTests(CurrentPipeMillSizeType);
            }

            foreach (Prizm.Domain.Entity.Mill.Category c in viewModel.CategoryTypes)
            {
                if (c.Fixed && c.Type == FixedCategory.Length)
                {
                    CurrentPipeMillSizeType.PipeTests.Add(new PipeTest { Category = c, ResultType = PipeTestResultType.Diapason, pipeType = CurrentPipeMillSizeType, FrequencyType = InspectionFrequencyType.R });
                }
            }
        }
예제 #6
0
        private void pipesSizeListGridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            //save previous IsModified state
            bool wasModified = IsModified;
            GridView view = sender as GridView;
            object sizeType = view.GetRow(view.FocusedRowHandle);

            var eArg = new DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs(
                             view.FocusedRowHandle,
                              pipesSizeListGridView.GetDataRow(view.FocusedRowHandle)
                       );
            pipesSizeListGridView_ValidateRow(pipesSizeListGridView, eArg);

            if (sizeType != null)
            {
                viewModel.UpdatePipeTests(sizeType);
            }

            CurrentPipeMillSizeType = sizeType as PipeMillSizeType;
            viewModel.CurrentPipeMillSizeType = CurrentPipeMillSizeType;
            viewModel.ModifiableView.UpdateState();
            // IsModified state depends on previous state despite all properties were changed (prevent *)
            IsModified = (wasModified) ? true : false;
        }
 /// <summary>
 /// Creates predefined pipe test result for all active required availableTests for concrete pipe mill size type
 /// </summary>
 /// <param name="millSizeType"></param>
 public BindingList<PipeTestResult> GetRequired(PipeMillSizeType millSizeType)
 {
     BindingList<PipeTestResult> requiredTestResults = new BindingList<PipeTestResult>();
     var criteria = NHibernate.Criterion.DetachedCriteria
         .For<PipeTest>()
         .Add(Restrictions.Eq("FrequencyType", InspectionFrequencyType.R))
         .Add(Restrictions.Eq("pipeType", millSizeType))
         .Add(Restrictions.Eq("IsActive", true));
     IList<PipeTest> requiredTests = repoMill.RepoPipeTest.GetByCriteria(criteria);
     GetAvailableTests();
     foreach(var requiredTest in requiredTests)
     {
         PipeTestResult requiredResult = new PipeTestResult()
         {
             Operation = requiredTest,
             IsActive = true,
             Status = PipeTestResultStatus.Scheduled,
             Pipe = Pipe,
             Inspectors = new BindingList<Prizm.Domain.Entity.Inspector>()
         };
         requiredTestResults.Add(requiredResult);
         requiredResult.Order++;
     }
     return requiredTestResults;
 }
        public void NewPipe()
        {
            try
            {
                currentType = new PipeMillSizeType() { IsNative = true, Project = this.Project };
                extractPurchaseOrderCommand.Execute();
                extractHeatsCommand.Execute();
                extractPipeTypeCommand.Execute();

                this.Pipe = new Pipe();
                this.PipePurchaseOrder = null;
                this.Heat = null;
                this.PlateNumber = string.Empty;
                this.Pipe.IsActive = true;
                this.Pipe.IsAvailableToJoint = true;
                this.Pipe.Status = PipeMillStatus.Produced;
                this.Pipe.ConstructionStatus = Domain.Entity.Construction.PartConstructionStatus.Pending;
                this.Pipe.InspectionStatus = Domain.Entity.Construction.PartInspectionStatus.Pending;
                this.Pipe.Project = repoMill.RepoProject.GetSingle();

                this.Number = string.Empty;
                this.Mill = string.Empty;

                this.WallThickness = 0;
                this.Weight = 0;
                this.Length = 0;
                this.Diameter = 0;
                this.PipeTestResults = new BindingList<PipeTestResult>();
                if(this.FilesFormViewModel != null)
                {
                    this.FilesFormViewModel.Files = null;
                }
                this.Pipe.Mill = mill;
                this.Pipe.ToExport = false;

                PipeNotifier = NotificationService.Instance.NotRequiredOperationManager.CreateNotifier(Pipe);
                SelectiveOperationPipeNotifier = NotificationService.Instance.SelectiveOperationManager.CreateNotifier(Pipe);
            }
            catch(RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
                notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
            Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
            }
        }
        /// <summary>
        ///Refreshes list of required pipe test 
        /// </summary>
        private void RefreshPipeTest(PipeMillSizeType currentPipeType)
        {
            if(currentPipeType != null && viewModel.Pipe.Type != currentPipeType)
            {
                viewModel.PipeMillSizeType = currentPipeType;
                viewModel.PipeTestResults = viewModel.GetRequired(currentPipeType);
                viewModel.Pipe.PipeTestResult = viewModel.PipeTestResults;
                inspectionCodeLookUpEdit.DataSource = viewModel.AvailableTests;
                viewModel.listOfInspectors = new List<KeyValuePair<string, object>>();
                inspections.RefreshDataSource();
            }

            viewModel.PipeMillSizeType = pipeSize.SelectedItem as PipeMillSizeType;

            commandManager.RefreshVisualState();
        }
예제 #10
0
        public void TestSaveSettings()
        {
            var notify = new Mock<IUserNotify>();

            var repoPipeSize = new Mock<IMillPipeSizeTypeRepository>();
            var repoPipeTests = new Mock<IPipeTestRepository>();
            var repoWelders = new Mock<IWelderRepository>();
            var repoInspectors = new Mock<IInspectorRepository>();
            var repoManufacturers = new Mock<IPlateManufacturerRepository>();
            var repoProjectSetting = new Mock<IProjectRepository>();
            var repoUsers = new Mock<IUserRepository>();
            var repoRoles = new Mock<IRoleRepository>();
            var repoPerms = new Mock<IPermissionRepository>();
            var repoCategory = new Mock<ICategoryRepository>();
            var repoJointOperation = new Mock<IJointOperationRepository>();
            var repoCertificateType = new Mock<ICertificateTypeRepository>();
            var repoComponentType = new Mock<IComponentTypeRepository>();
            var repoSeamType = new Mock<ISeamTypeRepository>();

            var testProjectSetting = new Project() { IsNative = true};
            var testSizeType = new PipeMillSizeType() 
            { 
                IsNative = true, 
                Project = testProjectSetting,
                Diameter = 10,
                Thickness = 5,
                SeamType = new SeamType(),
                Length = 20,
            };
            foreach (PipeTest t in testSizeType.PipeTests)
            {
                t.Code = "Code";
                t.Name = "Name";
                t.ControlType = PipeTestControlType.Monitor;
                t.ResultType = PipeTestResultType.Boolean;
            }
            var testWelder = new Welder() { Certificate = new Certificate() { ExpirationDate = DateTime.Now} };
            var testManufacturer = new PlateManufacturer() { IsNative = true, Project = testProjectSetting};
            var testInspector = new Inspector();
            var testUser = new User();
            var testRole = new Role();
            var testPerm = new Permission() { Name = "CreateJoint" };
            var modifiableView = new Mock<IModifiable>();
            var jointOperations = new JointOperation();
            var ctx = new Mock<ISecurityContext>();

            repoPipeSize.Setup(_ => _.GetAll()).Returns(new List<PipeMillSizeType>() { testSizeType });
            repoWelders.Setup(_ => _.GetAll()).Returns(new List<Welder>() { testWelder });
            repoManufacturers.Setup(_ => _.GetAll()).Returns(new List<PlateManufacturer>() { testManufacturer });
            repoProjectSetting.Setup(_ => _.GetSingle()).Returns(testProjectSetting);
            repoInspectors.Setup(_ => _.GetAll()).Returns(new List<Inspector>() { testInspector });
            repoUsers.Setup(_ => _.GetAll()).Returns(new List<User>() { testUser });
            repoRoles.Setup(_ => _.GetAll()).Returns(new List<Role>() { testRole });
            repoPerms.Setup(_ => _.GetAll()).Returns(new List<Permission>() { testPerm });
            repoJointOperation.Setup(_ => _.GetAll()).Returns(new List<JointOperation>() { jointOperations });
            repoCategory.Setup(x => x.GetAll()).Returns(new List<Category>() { new Category() });
            repoCertificateType.Setup(x => x.GetAll()).Returns(new List<InspectorCertificateType>() { new InspectorCertificateType() });
            repoComponentType.Setup(x => x.GetAll()).Returns(new List<ComponentType>() { new ComponentType() });


            Mock<ISettingsRepositories> settingsRepos = new Mock<ISettingsRepositories>();
            settingsRepos.SetupGet(_ => _.PipeSizeTypeRepo).Returns(repoPipeSize.Object);
            settingsRepos.SetupGet(_ => _.PipeTestRepo).Returns(repoPipeTests.Object);
            settingsRepos.SetupGet(_ => _.WelderRepo).Returns(repoWelders.Object);
            settingsRepos.SetupGet(_ => _.PlateManufacturerRepo).Returns(repoManufacturers.Object);
            settingsRepos.SetupGet(_ => _.ProjectRepo).Returns(repoProjectSetting.Object);
            settingsRepos.SetupGet(_ => _.InspectorRepo).Returns(repoInspectors.Object);
            settingsRepos.SetupGet(_ => _.UserRepo).Returns(repoUsers.Object);
            settingsRepos.SetupGet(_ => _.RoleRepo).Returns(repoRoles.Object);
            settingsRepos.SetupGet(_ => _.PermissionRepo).Returns(repoPerms.Object);
            settingsRepos.SetupGet(_ => _.JointRepo).Returns(repoJointOperation.Object);
            settingsRepos.SetupGet(x => x.СategoryRepo).Returns(repoCategory.Object);
            settingsRepos.SetupGet(x => x.CertificateTypeRepo).Returns(repoCertificateType.Object);
            settingsRepos.SetupGet(x => x.ComponentTypeRepo).Returns(repoComponentType.Object);
            settingsRepos.SetupGet(x => x.SeamTypeRepo).Returns(repoSeamType.Object);

            var viewModel = new SettingsViewModel(settingsRepos.Object, notify.Object, ctx.Object);
            viewModel.ModifiableView = modifiableView.Object;
            viewModel.LoadData();
            viewModel.ModifiableView = modifiableView.Object;
            var validatable = new Mock<IValidatable>();
            validatable.Setup(x => x.Validate()).Returns(true);
            viewModel.validatableView = validatable.Object;

            var command = new SaveSettingsCommand(viewModel, settingsRepos.Object, notify.Object, ctx.Object);

            command.Execute();

            settingsRepos.Verify(_ => _.BeginTransaction(), Times.Once());
            repoPipeSize.Verify(_ => _.SaveOrUpdate(testSizeType), Times.Once());
            settingsRepos.Verify(_ => _.Commit(), Times.Once());
            repoPipeSize.Verify(_ => _.Evict(testSizeType), Times.Once());
            repoWelders.Verify(_ => _.SaveOrUpdate(testWelder), Times.Once());
            repoWelders.Verify(_ => _.Evict(testWelder), Times.Once());
            repoManufacturers.Verify(_ => _.SaveOrUpdate(testManufacturer), Times.Once());
            repoManufacturers.Verify(_ => _.Evict(testManufacturer), Times.Once());
            repoProjectSetting.Verify(_ => _.SaveOrUpdate(testProjectSetting), Times.Once());
            repoProjectSetting.Verify(_ => _.Evict(testProjectSetting), Times.Once());
            repoInspectors.Verify(_ => _.SaveOrUpdate(testInspector), Times.Once());
            repoInspectors.Verify(_ => _.Evict(testInspector), Times.Once());
            repoUsers.Verify(_ => _.SaveOrUpdate(testUser), Times.Once());
            repoUsers.Verify(_ => _.Evict(testUser), Times.Once());
            repoRoles.Verify(_ => _.SaveOrUpdate(testRole), Times.Once());
            repoRoles.Verify(_ => _.Evict(testRole), Times.Once());
        }