Esempio n. 1
0
        private void getResults(string sWhere)
        {
            CSpatialSubs oSpatialSubs = new CSpatialSubs();
            object       oResults     = oSpatialSubs.searchTaxlots(sWhere, m_pApp);

            try
            {
                if (oResults is IFeatureCursor)
                {
                    // this means that there were multiple results returned
                    // from the user search criteria
                    // so ... show the multiple results window
                    this.Hide();

                    // show multiple results
                    fmMultipleResults oMultRes = new fmMultipleResults();
                    oMultRes.SearchResults = (IFeatureCursor)oResults;
                    oMultRes.App           = this.m_pApp;
                    oMultRes.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));

                    this.Dispose();
                }
                else
                {
                    // this means that there was only one feature returned from
                    // the user search criteria

                    IFeature pFeat = (IFeature)oResults;
                    if (pFeat != null)
                    {
                        // zoom to table
                        this.Hide();

                        string sAccount = oSpatialSubs.returnValueFromSingleSelection("ACCOUNT", this.App, SConst.Taxlots);
                        string sMaplot  = oSpatialSubs.returnValueFromSingleSelection("MAPLOT", this.App, SConst.Taxlots);
                        string sAddNum  = oSpatialSubs.returnValueFromSingleSelection("ADDRESSNUM", this.App, SConst.Taxlots);
                        if (sAddNum.IndexOf(" ") > 0)
                        {
                            sAddNum = "";
                        }
                        string sStreet     = oSpatialSubs.returnValueFromSingleSelection("STREETNAME", this.App, SConst.Taxlots);
                        string sObjectID   = oSpatialSubs.returnValueFromSingleSelection("OBJECTID", this.App, SConst.Taxlots);
                        object oLocResults = new object();

                        // go get the location id and check for subaccounts

                        //if (CMedToolsSubs.canConnect(CConst.LXConnString))
                        if (SConst.GotDBConn)
                        {
                            using (CData oData = new CData(SConst.LXConnString.ToString()))
                            {
                                string sDir        = CMedToolsSubs.returnStreetDirectionFromTaxlotsAddress(sStreet);
                                string sStreetName = CMedToolsSubs.returnStreetNameFromTaxlotsAddress(sStreet, SConst.CountyStreets);
                                string sStreetType = CMedToolsSubs.returnStreetTypeFromTaxlotsAddress(sStreet, SConst.CountyStreets);
                                oLocResults = oData.returnLocID(sAddNum, sDir, sStreetName, sStreetType, sMaplot, sAccount);
                            }
                        }
                        else
                        {
                            oLocResults = null;
                        }

                        if (oLocResults is Hashtable)
                        {
                            // the hashtable means that there are multiple subaccounts
                            // so ... go to the sub account window
                            fmSubAccount oSubAccount = new fmSubAccount();
                            oSubAccount.App         = this.App;
                            oSubAccount.ObjectID    = sObjectID;
                            oSubAccount.SubAccounts = oLocResults as Hashtable;
                            oSubAccount.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));
                        }
                        else
                        {
                            // there is only one account here ...
                            // so ... go to the results
                            fmSearchResults oSearchResults = new fmSearchResults();
                            oSearchResults.ObjectID = sObjectID;
                            oSearchResults.App      = this.App;
                            if (oLocResults != null)
                            {
                                oSearchResults.LocationID = (int)oLocResults;
                            }
                            else
                            {
                                oSearchResults.LocationID = 0;
                            }
                            oSearchResults.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));
                        }
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("There were no matches found.", "Taxlot Search: Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        // reset the form
                    }
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                s += "done";
            }
            finally
            {
                oSpatialSubs.Dispose();
            }
        }