View Single Post

  #9 (permalink)  
Old 01-07-2005
gvkreddy gvkreddy is offline
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 6
Send a message via MSN to gvkreddy Send a message via Yahoo to gvkreddy
Thank you very much.

Before deciding on the message pump I would like to share the code what I had used in my application.

I would request you to evaluate the same.


Code:
private int GetCounsellorCount(string street, string city, string state, string zip, string country, double radius)
        {
            // Find the Address Results into oResults Object 
		
			if(street.Length >=1)
			{
				if(street.Substring(0,1)=="#")
					street=street.Replace("#","No "); 
			}

	        oResults=oMap.FindAddressResults(street,city,"" ,state, zip, country);
				
            int counselCount=0;
            
            if(oResults.ResultsQuality.ToString() == "geoFirstResultGood")
            {
                    {
						 
                        // Get the location object from Results
                        IEnumerator item = oResults.GetEnumerator();
                        while(item.MoveNext())
                        {
                            MapPoint.Location loc = (MapPoint.Location)item.Current ;
                            
                            if(loc != null)
                            {
                                try
                                {
                                    // Find the Pushpin with in the specified radius
                                    oRs=oDss.QueryCircle(loc, radius);
                                    if(oRs!=null)
                                    {
                                        oRs.MoveFirst();
                                        while(!oRs.EOF )
                                        {
                                            oPin=oRs.Pushpin;
                                            if(oPin !=null)
                                                counselCount=counselCount+1;
                                            oRs.MoveNext(); 
                                        }
                                    }
                                }
                                catch (Exception exe)
                                {
                                    // Log Error
                                }
                            }
                            break;
                       }
                }
            }
            else
                counselCount=-1;

            return counselCount;
        }
The above is the function to which I make a call for every address that I would search
__________________
Thanks & Regards,
Vijay
Reply With Quote