62,046
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 绑定产品目录列表
/// </summary>
/// <param name="cid">公司ID</param>
protected void BindBigProductCataLog(string cid)
{
Catagary ca = new Catagary();
BllGlodMemberProductCatagorySort bllcatagory = new BllGlodMemberProductCatagorySort();
ArrayList al = ca.GetOfferCatalogIDSort(cid);
ArrayList al2 = bllcatagory.GetCatalogList(cid);
if (al != null && al2 != null)
{
if (al.Count == al2.Count)
{
al = al2;
}
}
DataTable dt = ca.GetAllProductCatalogChildSort(cid);
DataTable dt2 = bllcatagory.GetChildCatalogList(cid);
rptCatalogOne.DataSource = al;
rptCatalogOne.DataBind();
foreach (RepeaterItem rpone in rptCatalogOne.Items)
{
int i = rpone.ItemIndex;
int cateGoryoneId;
if (int.TryParse(al[i].ToString(), out cateGoryoneId))
{
DataTable listTwo = null;
if (dt != null)
{
listTwo = ca.GetChildCatalogListByParentIDSort(cateGoryoneId, dt);
}
DataTable listThree = null;
if (dt2 != null)
{
listThree = ca.GetChildCatalogListByParentIDSort(cateGoryoneId, dt2);
}
DataTable list_temp = null;
if (listThree != null && listTwo != null)
{
if (listTwo.Rows.Count == listThree.Rows.Count)
{
list_temp = listThree;
}
else
{
list_temp = listTwo;
}
}
else
{
list_temp = listTwo;
}
Repeater rptCatalogTwo = (Repeater)rpone.FindControl("rptCatalogTwo");
rptCatalogTwo.DataSource = list_temp;
rptCatalogTwo.DataBind();
//释放资源
listTwo.Dispose();
listTwo = null;
listThree.Dispose();
listThree = null;
list_temp.Dispose();
list_temp = null;
}
}
//后面加上了释放资源
dt.Dispose();
dt = null;
dt2.Dispose();
dt2 = null;
}