示例 AnalysisMaps的部分代码

 

运行位置:

http://www.rgbfox.cn/default.aspx

 

效果:

 

http://www.rgbfox.cn/Chart_Map.aspx?userid=1&type=swf

 

 public static AnalysisMaps.Model.tb_placeinfo GetPlaceInfo(string ip)
        {
            
string sql = @"(instr('{0}',placename)>0)";
            sql 
= string.Format(sql, GetPlaceByIPAddress(ip));
            Keel.DBHelper
<AnalysisMaps.Model.tb_placeinfo> tpi = new Keel.DBHelper<tb_placeinfo>();
            AnalysisMaps.Model.tb_placeinfo ret 
= tpi.SelectEntity (sql) as AnalysisMaps.Model.tb_placeinfo;
            
return ret;
        }
        
public static AnalysisMaps.Model.tb_placeinfo GetPlaceInfoByName(string name)
        {
            
string sql = @"(instr('{0}',placename)>0)";
            sql 
= string.Format(sql,  name );
            Keel.DBHelper
<AnalysisMaps.Model.tb_placeinfo> tpi = new Keel.DBHelper<tb_placeinfo>();
            AnalysisMaps.Model.tb_placeinfo ret 
= tpi.SelectEntity(sql) as AnalysisMaps.Model.tb_placeinfo;
            
return ret;
        }
        
public static ArrayList GetPlaces()
        {
            Keel.DBHelper
<tb_placeinfo> tpi = new Keel.DBHelper<tb_placeinfo>();
            ArrayList al 
=new ArrayList( tpi.SelectEntitys().ToArray());
            
return al;

        }
        
public static ArrayList GetPlaces(string userid)
        {
            Keel.DBHelper
<AnalysisMaps.Model.tb_placeinfo> tpi = new Keel.DBHelper<tb_placeinfo>();
            ArrayList al 
= new ArrayList(tpi.SelectEntitys(string.Format("placename in (  SELECT  infcity from   tb_usemapinfo  where userid ={0})", userid)));
            
return al;

        }
        
public static void UpdateInfosss(string ip,string userid)
        {
            tb_placeinfo dmt 
= BLL.Query.GetPlaceInfo(ip);
            
if (dmt == null)
            {
                dmt 
= BLL.Query.LookupCiyt(ip);
                
if (dmt == null)
                {
                    
return ;

                }
            }
            
bool isnew = BLL.Query.IsNewAndUpdateVisitInfo(userid, dmt.placename);
        }

        
public static string  GetChatMapInfo(string userid)
        {
            
            
string[] Citys = Properties.Resources.Citys.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            Keel.DBHelper
<AnalysisMaps.Model.tb_usemapinfo> tmi = new Keel.DBHelper<tb_usemapinfo>();
            tb_usemapinfo tu
=new tb_usemapinfo();
            tu.userid 
=int.Parse( userid) ;
            Keel.DBOperator
<Keel.DB.Common> cdbo = new Keel.DBOperator<Keel.DB.Common>();
            
//List<tb_usemapinfo> lt = tmi.SelectEntitys(tu);
            string param = "?Data=";
            
foreach (var item in Citys )
            {
                
int it = 0;
                
string ct;
                
if (item.Contains("("))
                {
                      ct 
= item.Substring(0, item.IndexOf('('));
                    
object o =tmi.ExecuteScalar("  sum(cityvisitcount) "string.Format(" userid={0} and infcity in {1}", tu.userid, item.Substring(item.IndexOf('('))));
                   
int.TryParse(o.ToString (),out it );
                }
                
else
                {
                    ct 
=item.Trim ();
                }
                param 
+= string.Format("{0},{1};", ct, it);

            }
            
return param ;

        }

 

posted on 2009-04-12 22:22  KeelKit  阅读(220)  评论(0编辑  收藏  举报

导航