private void ViewPage(int uid) { int favid = int.Parse(Utils.GetRequest("favid", "get", 2, @"^[1-9]\d*$", "ID错误")); int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误")); if (!new BCW.BLL.Favorites().Exists(favid, id, uid)) { Utils.Error("不存在的收藏记录", ""); } BCW.Model.Favorites model = new BCW.BLL.Favorites().GetFavorites(favid); Master.Title = "查看收藏"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("" + BCW.User.AppCase.CaseFav(model.Types) + ":" + model.Title + ""); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); if (model.Types == 0) { builder.Append("地址:" + model.PUrl + "<br />"); builder.Append("<a href=\"gourl.aspx?tt=" + model.PUrl + "&ve=" + Utils.getstrVe() + "\">>马上访问</a><br />"); } else { builder.Append("<a href=\"" + Utils.getUrl(model.PUrl + "&backurl=" + Utils.PostPage(1) + "") + "\">>进入查看</a><br />"); } builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=edit&id=" + id + "&favid=" + favid + "&backurl=" + Utils.getPage(0) + "") + "\">编辑</a>."); builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=del&id=" + id + "&favid=" + favid + "&backurl=" + Utils.getPage(0) + "") + "\">删除</a>"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("favorites.aspx?act=list&id=" + id + "") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx") + "\">收藏夹</a>"); builder.Append(Out.Tab("</div>", "")); }
private void EditPage(int uid) { Master.Title = "编辑收藏"; int favid = int.Parse(Utils.GetRequest("favid", "get", 2, @"^[1-9]\d*$", "ID错误")); int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误")); if (!new BCW.BLL.Favorites().Exists(favid, id, uid)) { Utils.Error("不存在的收藏记录", ""); } BCW.Model.Favorites model = new BCW.BLL.Favorites().GetFavorites(favid); string sType = "text"; if (model.Types > 0) { sType = "hidden"; } string strFavgroup = string.Empty; DataSet ds = new BCW.BLL.Favgroup().GetList("ID,Title", "UsID=" + uid + " and Types=0"); if (ds != null && ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { strFavgroup += "|" + ds.Tables[0].Rows[i]["ID"] + "|" + ds.Tables[0].Rows[i]["Title"] + ""; } } strFavgroup = Utils.Mid(strFavgroup, 1, strFavgroup.Length); builder.Append(Out.Tab("<div class=\"title\">编辑收藏</div>", "")); builder.Append(Out.Tab("<div>", "")); builder.Append("标题:"); builder.Append(Out.Tab("</div>", "")); strText = ",地址:/,请选择收藏夹:/,,,,"; strName = "Title,PUrl,NodeId,favid,ptype,act,backurl"; strType = "text," + sType + ",select,hidden,hidden,hidden,hidden"; strValu = "" + model.Title + "'" + model.PUrl + "'" + model.NodeId + "'" + favid + "'" + model.Types + "'editsave'" + Utils.getPage(0) + ""; strEmpt = "false,false," + strFavgroup + ",false,false,false,false"; strIdea = "/"; strOthe = "编辑收藏,favorites.aspx,post,1,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div>", "")); builder.Append(" <a href=\"" + Utils.getUrl("favorites.aspx?act=view&&id=" + id + "&favid=" + favid + "&backurl=" + Utils.getPage(0) + "") + "\">取消</a>"); builder.Append(Out.Tab("</div>", "")); }
private void SavePage(int uid) { string PUrl = string.Empty; int ptype = int.Parse(Utils.GetRequest("ptype", "post", 1, @"^[1-5]$", "0")); string Title = Utils.GetRequest("Title", "post", 2, @"^[^\^]{1,30}$", "标题限1-30字"); if (ptype == 0) { PUrl = Utils.GetRequest("PUrl", "post", 2, @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?", "请输入正确的地址"); } else { PUrl = Utils.GetRequest("PUrl", "post", 2, @"(/[\w- ./?%&=]*)?", "收藏地址错误"); } int NodeId = int.Parse(Utils.GetRequest("NodeId", "post", 2, @"^[0-9]\d*$", "收藏夹ID错误")); if (!new BCW.BLL.Favgroup().Exists(NodeId, uid, 0)) { Utils.Error("不存在的收藏夹", ""); } if (new BCW.BLL.Favorites().ExistsTitle(uid, Title, PUrl)) { Utils.Error("重复收藏", ""); } BCW.Model.Favorites model = new BCW.Model.Favorites(); model.Types = ptype; model.NodeId = NodeId; model.UsID = uid; model.Title = Title; model.PUrl = PUrl; model.AddTime = DateTime.Now; int favid = new BCW.BLL.Favorites().Add(model); Utils.Success("新建收藏", "收藏成功,正在返回..<br /><a href=\"" + Utils.getUrl("favorites.aspx?act=view&id=" + NodeId + "&favid=" + favid + "&backurl=" + Utils.getPage(0) + "") + "\">>查看收藏</a>", Utils.getPage("favorites.aspx"), "3"); }
private void ListPage(int uid) { int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[0-9]\d*$", "0")); int showtype = int.Parse(Utils.GetRequest("showtype", "get", 1, @"^[1-5]\d*$", "0")); int id = int.Parse(Utils.GetRequest("id", "get", 1, @"^[0-9]\d*$", "0")); string sText = string.Empty; if (id != 0) { sText = new BCW.BLL.Favgroup().GetTitle(id, uid, 0); if (sText == "") { Utils.Error("不存在的记录", ""); } } else { sText = "我的全部收藏"; } sText = "我的" + BCW.User.AppCase.CaseFav(showtype) + "收藏"; Master.Title = sText; builder.Append(Out.Tab("<div class=\"title\">" + sText + "</div>", "")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = ""; string[] pageValUrl = { "ptype", "showtype", "act", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } //查询条件 if (id != 0) { strWhere = "UsID=" + uid + " and NodeId=" + id + ""; } else { if (showtype != 0) { strWhere = "UsID=" + uid + " and Types=" + showtype + ""; } else { strWhere = "UsID=" + uid + ""; } } // 开始读取列表 IList <BCW.Model.Favorites> listFavorites = new BCW.BLL.Favorites().GetFavoritess(pageIndex, pageSize, strWhere, out recordCount); if (listFavorites.Count > 0) { int k = 1; foreach (BCW.Model.Favorites n in listFavorites) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=view&id=" + n.NodeId + "&favid=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + ((pageIndex - 1) * pageSize + k) + "." + n.Title + "</a>"); if (ptype == 1) { builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=del&id=" + n.NodeId + "&favid=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[删除]</a>"); } k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div>", "<br />")); if (ptype == 0) { builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=list&ptype=1&showtype=" + showtype + "&id=" + id + "&backurl=" + Utils.getPage(0) + "") + "\">>切换管理</a>"); } else { builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx?act=list&ptype=0&showtype=" + showtype + "&id=" + id + "&backurl=" + Utils.getPage(0) + "") + "\">>切换普通</a>"); } builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("uinfo.aspx?uid=" + uid + "") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("favorites.aspx") + "\">收藏夹</a>"); builder.Append(Out.Tab("</div>", "")); }