genMenu במחלקה utils

public String genMenu(int pageID,bool isLogin,bool isAdmin)
{
String str = "";
List<pageTBL> pageList = (from s in db.pageTBL orderby s.order select s).ToList();

foreach (pageTBL x in pageList)
{
if (x.pemission == 3)
{
if (isLogin)
{
if (x.Id != 3 && x.Id != 4)
{
str += "<li";
if (x.Id == pageID)
{
str += " class='selected'";
}
str += "> <a href='" + x.link + "'>" + x.title + "</a></li>";
}

}
else
{
str += "<li";
if (x.Id == pageID)
{
str += " class='selected'";
}
str += "> <a href='" + x.link + "'>" + x.title + "</a></li>";
}
}
else if (x.pemission == 2 && isLogin)
{
str += "<li";
if (x.Id == pageID)
{
str += " class='selected'";
}
str += "> <a href='" + x.link + "'>" + x.title + "</a></li>";
}
else if (x.pemission == 1 && isLogin && isAdmin)
{
str += "<li";
if (x.Id == pageID)
{
str += " class='selected'";
}
str += "> <a href='" + x.link + "'>" + x.title + "</a></li>";
}

}

return str;
}

הטבלה

כתיבת תגובה