Exemple #1
0
        private void doSearch()
        {
            this.Cursor = Cursors.WaitCursor;

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                // check if taxlots is in the data frame
                if (!oSpatialSubs.doesMapLayerExist(SConst.Taxlots, this.App))
                {
                    //CMedToolsSubs.addFeatureLayerToMap(m_pApp, CConst.Taxlots, false);
                    oSpatialSubs.addSingleLayerToMap(m_pApp, SConst.LayerLocation, SConst.TaxlotLayerName);
                }
            }

            string sWhere = "";

            switch (m_iSearchType)
            {
            case 0:     //Int32.Parse(SearchType.OWNER):
                sWhere = "FEEOWNER LIKE '%" + txtOwner.Text.Replace(",", " ") + "%'";
                break;

            //case 1: //Int32.Parse(SearchType.SITUS):
            //    sWhere = "SITEADD = '" + txtSitus.Text + "'";
            //    break;
            case 2:     //Int32.Parse(SearchType.MAPLOT):
                sWhere = "MAPLOT = '" + txtMaplot.Text + "'";
                break;

            case 3:     //Int32.Parse(SearchType.ACCOUNT):
                sWhere = "ACCOUNT = " + txtAccount.Text + "";
                break;

            case 4:     //Int32.Parse(SearchType.MAPNUMBER):
                sWhere = "MAPNUM = '" + txtMapnum.Text + "'";
                break;

            default:

                break;
            }

            if (sWhere.Length > 0)
            {
                getResults(sWhere);
            }

            this.Cursor = Cursors.Default;
        }
        protected override void OnClick()
        {
            if (results != null)
            {
                try
                {
                    results.Close();
                    results = null;
                }
                catch
                {
                    // just move on.
                    int i = 1;
                }
            }

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                // check if taxlots is in the data frame
                //if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application))

                if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application))
                {
                    System.Windows.Forms.MessageBox.Show("Taxlots layer does not exist." + Environment.NewLine + Environment.NewLine + "Please ensure that you have taxlots loaded into your project and " + Environment.NewLine + "that have your target taxlots selected.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                    return;
                }

                IFeatureLayer     pFLayer = (IFeatureLayer)oSpatialSubs.returnFeatureLayer(ArcMap.Document.FocusMap, "Tax Lots");
                IFeatureSelection pFSel   = pFLayer as IFeatureSelection;
                ISelectionSet2    pSelSet = pFSel.SelectionSet as ISelectionSet2;

                if (pSelSet.Count < 1)
                {
                    System.Windows.Forms.MessageBox.Show("There were no selected features found." + Environment.NewLine + Environment.NewLine + "Please select taxlots before using this tool.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                    return;
                }

                ICursor pCursor;
                pSelSet.Search(null, false, out pCursor);

                doQuery(returnSearchCriteria(pCursor as IFeatureCursor));
            }
        }