Beispiel #1
0
        public override void Delete()
        {
            try
            {
                m_WorkPointCommonFunctions = new WorkPointCommonFunctions(ActiveKeyObject, DataContext);
                m_gTActiveComponent        = GetActiveComponent();
                m_WorkPointCommonFunctions.m_gTActiveComponent = m_gTActiveComponent;
                m_WorkPointCommonFunctions.m_gTComponents      = Components;

                if ((m_gTActiveComponent != null) && (m_gTActiveComponent.CNO == 21 || m_gTActiveComponent.CNO == 22))
                {
                    DeleteWorkpointCUInstace();

                    if (m_gTActiveComponent.CNO == 22)
                    {
                        SetAncillaryAttribute();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error during execution of Accounting Impact FI." + Environment.NewLine + ex.Message,
                                "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = null;
            ErrorMessageArray  = null;

            if (string.IsNullOrEmpty(DataContext.ActiveJob))
            {
                return;
            }
            if (IsCorrectionJob())
            {
                return;
            }
            if (IsFeatureOwnedToPrimarySwitchGear(Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fid"].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fno"].Value)))
            {
                return;
            }
            if (!IsFeatureEdited(Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fid"].Value)))
            {
                return;
            }

            m_WorkPointCommonFunctions = new WorkPointCommonFunctions(ActiveKeyObject, DataContext);

            List <string> m_lstErrorMessage  = new List <string>();
            List <string> m_lstErrorPriority = new List <string>();

            int          FID  = 0;
            IGTComponent comp = Components[ComponentName];


            string             fieldValue         = string.Empty;
            GTValidationLogger gTValidationLogger = null;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Accounting Impact",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Accounting Impact Entry", "N/A", "");
            }

            try
            {
                //    //Features in the state CLS, OSR, OSA, or LIP do not require Validation as they interfere with the WMIS closure batch process
                if (!IsValidFeatureState())
                {
                    if (gTValidationLogger != null)
                    {
                        gTValidationLogger.LogEntry("TIMING", "END", "Accounting Impact Exit", "N/A", "");
                    }
                    return;
                }

                string errorPriorityNoWorkpoint         = Convert.ToString(Arguments.GetArgument(0));
                string errorPriorityNoMatchingWorkPoint = Convert.ToString(Arguments.GetArgument(0));

                m_gTActiveComponent = GetActiveComponent();

                m_WorkPointCommonFunctions.m_gTActiveComponent = m_gTActiveComponent;
                m_WorkPointCommonFunctions.m_gTComponents      = Components;

                if ((m_gTActiveComponent != null) && (m_gTActiveComponent.CNO == 21 || m_gTActiveComponent.CNO == 22))
                {
                    ValidateFeature(errorPriorityNoWorkpoint, errorPriorityNoMatchingWorkPoint, ref m_lstErrorMessage, ref m_lstErrorPriority);

                    if (m_lstErrorMessage.Count > 0)
                    {
                        ErrorMessageArray  = m_lstErrorMessage.ToArray();
                        ErrorPriorityArray = m_lstErrorPriority.ToArray();
                    }
                }
                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Accounting Impact Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                if (null != ex.InnerException && "MULTIPLE WORKPOINTS" == ex.InnerException.Message)
                {
                    ErrorPriorityArray    = new string[1];
                    ErrorMessageArray     = new string[1];
                    ErrorMessageArray[0]  = ex.Message;
                    ErrorPriorityArray[0] = "P1";
                }
                else
                {
                    throw new Exception("Error during execution of Accounting Impact FI." + Environment.NewLine + ex.Message);
                }
            }
        }