コード例 #1
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            if (GTDataContext.IsRoleGranted("PRIV_DESIGN_ALL"))
            {
                try
                {
                    SupplementalAgreementPlotPresenter presenter = new SupplementalAgreementPlotPresenter(GTDataContext
                                                                                                          , GTDDCKeyObjects, m_iGtApplication, CustomCommandHelper);

                    if (presenter.IsValidCommand())
                    {
                        AgreementPlotForm agreementPlotForm = new AgreementPlotForm(presenter);
                        agreementPlotForm.StartPosition = FormStartPosition.CenterParent;
                        agreementPlotForm.ShowDialog(m_iGtApplication.ApplicationWindow);
                    }
                    else
                    {
                        MessageBox.Show(presenter.m_UserMessage, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                        MessageBoxDefaultButton.Button1);

                        ExitCommand(CustomCommandHelper);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);


                    ExitCommand(CustomCommandHelper);
                }
            }
            else
            {
                MessageBox.Show("User does not have PRIV_DESIGN_ALL role.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
            }
        }
コード例 #2
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            if (GTDataContext.IsRoleGranted("PRIV_DESIGN_ALL"))
            {
                try
                {
                    CheckValidation checkValidation = new CheckValidation(GTDataContext);

                    if (checkValidation.IsWRJob())
                    {
                        ProcessStreetLight processStreetLight = new ProcessStreetLight(m_iGtApplication, TransactionManager);
                        if (processStreetLight.IsExistingAttachment())
                        {
                            if (MessageBox.Show(GTClassFactory.Create <IGTApplication>().ApplicationWindow,
                                                "The active WR already has a supplemental plot attached to it with the name " + processStreetLight.m_strPlotAttachmentName + " " +
                                                ".Do you wish to overwrite that plot with the active plot window ?", "G/Technology",
                                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                processStreetLight.DeleteExistingAttachment();
                                processStreetLight.AttachPlot();

                                MessageBox.Show("Successfully attached PDF of the plot window to the active WR.", "G/Technology",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                                ExitCommand(CustomCommandHelper);
                            }
                            else
                            {
                                ExitCommand(CustomCommandHelper);
                            }
                        }
                        else if (processStreetLight.m_gTDesignAreaKeyObject != null)
                        {
                            if (MessageBox.Show(GTClassFactory.Create <IGTApplication>().ApplicationWindow,
                                                "Attach plot " + processStreetLight.m_strPlotAttachmentName + " to this WR as the Supplemental Agreement Plot? ", "G/Technology",
                                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                processStreetLight.AttachPlot();
                                MessageBox.Show("Successfully attached PDF of the plot window to the active WR.", "G/Technology",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                                ExitCommand(CustomCommandHelper);
                            }
                            else
                            {
                                ExitCommand(CustomCommandHelper);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Active Job does not have a Design Area.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                            MessageBoxDefaultButton.Button1);
                            ExitCommand(CustomCommandHelper);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Active job must be a WR type.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                        MessageBoxDefaultButton.Button1);
                        ExitCommand(CustomCommandHelper);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);

                    ExitCommand(CustomCommandHelper);
                }
            }
            else
            {
                MessageBox.Show("User does not have PRIV_DESIGN_ALL role.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);
                ExitCommand(CustomCommandHelper);
            }
        }
コード例 #3
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            m_gTCustomCommandHelper = CustomCommandHelper;
            if (GTDataContext.IsRoleGranted("PRIV_DESIGN_ALL"))
            {
                try
                {
                    presenter = new SupplementalAgreementPresenter(this, CustomCommandHelper, m_oGTTransactionManager);
                    //CustomCommandHelper.MouseMove += CustomCommandHelper_MouseMove;
                    string[] strAlterDesign;

                    if (presenter.IsCCommandValid())
                    {
                        //If command is valid and MSLA date exist CC loads MSLA form.
                        if (presenter.IsMSLAForm)
                        {
                            #region Form With MSLA

                            FormWithMSLA formWithMSLA = new FormWithMSLA();
                            formWithMSLA.StartPosition = FormStartPosition.CenterParent;


                            if (presenter.ActiveWR.Contains("-"))
                            {
                                strAlterDesign     = new string[2];
                                strAlterDesign     = presenter.ActiveWR.Split('-');
                                presenter.ActiveWR = strAlterDesign[0];
                            }
                            presenter.m_UserForm         = formWithMSLA;
                            formWithMSLA.m_formPresenter = presenter;
                            formWithMSLA.ShowDialog(m_iGtApplication.ApplicationWindow);

                            #endregion
                        }
                        else
                        {
                            //If command is valid and MSLA date is null CC loads with out MSLA form.

                            #region Form Without MSLA

                            FormWithoutMSLA formWithoutMSLA = new FormWithoutMSLA();
                            formWithoutMSLA.StartPosition = FormStartPosition.CenterParent;


                            if (presenter.ActiveWR.Contains("-"))
                            {
                                strAlterDesign     = new string[2];
                                strAlterDesign     = presenter.ActiveWR.Split('-');
                                presenter.ActiveWR = strAlterDesign[0];
                            }
                            presenter.m_UserForm            = formWithoutMSLA;
                            formWithoutMSLA.m_formPresenter = presenter;
                            formWithoutMSLA.ShowDialog(m_iGtApplication.ApplicationWindow);

                            #endregion
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(presenter.NotifyPresenterMess))
                        {
                            //GTClassFactory.Create<IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, presenter.NotifyPresenterMess);
                            MessageBox.Show(presenter.NotifyPresenterMess, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                            MessageBoxDefaultButton.Button1);


                            presenter = null;
                            //m_gTCustomCommandHelper.MouseMove -= CustomCommandHelper_MouseMove;
                            ExitCommand(m_gTCustomCommandHelper);
                        }
                        else
                        {
                            presenter = null;
                            // m_gTCustomCommandHelper.MouseMove -= CustomCommandHelper_MouseMove;
                            ExitCommand(m_gTCustomCommandHelper);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);

                    //CustomCommandHelper.MouseMove -= CustomCommandHelper_MouseMove;

                    if (m_oGTTransactionManager != null)
                    {
                        if (m_oGTTransactionManager.TransactionInProgress)
                        {
                            m_oGTTransactionManager.Rollback();
                        }
                    }
                    m_oGTTransactionManager = null;

                    ExitCommand(CustomCommandHelper);
                }
            }
            else
            {
                MessageBox.Show("User does not have PRIV_DESIGN_ALL role.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);
                //CustomCommandHelper.MouseMove -= CustomCommandHelper_MouseMove;
                ExitCommand(CustomCommandHelper);
            }
        }