/// <summary> /// Method to start processing feature creation /// </summary> public void ProcessFeatureCreation() { try { oHelper = new Helper(); oHelper.m_dataContext = m_dataContext; if (CreateNewFeature()) { oIsolationScenario = new IsolationScenario(m_dataContext); if (oIsolationScenario.CheckIsoScenarioFeature(m_newFeature.FNO, m_newFeature.FID)) { oIsolationScenario.DeleteOldIsolationPoint(m_newFeature); } SetActivity(21); SetActivity(22); SetFeatureState(); SetStructureID(); } } catch (Exception) { throw; } }
public void Activate() { string jobStatus = string.Empty; bool dummyCuCodeExists = false; oHelper = new Helper(); oHelper.m_dataContext = m_dataContext; oIsolationScenario = new IsolationScenario(m_dataContext); try { #region Perform validations if (CheckIfNonWrJob()) { MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); List <int> fidList = new List <int>(); IGTDDCKeyObjects ddcKeyObjects = m_iGtApplication.SelectedObjects.GetObjects(); foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects) { if (!fidList.Contains(ddcKeyObject.FID)) { fidList.Add(ddcKeyObject.FID); selectedObjects.Add(ddcKeyObject); } } m_selectedObject = selectedObjects[0]; oHelper.m_fid = m_selectedObject.FID; oHelper.m_fno = m_selectedObject.FNO; if (!CheckIfFeatureIsReplaceable()) { MessageBox.Show("Replace Feature is not configured to operate on the selected feature class.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!CheckIfValidCuAttributesExists(out dummyCuCodeExists)) { MessageBox.Show("This command applies only to features with CUs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dummyCuCodeExists) { MessageBox.Show("This command cannot operate on dummy CUs (i.e.- CU codes beginning with ZZ).", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!ValidateFeatureState()) { MessageBox.Show("One or more features are in an invalid feature state for this operation.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!GetOffsetValuesFromGeneralParameters()) { MessageBox.Show("General parameters JobMgmt_ReplaceOffsetX or JobMgmt_ReplaceOffsetY is not configured correctly.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!CheckIfPointFeature()) { MessageBox.Show("Command is restricted to only work for point features.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!CheckIfInstallAndActiveWrAreDifferent()) { MessageBox.Show("The same feature may not be installed and replaced in the same WR.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion frmSelectReplacementStatus oReplacementStatusForm = new frmSelectReplacementStatus(); if (oReplacementStatusForm.ShowDialog(m_iGtApplication.ApplicationWindow) == DialogResult.Cancel) { return; } else { this.m_replaceAction = oReplacementStatusForm.ReplacementStatus; m_iGtApplication.BeginWaitCursor(); m_oIsolationScenario = oIsolationScenario.CheckIsoScenarioFeature(m_selectedObject.FNO, m_selectedObject.FID); ProcessReplacement(); m_TransactionManager.RefreshDatabaseChanges(); } } catch (Exception ex) { m_iGtApplication.EndWaitCursor(); m_TransactionManager.Rollback(); MessageBox.Show("Error during execution of Replace Feature custom command." + Environment.NewLine + "Replace failed for selected feature." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { m_TransactionManager = null; m_iGtApplication.EndWaitCursor(); } }