public
void
BindInfo()
{
string sql = " select UserAccount,SurName from ClerkAccount order by PID desc " ;
DataSet ds = newDb.CommonDataSet(sql);
DataTable table = new DataTable();
table.Columns.Add( new DataColumn( " ClerkName " , typeof ( string ))); // 姓名
table.Columns.Add( new DataColumn( " HitsNumber " , typeof ( int ))); // 点击数
DataColumn column = new DataColumn();
column.ColumnName = " id " ;
column.AutoIncrement = true ;
column.AutoIncrementSeed = 1 ;
column.AutoIncrementStep = 1 ;
table.Columns.Add(column);
DataRow row;
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ ) // 循环人 假如 5 个人
{
string getUserAccount = ds.Tables[ 0 ].Rows[i][ " UserAccount " ].ToString(); // 此人的帐号
string getSurName = ds.Tables[ 0 ].Rows[i][ " SurName " ].ToString(); // 此人的姓名
string sqlc = " select SID,Hits from SecondHandHouse where UserAccount = ' " + getUserAccount + " ' and BuySell = '出售' order by SID desc " ; // 找出此人发布的房源
DataSet ds1 = newDb.CommonDataSet(sqlc);
string sqln = "" ;
string hid = "" ;
int hitsNum = 0 ;
if (ds1.Tables[ 0 ].Rows.Count > 0 ) // 如果此人已经发布了房源,假如是10套
{
for ( int ii = 0 ;ii < ds1.Tables[ 0 ].Rows.Count;ii ++ ) // 循环 10 次房源
{
hid = ds1.Tables[ 0 ].Rows[ii][ " SID " ].ToString(); // 这次房源的ID号
sqln = " select Hits from SecondHandHouse where SID = ' " + hid + " ' " ; // 找到这个房源的被点击数
hitsNum += int .Parse(ds1.Tables[ 0 ].Rows[ii][ " Hits " ].ToString()); // 累加这些点击数
}
}
else
{
hitsNum = 0 ;
}
row = table.NewRow();
row[ 0 ] = " " + getSurName + " " ;
row[ 1 ] = " " + hitsNum + " " ;
table.Rows.Add(row);
}
DataView dv = table.DefaultView;
dv.Sort = " HitsNumber desc " ;
DataTable dtNew = table.Clone();
for ( int i = 0 ; i < 10 ; i ++ )
{
dtNew.ImportRow(dv[i].Row);
}
this .Repeater1.DataSource = dtNew;
this .Repeater1.DataBind();
}
{
string sql = " select UserAccount,SurName from ClerkAccount order by PID desc " ;
DataSet ds = newDb.CommonDataSet(sql);
DataTable table = new DataTable();
table.Columns.Add( new DataColumn( " ClerkName " , typeof ( string ))); // 姓名
table.Columns.Add( new DataColumn( " HitsNumber " , typeof ( int ))); // 点击数
DataColumn column = new DataColumn();
column.ColumnName = " id " ;
column.AutoIncrement = true ;
column.AutoIncrementSeed = 1 ;
column.AutoIncrementStep = 1 ;
table.Columns.Add(column);
DataRow row;
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ ) // 循环人 假如 5 个人
{
string getUserAccount = ds.Tables[ 0 ].Rows[i][ " UserAccount " ].ToString(); // 此人的帐号
string getSurName = ds.Tables[ 0 ].Rows[i][ " SurName " ].ToString(); // 此人的姓名
string sqlc = " select SID,Hits from SecondHandHouse where UserAccount = ' " + getUserAccount + " ' and BuySell = '出售' order by SID desc " ; // 找出此人发布的房源
DataSet ds1 = newDb.CommonDataSet(sqlc);
string sqln = "" ;
string hid = "" ;
int hitsNum = 0 ;
if (ds1.Tables[ 0 ].Rows.Count > 0 ) // 如果此人已经发布了房源,假如是10套
{
for ( int ii = 0 ;ii < ds1.Tables[ 0 ].Rows.Count;ii ++ ) // 循环 10 次房源
{
hid = ds1.Tables[ 0 ].Rows[ii][ " SID " ].ToString(); // 这次房源的ID号
sqln = " select Hits from SecondHandHouse where SID = ' " + hid + " ' " ; // 找到这个房源的被点击数
hitsNum += int .Parse(ds1.Tables[ 0 ].Rows[ii][ " Hits " ].ToString()); // 累加这些点击数
}
}
else
{
hitsNum = 0 ;
}
row = table.NewRow();
row[ 0 ] = " " + getSurName + " " ;
row[ 1 ] = " " + hitsNum + " " ;
table.Rows.Add(row);
}
DataView dv = table.DefaultView;
dv.Sort = " HitsNumber desc " ;
DataTable dtNew = table.Clone();
for ( int i = 0 ; i < 10 ; i ++ )
{
dtNew.ImportRow(dv[i].Row);
}
this .Repeater1.DataSource = dtNew;
this .Repeater1.DataBind();
}