Exemple #1
0
        private void ControlOperationLookUpEdit_EditValueChanged(object sender, EventArgs e)
        {
            LookUpEdit     q   = sender as LookUpEdit;
            object         row = q.Properties.GetDataSourceRowByKeyValue(q.EditValue);
            JointOperation selectedOperation = q.Properties.GetDataSourceRowByKeyValue(q.EditValue) as JointOperation;

            if (selectedOperation != null)
            {
                currentJointTestResult.Operation = selectedOperation;
            }
        }
Exemple #2
0
        /// <summary>
        /// Disables the ability to edit welders list when not Welding operation is selected
        /// </summary>
        private void repairOperationsView_ShowingEditor(object sender, CancelEventArgs e)
        {
            GridView       view = sender as GridView;
            JointOperation selectedOperation = repairOperationsLookUpEdit.GetDataSourceRowByDisplayValue(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["Operation.Name"])) as JointOperation;

            if (selectedOperation != null &&
                selectedOperation.Type != JointOperationType.Weld &&
                selectedOperation.Type != JointOperationType.Withdraw &&
                view.FocusedColumn.Name == weldersGridColumn.Name ||
                !viewModel.IsNotWithdrawn)
            {
                e.Cancel = true;
            }
        }
Exemple #3
0
        /// <summary>
        /// Assigns to current ActionWeldResult selected operation. If operation is not Weld,  ActionWeldResult is created with empty Welders list
        /// </summary>
        private void RepairOperationsLookUpEdit_EditValueChanged(object sender, EventArgs e)
        {
            LookUpEdit     q   = sender as LookUpEdit;
            object         row = q.Properties.GetDataSourceRowByKeyValue(q.EditValue);
            JointOperation selectedOperationWeld = q.Properties.GetDataSourceRowByKeyValue(q.EditValue) as JointOperation;

            if (selectedOperationWeld != null)
            {
                currentJointWeldResult.Operation = selectedOperationWeld;
                if (selectedOperationWeld.Type != JointOperationType.Weld)
                {
                    currentJointWeldResult.Welders = new BindingList <Welder>();
                }
            }
        }
        /// <summary>
        /// Updating the model's animation 
        /// </summary>
        /// <param name="gameTime"></param>
        public override void update(bool PlayClip)
        {
            // Tell the animation player to compute the latest bone transform matrices.
            animationPlayer.UpdateBoneTransforms(GameEngine.CurrentGameTime.ElapsedGameTime, PlayClip);

            // Copy the transforms into our own array, so we can safely modify the values.
            animationPlayer.GetBoneTransforms().CopyTo(BoneTransformTemp, 0);

            while (!(JointOps.Count == 0))
            {
                j = JointOps.Dequeue();
                BoneTransformTemp[j.JointIndex] = j.ChangeMat * BoneTransformTemp[j.JointIndex];
            }

            // Tell the animation player to recompute the world and skin matrices.
            animationPlayer.UpdateWorldTransforms(mMatWorld, BoneTransformTemp);
            animationPlayer.UpdateSkinTransforms();
        }
Exemple #5
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();
            var testWelder       = new Welder();
            var testManufacturer = new PlateManufacturer();
            var testInspector    = new Inspector();
            var testUser         = new User();
            var testRole         = new Role();
            var testPerm         = new Permission();
            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());
        }
Exemple #6
0
        private bool SeedRequired()
        {
            try
            {
                firstSetupRepo.BeginTransaction();
                #region PipeTestCategory

                Category category = new Category {
                    Name = "Измерение длины", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.Length
                };
                firstSetupRepo.CategoryRepo.Save(category);

                #endregion
                firstSetupRepo.Commit();


                firstSetupRepo.BeginTransaction();
                #region Joint weld operation

                JointOperation weldOperation = new JointOperation()
                {
                    IsActive   = true,
                    IsRequired = true,
                    Type       = JointOperationType.Weld,
                    Name       = "Сварка стыка"
                };
                firstSetupRepo.JointOperationRepo.Save(weldOperation);

                #endregion
                firstSetupRepo.Commit();

                #region --- CannedMessage ---

                try
                {
                    string   fileName = Path.Combine(Directories.Seeding, "defectList.txt");
                    string[] lines    = System.IO.File.ReadAllLines(fileName, Encoding.Default);

                    var cannedMessageList = new List <CannedMessage>(lines.Length);

                    for (int i = 0; i < lines.LongLength; ++i)
                    {
                        string[] tmp = lines[i].Split('\t');

                        cannedMessageList.Add(new CannedMessage {
                            Language = tmp[0], IdDefect = tmp[1], Text = tmp[2]
                        });
                    }

                    firstSetupRepo.BeginTransaction();
                    cannedMessageList.ForEach(s => firstSetupRepo.CannedMessageRepo.Save(s));
                    firstSetupRepo.Commit();
                    cannedMessageList.ForEach(s => firstSetupRepo.CannedMessageRepo.Evict(s));
                }
                catch (Exception e)
                {
                    log.Warn(string.Format("The file specified in path was not found or path is in an invalid format: {0}", e.Message));
                }

                #endregion // --- CannedMessage ---
            }
            catch (RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
            }
            return(false);
        }