1.如果视频有三级分类的获取三级分类,
2.没有的取上一级分类,
3.同时取出改分类的链接地址级
由于视频可能归属的类别级数不受限制,由用户自己定义级别及分配视频;所以视频可能分配在5,6级以下的分类,也有可能分配到顶级分类中;这样就只能为每条记录单独获取三级分类信息。
如果每次往返数据库的话,性能受到很大影响,所以我采用Cache跟DataSet查询来做!
DataRow[] Dr;
DataSet DsType;
object obj = this.GetCache("DsType");
if (obj == null)
{
obj = Public.SqlHelper.ExecuteDataset(ConnStr, CommandType.StoredProcedure, "PROC_ChanNel_List", new SqlParameter("@Fld_Rank", "114"));
this.SetCache("DsType", obj);
}
DsType = (DataSet)obj;//该顶级下的所以分类
if (Ds.Tables[0].Rows.Count > 0)//信息列表循环
{
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
{
_vFld_VID = Ds.Tables[0].Rows[i]["Fld_VID"].ToString();
_vFld_LTitle = Ds.Tables[0].Rows[i]["Fld_Title"].ToString().Trim();
_vFld_Picture1 = Ds.Tables[0].Rows[i]["Fld_Picture1"].ToString();
_vFld_Title = GreenChina.Public.Function.CutString(_vFld_LTitle, 13, "..");
_vFld_Rank = Ds.Tables[0].Rows[i]["Fld_Rank"].ToString();
ll = _vFld_Rank.Length > 9 ? 9 : _vFld_Rank.Length;
Dr = DsType.Tables[0].Select("Fld_Rank='" + _vFld_Rank.Substring(0, ll) + "'");//如果有三级分类则取三级分类,否则取二级或者顶级分类
_vFld_URL = Dr[0]["Fld_URL"].ToString();
_vFld_CID = Dr[0]["Fld_CID"].ToString();
_vFld_BTitle = Dr[0]["Fld_Title"].ToString();
_vFld_Sign = Dr[0]["Fld_Sign"].ToString();
if (_vFld_URL == "")
_vFld_URL = "wslmlist.aspx?tid=" + _vFld_CID + "&ty=" + _vFld_Sign;
_vPlay_URL = Public.Function.GetPlay(_vFld_Rank.Substring(0, 3));
_vPlay_URL = _vPlay_URL + "?id=" + _vFld_VID;
hddWslm.Text += "<tr>";
hddWslm.Text += "<td height='20' class='zi2'> · <a href='" + Server.HtmlEncode(_vPlay_URL) + "' title='" + _vFld_LTitle + "' target='_blank' class='menu_huang'>" + Server.HtmlEncode(_vFld_Title) + "</a> </td><td width='80'><a href='" + _vFld_URL + "' class='menu_lan' target='_blank'>[" + _vFld_BTitle + "]</a></td>";
hddWslm.Text += "</tr>";
}
}
else
{
hddWslm.Text = "";
}