/// <summary> /// Get active Job Design Area and attached the document /// </summary> public void Activate() { try { m_commonMessages = new CommonMessages(); m_gtApplication = GTClassFactory.Create <IGTApplication>(); m_dataContext = m_gtApplication.DataContext; m_strActiveJob = m_gtApplication.DataContext.ActiveJob; m_strSQL = "SELECT G3E_JOBTYPE FROM G3E_JOB WHERE G3E_IDENTIFIER='" + m_strActiveJob + "'"; m_strDASQL = "SELECT G3E_FID FROM DESIGNAREA_P WHERE JOB_ID='" + m_strActiveJob + "'"; if (IsJobTypeNONWR(m_strSQL)) { //Get the active job design area ExecuteCommand(m_strDASQL); if (m_rsDesignArea.RecordCount <= 0) { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.NoDesignArea, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (m_rsDesignArea.RecordCount > 1) { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.MoreDesignAreas, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (m_rsDesignArea.RecordCount > 0) { m_rsDesignArea.MoveFirst(); m_attachJobDocument = new AttachJobDocument(m_gtApplication, Convert.ToInt32(m_rsDesignArea.Fields["G3E_FID"].Value), m_ManageTransactions); m_attachJobDocument.ShowDialog(m_gtApplication.ApplicationWindow); } } } else { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.WRMessage, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(m_gtApplication.ApplicationWindow, "Error " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (m_rsDesignArea != null) { if (m_rsDesignArea.State == 1) { m_rsDesignArea.Close(); m_rsDesignArea.ActiveConnection = null; } m_rsDesignArea = null; } if (m_attachJobDocument != null) { m_attachJobDocument.Close(); m_attachJobDocument.Dispose(); m_attachJobDocument = null; } } }
public AttachJobDocument(IGTApplication m_igtApplication, int m_designAreaFID, IGTTransactionManager m_igtranscation) { InitializeComponent(); this.m_igtApplication = m_igtApplication; this.m_designAreaFID = m_designAreaFID; this.m_igtranscation = m_igtranscation; m_commonMessages = new CommonMessages(); getCommandParams(); //addFileTypes(); }