Beispiel #1
0
        public Dictionary <IGTKeyObject, IGTComponents> GetOwnedFeatureCollection()
        {
            Dictionary <IGTKeyObject, IGTComponents> oReturnCollection = new Dictionary <IGTKeyObject, IGTComponents>();
            IGTJobManagementService oJobManagement = GTClassFactory.Create <IGTJobManagementService>();

            try
            {
                oJobManagement.DataContext = m_oApp.DataContext;

                IGTKeyObjects   oRelatedFeatures = GetRelatedFeaturesAtStructure(m_StructureKeyObject);
                ADODB.Recordset rs = oJobManagement.FindPendingEdits();

                if (rs != null && rs.RecordCount > 0)
                {
                    Features oFeatureCollection = new Features(oRelatedFeatures);
                    oReturnCollection = oFeatureCollection.GetFeatureComponentCollection();
                }
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }


            return(oReturnCollection);
        }
Beispiel #2
0
        /// <summary>
        /// True if conflicts exist; else, false
        /// </summary>
        public bool ConflictsExist()
        {
            try
            {
                bool retVal = false;

                IGTApplication          app        = GTClassFactory.Create <IGTApplication>();
                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                Recordset rs = jobService.FindConflicts();
                if (null != rs && 0 < rs.RecordCount)
                {
                    MessageBox.Show("Some edits conflict with other posted jobs; please run Conflict Detection to resolve before marking for closure.", "G /Technology", MessageBoxButtons.OK);
                    retVal = true;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Activates the specified job
        /// </summary>
        /// <param name="JobName">Job to activate.</param>
        public void ActivateJob(string JobName)
        {
            IGTJobManagementService jms = GTClassFactory.Create <IGTJobManagementService>();

            jms.DataContext = app.DataContext;
            jms.EditJob(JobName);
        }
Beispiel #4
0
        private bool IsFeatureEdited(int p_FID)
        {
            bool bReturn = false;
            IGTJobManagementService oJobSrv = GTClassFactory.Create <IGTJobManagementService>();

            oJobSrv.DataContext = DataContext;
            ADODB.Recordset rs = oJobSrv.FindPendingEdits();

            if (rs != null)
            {
                if (rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    while (rs.EOF == false)
                    {
                        if (Convert.ToInt32(rs.Fields["g3e_fid"].Value) == p_FID && (Convert.ToInt32(rs.Fields["G3E_CNO"].Value) == 21 || Convert.ToInt32(rs.Fields["G3E_CNO"].Value) == 22))
                        {
                            bReturn = true;
                            break;
                        }
                        rs.MoveNext();
                    }
                }
            }

            oJobSrv = null;
            return(bReturn);
        }
Beispiel #5
0
        /// <summary>
        /// Finds any pending edits and returns them in the recordset parameter
        /// </summary>
        /// <param name="pendingEdits">Recordset of pending edits</param>
        /// <returns>true if pending edits exist; else, false</returns>
        private bool PendingEditsExist(ref Recordset pendingEdits)
        {
            try
            {
                IGTApplication          app        = GTClassFactory.Create <IGTApplication>();
                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                pendingEdits = jobService.FindPendingEdits();

                // If there are no pending edits, then close and null the Recordset object.
                if (null != pendingEdits && 0 == pendingEdits.RecordCount)
                {
                    if (pendingEdits.State != Convert.ToInt32(ObjectStateEnum.adStateClosed))
                    {
                        pendingEdits.Close();
                    }
                    pendingEdits = null;
                }

                return(null != pendingEdits && 0 < pendingEdits.RecordCount);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
        private void ValidateProcessing(string streetlightImportSheet, StreetLightImportWorkSheet importWorkSheet, DataTable excelDataTable, ImportSpreadsheetRecordValidation recordValidation)
        {
            try
            {
                importWorkSheet.DataTableTOExcel(streetlightImportSheet, excelDataTable);

                #region Validate Job Edits
                if (recordValidation.m_nbrDataBaseChanges)
                {
                    IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                    jobService.DataContext = m_oGTApp.DataContext;
                    Recordset rsValidate = jobService.ValidatePendingEdits();
                    if (rsValidate != null && rsValidate.RecordCount > 0)
                    {
                        MessageBox.Show("The job has validation errors that will need to be resolved before it can be posted.",
                                        "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                #endregion
                MessageBox.Show("Number of successful Add transactions: " + recordValidation.SuccessfulAddTransactions + Environment.NewLine + Environment.NewLine +
                                "Number of unsuccessful Add transactions that resulted in a warning: " + recordValidation.WarningAddTransactions + Environment.NewLine + Environment.NewLine +
                                "Number of unsuccessful Add transactions that resulted in an error: " + recordValidation.ErrorAddTransactions + Environment.NewLine + Environment.NewLine +
                                "Number of successful Removal transactions: " + recordValidation.SuccessfulRemovalTransactions + Environment.NewLine + Environment.NewLine +
                                "Number of unsuccessful Removal transactions that resulted in a warning: " + recordValidation.WarningRemovalTransactions + Environment.NewLine + Environment.NewLine +
                                "Number of unsuccessful Removal transactions that resulted in an error: " + recordValidation.ErrorRemovalTransactions, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                throw;
            }
        }
Beispiel #7
0
 public WorkPoints(Dictionary <int, Int16> p_WorkPoints)
 {
     m_WorkPointsKeyObjects = p_WorkPoints;
     m_oApp                      = GTClassFactory.Create <IGTApplication>();
     m_jobManagement             = GTClassFactory.Create <IGTJobManagementService>();
     m_jobManagement.DataContext = m_oApp.DataContext;
 }
Beispiel #8
0
        /// <summary>
        /// Runs job validation and analyzes returned error recordset.
        /// </summary>
        /// <returns>true if no P1/P2 errors exist or if user elects to continue with P1/P2 errors; else, else false</returns>
        private bool ResolveJobValidationErrors()
        {
            try
            {
                bool           retVal = false;
                IGTApplication app    = GTClassFactory.Create <IGTApplication>();

                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                Recordset rs = jobService.ValidatePendingEdits();

                if (null != rs && 0 < rs.RecordCount)
                {
                    ValidationErrorDisplay ved = new ValidationErrorDisplay();
                    ved.Errors        = rs;
                    ved.StartPosition = FormStartPosition.CenterParent;
                    ved.TopLevel      = true;
                    ved.Show();

                    rs.Filter = "ErrorPriority='P1' or ErrorPriority='P2'";

                    if (0 < rs.RecordCount)
                    {
                        // If Yes, then returns true
                        retVal = DialogResult.Yes == MessageBox.Show("Validation errors have been detected.  Proceed anyway?", "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    }

                    rs.Close();
                    rs = null;
                }
                else
                {
                    // No validation errors so return true
                    retVal = true;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Beispiel #9
0
        public Dictionary <IGTKeyObject, IGTComponents> GetFeatureComponentCollection()
        {
            Dictionary <IGTKeyObject, IGTComponents> oReturnCollection = new Dictionary <IGTKeyObject, IGTComponents>();
            IGTJobManagementService oJobManagement = GTClassFactory.Create <IGTJobManagementService>();

            try
            {
                oJobManagement.DataContext = m_oApp.DataContext;
                ADODB.Recordset rs = oJobManagement.FindPendingEdits();

                if (rs != null && rs.RecordCount > 0)
                {
                    foreach (IGTKeyObject item in m_featureKeyObject)
                    {
                        Feature obj = new Feature(item, m_oApp);
                        rs.Filter = "g3e_fid = " + item.FID;

                        if (rs != null && rs.RecordCount > 0)
                        {
                            IGTComponents oFeatureEditedComp = obj.GetEditedCUComponents(item, rs);

                            if (oFeatureEditedComp.Count > 0 && (!oReturnCollection.Contains(new KeyValuePair <IGTKeyObject, IGTComponents>(item, oFeatureEditedComp))))
                            {
                                oReturnCollection.Add(item, oFeatureEditedComp);
                            }
                        }
                        rs.Filter = ADODB.FilterGroupEnum.adFilterNone;
                    }
                }
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }

            return(oReturnCollection);
        }
Beispiel #10
0
        /// <summary>
        /// Deactivates the active job
        /// </summary>
        /// <param name="ViewJob">If true, keeps the active job in the viewed job list.</param>
        public void DeactivateJob(bool ViewJob)
        {
            IGTJobManagementService jms = GTClassFactory.Create <IGTJobManagementService>();

            jms.DataContext = app.DataContext;
            string activeJob = jms.DataContext.ActiveJob;

            if (!string.IsNullOrEmpty(activeJob))
            {
                jms.EndEditJob();
                // Until the custom interface that's using this object returns control to G/Tech,
                // the previously-active job still apears as active. In the interim, removing it as a viewed job
                // will cause it to be completely deactivated (e.g. GTDataContext.ActiveJob will be NULL at that point).
                jms.RemoveJob(activeJob);

                // If RemoveFromList is false, since we've already removed it (as the workaround),
                // then we need to add it back.
                if (ViewJob)
                {
                    jms.ViewJob(activeJob);
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// Gets active job's pending edits.
        /// If P1, return false.
        /// If P2, present P2 error resolution form.  If user resolves all P2s return true, else return false.
        /// If P3 or P4, display message box asking if user wants to continue.  If yes, return true, else return false.
        /// </summary>
        /// <returns>True if no P1 and P2, P3, and P4 are presented/resolved; else, false</returns>
        private bool ResolveJobValidationErrors()
        {
            try
            {
                bool           retVal = false;
                IGTApplication app    = GTClassFactory.Create <IGTApplication>();

                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                Recordset rs = jobService.ValidatePendingEdits();

                if (null != rs && 0 < rs.RecordCount)
                {
                    rs.Sort = "ErrorPriority ASC";
                    rs.MoveFirst();
                    string highestErrorPriority = rs.Fields[0].Value.ToString();
                    rs.Close();
                    rs = null;

                    switch (highestErrorPriority)
                    {
                    case "P1":
                        MessageBox.Show("P1 errors must be resolved before marking WR for closure.", "G/Technology", MessageBoxButtons.OK);
                        break;

                    case "P2":
                        // display validation overrides form
                        ValidationOverrides vo = new ValidationOverrides();

                        // Clear the sort criteria (just in case it interferes with the ordering on the form)
                        rs.Sort = string.Empty;

                        // Only show P2s for Validation Overrides
                        rs.Filter = "ErrorPriority='P2'";

                        Recordset orrs = vo.ShowValidationComments(rs);

                        // If the user Cancels the form, the returned recordset will be null; otherwise,
                        // the returned recordset will be a copy of the rs parameter with a new OVERRIDE_COMMENTS
                        // column appended to it that contains the override comment strings.
                        // If the user cancels the form and returned recordset is null, then
                        // the return value will remain unchaged at false (indicating a stop condition).
                        if (null != orrs)
                        {
                            ManageValidationOverrideData mvo = new CustomAPI.ManageValidationOverrideData();

                            // If the user has resolved all P2s and the system can update the records successfully,
                            // then this will return true; otherwise, false.
                            retVal = mvo.UpdateValidationOverrides(orrs);
                        }
                        break;

                    default:
                        DialogResult dialogResult = MessageBox.Show("Validation warnings encountered; proceed with marking for closure?", "G/Technology", MessageBoxButtons.OKCancel);
                        retVal = dialogResult == DialogResult.OK;
                        break;
                    }
                }
                else
                {
                    // No validation errors will result in a NULL recordset.

                    // A non-null recordset with no records should never occur,
                    // but just in case, close it if it is open.
                    if (null != rs && rs.State == Convert.ToInt32(ObjectStateEnum.adStateOpen))
                    {
                        rs.Close();
                        rs = null;
                    }

                    retVal = true;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Beispiel #12
0
        public void Activate()
        {
            string                  sql            = "SELECT G3E_FID FROM WORKPOINT_N WHERE WR_NBR=:1 AND G3E_FNO=191";
            Recordset               rsValidate     = null;
            int                     jFid           = 0;
            short                   jFno           = 0;
            IGTKeyObject            jKeyObject     = null;
            IGTJobManagementService oJobManagement = GTClassFactory.Create <IGTJobManagementService>();

            oJobManagement.DataContext = m_ogtApplication.DataContext;

            try
            {
                if (ValidateCommand())
                {
                    ADODB.Recordset rsPendingEdits = oJobManagement.FindPendingEdits();
                    if (rsPendingEdits != null && rsPendingEdits.RecordCount > 0)
                    {
                        oJobManagement.DiscardJob(); //ALM 1321 - Automatically discard job at the start and assume that there are no unposted data
                        m_oGTTransactionManager.RefreshDatabaseChanges();
                        m_ogtApplication.RefreshWindows();
                    }

                    rsValidate = m_ogtApplication.DataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                                            (int)ADODB.CommandTypeEnum.adCmdText, new object[] { m_ogtApplication.DataContext.ActiveJob });

                    if (rsValidate == null || rsValidate.RecordCount == 0)
                    {
                        return;
                    }

                    m_oGTTransactionManager.Begin("Revert Job");

                    commonRevertAPI rFeature = new commonRevertAPI(m_ogtApplication);
                    rsValidate.MoveFirst();
                    while (!rsValidate.EOF)
                    {
                        jFno = 191;
                        jFid = Convert.ToInt32(rsValidate.Fields["G3E_FID"].Value);

                        jKeyObject = m_ogtApplication.DataContext.OpenFeature(jFno, jFid);

                        rFeature.m_FromJob = "JOB";
                        rFeature.RevertWPFeature(jKeyObject);


                        rsValidate.MoveNext();
                    }

                    if (rFeature.m_uProcessedCUs)
                    {
                        MessageBox.Show("Check remaining Work Points to make manual corrections.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning,
                                        MessageBoxDefaultButton.Button1);
                    }

                    if (m_oGTTransactionManager.TransactionInProgress)
                    {
                        m_oGTTransactionManager.Commit();
                        m_oGTTransactionManager.RefreshDatabaseChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);

                m_oGTTransactionManager.Rollback();
            }
            finally
            {
                if (rsValidate != null)
                {
                    if (rsValidate.State == 1)
                    {
                        rsValidate.Close();
                        rsValidate.ActiveConnection = null;
                    }
                    rsValidate = null;
                }
            }
        }
Beispiel #13
0
 public void Terminate()
 {
     m_JobManagement      = null;
     m_Application        = null;
     m_TransactionManager = null;
 }
Beispiel #14
0
        /// <summary>
        /// Posts the job edits.
        /// </summary>
        /// <returns>Boolean indicating status</returns>
        internal bool PostJobEdits(out string message)
        {
            bool returnValue = false;

            message = "";

            try
            {
                IGTJobManagementService jobManagement = GTClassFactory.Create <IGTJobManagementService>();
                jobManagement.DataContext = m_Application.DataContext;
                jobManagement.EditJob(m_Application.DataContext.ActiveJob);

                GTPostErrorConstants postError = jobManagement.PostJob();
                if (postError != GTPostErrorConstants.gtjmsNoError)
                {
                    if (jobManagement.PostErrors != null)
                    {
                        Recordset errorRecords = jobManagement.PostErrors;

                        if (postError == GTPostErrorConstants.gtjmsValidation)
                        {
                            jobManagement.PostErrors.Filter = "ErrorPriority = 'P1' OR ErrorPriority = 'P2'";
                        }

                        if (errorRecords.RecordCount > 0)
                        {
                            errorRecords.MoveFirst();
                            while (!errorRecords.EOF)
                            {
                                message += errorRecords.Fields["G3E_FID"].Value;
                                if (postError == GTPostErrorConstants.gtjmsValidation)
                                {
                                    message += "-" + errorRecords.Fields["ErrorDescription"].Value + Environment.NewLine;
                                }
                                else
                                {
                                    message += "-" + errorRecords.Fields["table_name"].Value + "-" + errorRecords.Fields["job_name"].Value + Environment.NewLine;
                                }
                                errorRecords.MoveNext();
                            }
                        }
                    }

                    switch (postError)
                    {
                    case GTPostErrorConstants.gtjmsValidation:
                        message = "Post error - validation errors detected: " + Environment.NewLine + message;
                        break;

                    case GTPostErrorConstants.gtjmsConflict:
                        message = "Post error - conflicts detected: " + message;
                        break;

                    case GTPostErrorConstants.gtjmsDatabase:
                        message = "Post error - database error detected: " + message;
                        break;

                    case GTPostErrorConstants.gtjmsNoPendingEdits:
                        message = "Post error - no pending edits ";
                        break;
                    }

                    if (message.Length > 0)
                    {
                        TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_FAILED;
                        TransactionDEIS.TransactionMessage = message;
                        jobManagement.DiscardJob();
                        returnValue = false;
                    }
                    else
                    {
                        returnValue = true;
                    }
                }
                else
                {
                    returnValue = true;
                }

                jobManagement.RefreshJobEnvironment();
            }
            catch (Exception ex)
            {
                TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_FAILED;
                TransactionDEIS.TransactionMessage = string.Format("Error posting transaction: {0}", ex.Message);
                returnValue = false;
            }

            return(returnValue);
        }
Beispiel #15
0
        /// <summary>
        /// Checks for concurrent edits with jobs that have job status = ApprovalPending.
        /// </summary>
        /// <returns>true if qualifying jobs are found; else false</returns>
        private bool ConcurrentEditsExistWithApprovalPending()
        {
            try
            {
                bool retVal = false;

                IGTApplication          app        = GTClassFactory.Create <IGTApplication>();
                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;
                Recordset rs = jobService.FindPendingEdits();

                if (null != rs && 0 < rs.RecordCount)
                {
                    rs.MoveFirst();
                    List <int>   fids = new List <int>();
                    List <short> fnos = new List <short>();

                    do
                    {
                        // Just need a distinct set of FIDs and their FNOs
                        int fid = Convert.ToInt32(rs.Fields["G3E_FID"].Value);

                        if (!fids.Contains(fid))
                        {
                            fids.Add(fid);
                            fnos.Add(Convert.ToInt16(rs.Fields["G3E_FNO"].Value));
                        }

                        rs.MoveNext();
                    } while(!rs.EOF);

                    rs.Close();
                    rs = null;

                    // Use the list of FIDs and FNOs to run Concurrent Edit Detection.
                    IGTConcurrentEditDetection concEditDetect = GTClassFactory.Create <IGTConcurrentEditDetection>();

                    if (0 < concEditDetect.CheckFeatures(fnos.ToArray(), fids.ToArray(), false, true, false))
                    {
                        // CONCURRENT_EDITS is populated by the CheckFeatures method.
                        // Query it for the other jobs that have concurrently-edited features with this job

                        string sql = string.Format("select count(1) from concurrent_edits ce join g3e_job j on ce.source_job=j.g3e_identifier where ce.job_name=? and j.g3e_jobstatus='{0}'", approvalPending);
                        rs = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, app.DataContext.ActiveJob);

                        // If the above query returns a count greater than zero, then
                        // issue the error and set return value to true.
                        if (null != rs && 0 < rs.RecordCount)
                        {
                            rs.MoveFirst();

                            if (0 < Convert.ToInt16(rs.Fields[0].Value))
                            {
                                retVal = true;
                                MessageBox.Show("Concurrent edits exist in another job already pending approval.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            rs.Close();
                            rs = null;
                        }
                    }
                }
                else
                {
                    if (null != rs && rs.State == (int)System.Data.ConnectionState.Open)
                    {
                        rs.Close();
                    }
                    rs = null;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Handleblanketunitizationactivity will handle the records which have pending activity related to blanket unitization (i.e.- where Activity = UR or UX).
        /// </summary>
        /// <returns></returns>
        public bool Handleblanketunitizationactivity()
        {
            Recordset pendingEdits = null;

            string strRFC         = null;
            string strActivity    = null;
            String strServiceCode = null;

            try
            {
                bool retVal = true;

                IGTApplication app = GTClassFactory.Create <IGTApplication>();

                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                pendingEdits = jobService.FindPendingEdits();

                if (null == pendingEdits || 0 >= pendingEdits.RecordCount)
                {
                    retVal = false;
                    return(retVal);
                }
                pendingEdits.MoveFirst();
                pendingEdits.Filter = string.Format("g3e_cno={0} or g3e_cno={1}", 21, 22);

                if (pendingEdits != null && pendingEdits.RecordCount > 0)
                {
                    JobManager jobManager = new JobManager();
                    strRFC = jobManager.DesignerRACFID;
                    pendingEdits.MoveFirst();

                    while (!pendingEdits.EOF)
                    {
                        strActivity = GetActivityOftheFeature(Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value),
                                                              Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value),
                                                              Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value), app);
                        strServiceCode = null;

                        if (strActivity == "UX")
                        {
                            strServiceCode = "RP";
                        }
                        else if (strActivity == "UR")
                        {
                            strServiceCode = "RM";
                        }
                        if (!String.IsNullOrEmpty(strServiceCode))
                        {
                            Command cmd = new Command();
                            cmd.CommandType = CommandTypeEnum.adCmdStoredProc;
                            Parameter param = cmd.CreateParameter("p_FID", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value));
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_serviceInfoCode", DataTypeEnum.adLongVarChar, ParameterDirectionEnum.adParamInput, 20, strServiceCode);
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_userID", DataTypeEnum.adLongVarChar, ParameterDirectionEnum.adParamInput, 20, strRFC);
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("P_CNO", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value));
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_CID", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value));
                            cmd.Parameters.Append(param);


                            cmd.CommandText = "GISPKG_SERVICEACTIVITY.InsertServiceActivity";
                            app.Application.DataContext.ExecuteCommand(cmd, out int recordsAffected);

                            IGTKeyObject gTKeyObject = null;

                            gTKeyObject = app.Application.DataContext.OpenFeature(Convert.ToInt16(pendingEdits.Fields["G3E_FNO"].Value),
                                                                                  Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value));



                            if (gTKeyObject.Components["COMP_UNIT_N"] != null)
                            {
                                if (gTKeyObject.Components["COMP_UNIT_N"].Recordset != null && gTKeyObject.Components["COMP_UNIT_N"].Recordset.RecordCount > 0)
                                {
                                    gTKeyObject.Components["COMP_UNIT_N"].Recordset.MoveFirst();
                                    while (!gTKeyObject.Components["COMP_UNIT_N"].Recordset.EOF)
                                    {
                                        if (Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value) ==
                                            Convert.ToInt32(gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["G3E_CNO"].Value)
                                            &&
                                            Convert.ToInt32(gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["g3e_cid"].Value) ==
                                            Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value))
                                        {
                                            gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["ACTIVITY_C"].Value = "";
                                        }
                                        gTKeyObject.Components["COMP_UNIT_N"].Recordset.Update();
                                        gTKeyObject.Components["COMP_UNIT_N"].Recordset.MoveNext();
                                    }
                                }
                            }

                            if (gTKeyObject.Components["COMMON_N"] != null)
                            {
                                if (gTKeyObject.Components["COMMON_N"].Recordset != null && gTKeyObject.Components["COMMON_N"].Recordset.RecordCount > 0)
                                {
                                    gTKeyObject.Components["COMMON_N"].Recordset.MoveFirst();
                                    gTKeyObject.Components["COMMON_N"].Recordset.Fields["FEATURE_STATE_C"].Value = "CLS";
                                    gTKeyObject.Components["COMMON_N"].Recordset.Update();
                                }
                            }
                        }

                        pendingEdits.MoveNext();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Rollback();
                }

                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }