Ejemplo n.º 1
0
        private void btnViewDetails_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvResults.SelectedRows.Count == 1)
                {
                    this.Hide();

                    string sAddNum = dgvResults.SelectedRows[0].Cells["ADDRESSNUM"].Value.ToString();
                    if (sAddNum.IndexOf(" ") > 0)
                    {
                        sAddNum = sAddNum.Substring(0, sAddNum.IndexOf(" "));
                    }
                    string sStreet     = dgvResults.SelectedRows[0].Cells["STREETNAME"].Value.ToString();
                    object oLocResults = new object();

                    //if (CMedToolsSubs.canConnect(CConst.LXConnString))
                    if (SConst.GotDBConn)
                    {
                        using (CData oData = new CData(SConst.LXConnString.ToString()))
                        {
                            oLocResults = oData.returnLocID(sAddNum, CMedToolsSubs.returnStreetDirectionFromTaxlotsAddress(sStreet), CMedToolsSubs.returnStreetNameFromTaxlotsAddress(sStreet, SConst.CountyStreets), CMedToolsSubs.returnStreetTypeFromTaxlotsAddress(sStreet, SConst.CountyStreets), dgvResults.SelectedRows[0].Cells["MAPLOT"].Value.ToString(), dgvResults.SelectedRows[0].Cells["ACCOUNT"].Value.ToString());
                        }
                    }
                    else
                    {
                        oLocResults = null;
                    }

                    if (oLocResults is Hashtable)
                    {
                        fmSubAccount oSubAccount = new fmSubAccount();
                        oSubAccount.App         = this.App;
                        oSubAccount.ObjectID    = dgvResults.SelectedRows[0].Cells["OBJECTID"].Value.ToString();
                        oSubAccount.SubAccounts = oLocResults as Hashtable;
                        oSubAccount.Show(new WindowWrapper((System.IntPtr)m_pApp.hWnd));
                    }
                    else
                    {
                        fmSearchResults oSearchResults = new fmSearchResults();
                        oSearchResults.ObjectID = dgvResults.SelectedRows[0].Cells["OBJECTID"].Value.ToString();
                        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.Close();
                }
                else
                {
                    MessageBox.Show("Please select one row in the grid.", "Taxlot Search: Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Errors occurred: \r\n\r\n" + ex.Message);
                this.Dispose();
            }
        }
Ejemplo n.º 2
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();
            }
        }