Beispiel #1
0
        private void controlOperationsView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView        gv = sender as GridView;
            JointTestResult jointTestResult = gv.GetRow(e.RowHandle) as JointTestResult;

            if (jointTestResult.Operation == null)
            {
                gv.SetColumnError(controlTypeGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired));
                e.Valid = false;
            }
            if (jointTestResult.Date == null)
            {
                gv.SetColumnError(controlDateGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired));
                e.Valid = false;
            }
            if (jointTestResult.Inspectors.Count == 0)
            {
                gv.SetColumnError(inspectorsGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired));
                e.Valid = false;
            }
            if (jointTestResult.Status == 0)
            {
                gv.SetColumnError(resultGridColumn, Program.LanguageManager.GetString(StringResources.Validation_ValueRequired));
                e.Valid = false;
            }
        }
Beispiel #2
0
        private void resultStatusLookUpEdit_QueryPopUp(object sender, CancelEventArgs e)
        {
            if (controlOperationsView.IsValidRowHandle(controlOperationsView.FocusedRowHandle))
            {
                availableResults.Clear();
                JointTestResult jointTestResult = controlOperationsView.GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;
                if (jointTestResult != null && jointTestResult.Operation != null)
                {
                    if (jointTestResult.Operation.TestHasAccepted)
                    {
                        availableResults.Add((localizedResults[(int)JointTestResultStatus.Accepted - 1]));
                    }

                    if (jointTestResult.Operation.TestHasToRepair)
                    {
                        availableResults.Add((localizedResults[(int)JointTestResultStatus.Repair - 1]));
                    }

                    if (jointTestResult.Operation.TestHasToWithdraw)
                    {
                        availableResults.Add((localizedResults[(int)JointTestResultStatus.Withdraw - 1]));
                    }

                    resultStatusLookUpEdit.DataSource = availableResults;
                }
            }
        }
Beispiel #3
0
        private void resultStatusLookUpEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
        {
            if (e.Value == null)
            {
                e.DisplayText = string.Empty;
            }
            if (controlOperationsView.IsValidRowHandle(controlOperationsView.FocusedRowHandle))
            {
                JointTestResult jointTestResult = controlOperationsView.GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;
                if (jointTestResult != null && jointTestResult.Operation != null)
                {
                    availableResults.Clear();

                    if (jointTestResult.Operation.TestHasAccepted)
                    {
                        availableResults.Add(new EnumWrapper <JointTestResultStatus>(JointTestResultStatus.Accepted));
                    }

                    if (jointTestResult.Operation.TestHasToRepair)
                    {
                        availableResults.Add(new EnumWrapper <JointTestResultStatus>(JointTestResultStatus.Repair));
                    }

                    if (jointTestResult.Operation.TestHasToWithdraw)
                    {
                        availableResults.Add(new EnumWrapper <JointTestResultStatus>(JointTestResultStatus.Withdraw));
                    }

                    resultStatusLookUpEdit.DataSource = availableResults;
                }
            }
        }
Beispiel #4
0
 private void inspectorsPopupContainerEdit_Popup(object sender, EventArgs e)
 {
     controlOperationsView.ClearSelection();
     if (controlOperationsView.IsValidRowHandle(controlOperationsView.FocusedRowHandle))
     {
         JointTestResult jointTestResult = controlOperationsView.GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;
         if (jointTestResult != null)
         {
             inspectorSelectionControl.SelectInspectors(jointTestResult.Inspectors);
         }
     }
 }
Beispiel #5
0
        private void controlOperationsView_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.IsValidRowHandle(e.RowHandle))
            {
                currentJointTestResult          = view.GetRow(e.RowHandle) as JointTestResult;
                currentJointTestResult.IsActive = true;
                currentJointTestResult.Joint    = viewModel.Joint;
                viewModel.Joint.JointTestResults.Add(currentJointTestResult);
            }
        }
Beispiel #6
0
 private void inspectorsPopupContainerEdit_CloseUp(object sender, CloseUpEventArgs e)
 {
     if (controlOperationsView.IsValidRowHandle(controlOperationsView.FocusedRowHandle))
     {
         IList <Inspector> selectedInspectors = inspectorSelectionControl.SelectedInspectors;
         JointTestResult   jointTestResult    = controlOperationsView.GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;
         if (jointTestResult != null)
         {
             jointTestResult.Inspectors.Clear();
             foreach (Inspector i in selectedInspectors)
             {
                 jointTestResult.Inspectors.Add(i);
             }
         }
     }
 }
Beispiel #7
0
        private void resultStatusLookUpEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
        {
            JointTestResult jointTestResult = controlOperationsView.GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;

            if (e.Value != null)
            {
                JointTestResultStatus result;
                if (Enum.TryParse <JointTestResultStatus>(e.Value.ToString(), out result))
                {
                    e.DisplayText = (result == JointTestResultStatus.Undefined) ? "" : localizedResults[(int)result - 1];
                }
            }
            else
            {
                e.DisplayText = string.Empty;
            }
        }
Beispiel #8
0
        private void inspectorsPopupContainerEdit_QueryPopUp(object sender, CancelEventArgs e)
        {
            JointTestResult jointTestResult
                = controlOperationsView
                  .GetRow(controlOperationsView.FocusedRowHandle) as JointTestResult;

            if (jointTestResult == null || (jointTestResult != null && jointTestResult.Date == null))
            {
                controlOperationsView.SetColumnError(
                    inspectionsGridView.VisibleColumns[2],
                    Program.LanguageManager.GetString(StringResources.DateFirst));
                e.Cancel = true;
            }
            else
            {
                inspectorSelectionControl.inspectionDate = jointTestResult.Date;
            }
        }
Beispiel #9
0
        private void controlOperationsView_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.IsValidRowHandle(e.RowHandle))
            {
                currentJointTestResult          = view.GetRow(e.RowHandle) as JointTestResult;
                currentJointTestResult.IsActive = true;
                currentJointTestResult.Joint    = viewModel.Joint;
                if (viewModel.Joint.JointTestResults.Count() == 0)
                {
                    currentJointTestResult.Order = 0;
                }
                else
                {
                    currentJointTestResult.Order = viewModel.Joint.JointTestResults.Max(test => test.Order) + 1;
                }
                viewModel.Joint.JointTestResults.Add(currentJointTestResult);
            }
        }
Beispiel #10
0
        public IList <Joint> GetJointsForTracing()
        {
            try
            {
                JointWeldResult weldResult = null;
                JointTestResult testResult = null;
                List <Welder>   welders    = null;

                return
                    (session.QueryOver <Joint>()
                     .Where(x => x.IsActive == true && x.FirstElement != null && x.SecondElement != null && x.Status != JointStatus.Withdrawn)
                     .JoinAlias(j => j.JointWeldResults, () => weldResult, JoinType.LeftOuterJoin)
                     .JoinAlias(() => weldResult.Welders, () => welders, JoinType.LeftOuterJoin)
                     .JoinAlias(j => j.JointTestResults, () => testResult, JoinType.LeftOuterJoin)
                     .TransformUsing(Transformers.DistinctRootEntity)
                     .List <Joint>());
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("GetJointsForTracing", ex);
            }
        }
 private void controlOperationsView_InitNewRow(object sender, InitNewRowEventArgs e)
 {
     GridView view = sender as GridView;
     if(view.IsValidRowHandle(e.RowHandle))
     {
         currentJointTestResult = view.GetRow(e.RowHandle) as JointTestResult;
         currentJointTestResult.IsActive = true;
         currentJointTestResult.Joint = viewModel.Joint;
         if (viewModel.Joint.JointTestResults.Count() == 0)
         {
             currentJointTestResult.Order = 0;
         }
         else
         {
             currentJointTestResult.Order = viewModel.Joint.JointTestResults.Max(test => test.Order) + 1;
         }
         viewModel.Joint.JointTestResults.Add(currentJointTestResult);
     }
 }