@using System.Data
@using ZoomLa.SQLDAL
@using ZoomLaCMS.Resources;
@functions{
public int CPage { get { return DataConvert.CLng(Context.Request.Query["cpage"], 1); } }
public string model_lit = "";
public string page_lit = "";
private void MyBind()
{
string[] sizeArr = new string[] { "col-lg-2 col-md-3", "col-lg-1 col-md-1", "col-lg-2 col-md-3", "col-lg-4 col-md-4" };
int pageSize = 12;
//------------------------
string div = "
{3}
";
string href = " {3}";
string hid = "d-none d-sm-block";
DataTable dt = DBCenter.Sel("ZL_Search", "type=1 AND State=1","OrderID ASC");
foreach (DataRow dr in dt.Rows)
{
dr["fileUrl"] = DataConvert.CStr(dr["fileUrl"]).ToLower().Replace("/manage/",Call.PA("")).Replace(".aspx","");
}
int pageCount = PageCommon.GetPageCount(pageSize, dt.Rows.Count);
for (int i = 0; i < pageSize; i++)
{
try
{
int index = (CPage - 1) * pageSize + i;
string labelID = "Label" + (i + 1);
DataRow dr = dt.Rows[index];
string name = dr["name"].ToString();
name = name.Length > 4 ? name.Substring(0, 3) : name;
string openType = DataConvert.CStr(dr["OpenType"]) .Equals("0") ? "_self" : "_blank";
string value = string.Format(href, dr["FileUrl"], openType, dr["ico"], dr["name"]);//链接字符串
string size = sizeArr[DataConvert.CLng(dr["size"])];//默认为中
string mobile = DataConvert.CStr(dr["Mobile"]).Equals("1") ? "" : hid;//是否在小屏中显示
model_lit += string.Format(div, size, mobile, dr["BKColor"], value);
}
catch { break; }
}
page_lit = CreatePaging(pageCount, CPage);
}
public string CreatePaging(int pageCount, int cPage)
{
if (pageCount < 2) return "";
#region 前台最终Html
//
#endregion
pageCount = pageCount < 1 ? 1 : pageCount;
cPage = cPage < 1 ? 1 : cPage;
string pageHtml = "";
return pageHtml;
}
}
@{
MyBind();
}
@section head{
@L.快速导航
}
@section content{
@Html.Raw(model_lit)
@Html.Raw(page_lit)
}
@section script{ }