Esempio n. 1
0
        private bool IsTemplateExist()
        {
            Recordset     rs = null;
            string        strPlotTemplateName = "";
            IGTNamedPlots gTNamedPlots        = null;

            try
            {
                rs = m_gTDataContext.OpenRecordset("select PARAM_VALUE from SYS_GENERALPARAMETER where PARAM_NAME=:1", CursorTypeEnum.adOpenStatic,
                                                   LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, strParamName);

                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    strPlotTemplateName = Convert.ToString(rs.Fields[0].Value);
                    if (!string.IsNullOrEmpty(strPlotTemplateName))
                    {
                        gTNamedPlots = gTApplication.NamedPlots;
                        if (gTNamedPlots != null && gTNamedPlots.Count > 0)
                        {
                            foreach (IGTNamedPlot npt in gTNamedPlots)
                            {
                                if (npt.Name == strPlotTemplateName)
                                {
                                    gTNamedPlot = npt;
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                rs.Close();
                rs = null;
            }

            return(false);
        }
Esempio n. 2
0
        public string GetAvailablePlotName()
        {
            IGTNamedPlots gTNamedPlots = null;
            string        strPlot      = "";

            string[] strAvailableName = new string[2];
            int      plotNumber       = 0;

            try
            {
                gTNamedPlots = m_gTApplication.NamedPlots;
                if (gTNamedPlots != null && gTNamedPlots.Count > 0)
                {
                    foreach (IGTNamedPlot npt in gTNamedPlots)
                    {
                        if (npt.Name.Contains("Supplemental Plot") && npt.Name.Contains("-"))
                        {
                            strAvailableName = npt.Name.Split('-');

                            if (strAvailableName[1] != null && Convert.ToInt32(strAvailableName[1]) > plotNumber)
                            {
                                plotNumber = Convert.ToInt32(strAvailableName[1]);
                            }
                        }
                    }


                    if (plotNumber == 0)
                    {
                        strPlot = "Supplemental Plot - 1";
                    }
                    else if (plotNumber > 0)
                    {
                        plotNumber = plotNumber + 1;
                        strPlot    = "Supplemental Plot" + " - " + plotNumber;
                    }
                }
            }
            catch
            {
                throw;
            }
            return(strPlot);
        }
Esempio n. 3
0
        private bool IsPlotNameExist(string strUserText)
        {
            IGTNamedPlots gTNamedPlots = null;

            try
            {
                gTNamedPlots = m_gTApplication.NamedPlots;
                if (gTNamedPlots != null && gTNamedPlots.Count > 0)
                {
                    foreach (IGTNamedPlot npt in gTNamedPlots)
                    {
                        if (npt.Name == strUserText)
                        {
                            return(true);
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Method to check of the Vegetation management PlotTemplate in Workspace.
        /// </summary>
        /// <param name="p_vegMngSheetTemp">Name of the copy of the Vegetation management HTML sheet template</param>
        /// <param name="p_newTreeTrimmingfeature">Current placed feature</param>
        public void CreateVegetationManagementPlotTemplateCopy(string p_vegMngSheetTemp, IGTKeyObject p_newTreeTrimmingfeature)
        {
            string       plotTemplateName = null;
            Recordset    rs       = null;
            bool         found    = false;
            IGTNamedPlot template = null;

            try
            {
                rs = m_oGTApplication.DataContext.OpenRecordset("select PARAM_VALUE from sys_generalparameter where PARAM_NAME='VegMgmtEstimate_Plot'", CursorTypeEnum.adOpenStatic,
                                                                LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText);
                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    plotTemplateName = Convert.ToString(rs.Fields["PARAM_VALUE"].Value);
                    IGTNamedPlots npcollection = m_oGTApplication.NamedPlots;
                    if (npcollection != null)
                    {
                        if (npcollection.Count > 0)
                        {
                            foreach (IGTNamedPlot np in npcollection)
                            {
                                if (np.Name == plotTemplateName)
                                {
                                    template = np;
                                    found    = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!found)
                    {
                        DialogResult result = MessageBox.Show(m_oGTApplication.ApplicationWindow, "Unable to generate plot; missing template " + plotTemplateName + ". Send anyway? ", "G /Technology", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        switch (result)
                        {
                        case DialogResult.OK:
                        {
                            break;
                        }

                        case DialogResult.Cancel:
                        {
                            m_oUserCancelRequest = true;
                            if (!String.IsNullOrEmpty(p_vegMngSheetTemp))
                            {
                                File.Delete(p_vegMngSheetTemp);
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                        CreatePlotWindowAndPlotPDF(template, p_newTreeTrimmingfeature);
                    }
                }
            }

            catch (Exception)
            {
                m_oUserCancelRequest = true;
                throw;
            }
        }