public string YqLinkHtml(string Top) { string YqLinks = ""; List <link> YqList = new List <link>(); if (Top == "All") { YqList = lm.GetAllLinks(); } else { YqList = lm.GetAllLinks(int.Parse(Top)); } foreach (link yq in YqList) { string HtmlImg = yq.Is_image == 1 ? "<img src='" + yq.Img_url + "' style='width:50px;height:20;'>" : yq.Title; YqLinks += " <a class=\"spanlink2\" href=\"" + yq.Site_url + "\" target=\"_blank\">" + HtmlImg + "</a> "; } return(YqLinks); }
public ActionResult GetLinks() { try { return(Json(LinksManager.GetAllLinks(), JsonRequestBehavior.AllowGet)); } catch { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }
public void GetAllLinks(HttpContext context) { int PageSize = int.Parse(context.Request["PageSize"]); int PageNum = int.Parse(context.Request["PageNum"]); string WhereStr = context.Request["WhereStr"].Replace("where", ""); List <link> list = new List <link>(); list = lm.GetAllLinks(PageSize, PageNum, WhereStr, "sort_id asc,add_time desc"); string HtmlStr = ""; Boolean IsEdit = rcm.GetRoleCompetence(GetUser(context).RoleId, 1431); Boolean IsDel = rcm.GetRoleCompetence(GetUser(context).RoleId, 1433); foreach (link l in list) { string ImageHtml = l.Is_image == 1 ? "<img src='" + l.Img_url + "' width='50' height='20'>" : "文字链接"; string IsRedHtml = l.Is_red == 1 ? "<img src='../Images/Admin/ico-2.png' title='取消推荐'>" : "<img src='../Images/Admin/ico-2_.png' title='设置推荐'>"; string IsLockHtml = l.Is_lock == 1 ? "<img src='../Images/Admin/ico-5.png' title='通过审核'>" : "<img src='../Images/Admin/ico-5_.png' title='暂未通过审核'>"; string EditHtml = IsEdit ? " <a href=\"/Settings/LinkEdit?Id=" + l.Id + "\">" + l.Title + "</a> " : "<a>" + l.Title + "</a> "; string DelHtml = IsDel ? "<a href=\"javascript:InitPageContent('Links')\" onclick=\"Del('/Settings/DelLink?Id=" + l.Id + "')\">删除</a>" : " "; HtmlStr += "<tr><td>" + l.Id + "</td><td>" + EditHtml + "</td><td>" + ImageHtml + "</td><td>" + l.Add_time + "</td><td>" + l.Sort_id + "</td><td>" + IsRedHtml + IsLockHtml + "</td><td>" + DelHtml + "</td></tr>"; } context.Response.Write(HtmlStr); }