示例 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 ;
}
{
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 ;
}
KeelKit 一款国产ORM工具,自动生成Model、自动生成表单、自动生成单元测试框架、自动生成存储过程访问接口、自动配置连接字符串,代码行数统计、程序集版本号码控制、源码HTML生成、自动生成表结构Word文档、自动支持各种.Net项目,如F# 和IronPython ,自动生成与其它语言交换的Model、使用了泛型的DBHelper、查询语句强类型化、支持事务、无语言界限、无数据库界限!