public int AddNavigation(string parentId, string navName, string url, int type, string description) { using (var context = new WSI.DataAccess.WSICmsContext()) { FrontendNavigation nav = new FrontendNavigation(); nav.NavName = navName; nav.Url = url; nav.Type = type; //添加父导航 Guid pid; if (Guid.TryParse(parentId, out pid)) { nav.Parent = context.FrontendNavigations.Find(pid); } nav.Description = description; nav.State = (int)EnumHelper.State.Enable; nav.CreateTime = DateTime.Now; context.FrontendNavigations.Add(nav); context.LogChangesDuringSave = true; return context.SaveChanges(); } }
protected void Page_Load(object sender, EventArgs e) { //每次页面回发触发 if (navid != "") { nav = service.GetDetail(navid); if (nav != null) { var children = service.GetSortedListByParentId(nav.NavId.ToString()); if (children.Count > 0) { //第一个子栏目--媒体报道 firstChild = children[0]; } if (children.Count > 1) { //第二个子栏目--公司动态 secondChild = children[1]; } } var list = tagService.GetInformationsByTagCode(news_joyvio); joyVio = list.ElementAtOrDefault(0); } if (!IsPostBack) { bindInformation(); } }
protected IList<Information> GetInformations(FrontendNavigation nav) { if (nav != null) { int count; return infoService.GetActivePagedInfosByNavId(nav.NavId.ToString(), 1, NEWS_COUNT, out count); } return null; }
public static string GetNavigationUrl(FrontendNavigation nav) { string url = nav.Url; if (nav.Type == (int)NavigationType.List) { url = string.Format("{0}?navid={1}", url, nav.NavId); } return url; }
protected void Page_Load(object sender, EventArgs e) { if (navid != "") { nav = navService.GetDetail(navid); } if (!IsPostBack) { bindInformation(); } }
public int ChangeState(FrontendNavigation nav, int state) { using (var context = new WSI.DataAccess.WSICmsContext()) { context.FrontendNavigations.Attach(nav); nav.State = state; context.LogChangesDuringSave = true; return context.SaveChanges(); } }
protected string GetParentNavigationName(FrontendNavigation nav) { if (nav.ParentId != null) { var parent = navService.GetDetail(nav.ParentId.ToString()); if (parent != null) { return parent.NavName; } } return ""; }
protected string WriteNavigationBar(FrontendNavigation nav) { string result = string.Format(" > <a href='{0}'>{1}</a>", Common.GetNavigationUrl(nav), nav.NavName); if (nav.ParentId != null) { var parent = navService.GetDetail(nav.ParentId.ToString()); return WriteNavigationBar(parent) + result; } else { return result; } }
protected void Page_Load(object sender, EventArgs e) { nav = service.GetDetail(navid); if (!IsPostBack) { if (nav != null) { //绑定产业链动态的子栏目 repRight.DataSource = service.GetSortedListByParentId(navid).Where(n => n.State == (int)EnumHelper.State.Enable); repRight.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (navid != "") { nav = navService.GetDetail(navid); if (nav != null && nav.ParentId != null) { parent = navService.GetDetail(nav.ParentId.ToString()); } } if (!IsPostBack) { bindCookBook(); } }
protected void Page_Load(object sender, EventArgs e) { if (infoid != "") { info = service.GetDetailIncludeAll(infoid); } if (navid != null) { nav = navService.GetDetail(navid); prev = service.GetPrevRecord(infoid, navid); next = service.GetNextRecord(infoid, navid); } if (!IsPostBack) { } }
protected void Page_Load(object sender, EventArgs e) { if (navid != "") { nav = service.GetDetail(navid); var children = service.GetSortedListByParentId(navid); if (children.Count > 0) { Response.Redirect("/Agriculture/Trends.aspx?navid=" + children[0].NavId.ToString()); } } if (!IsPostBack) { bindInformation(); } }
protected void Page_Load(object sender, EventArgs e) { if (navid != "") { nav = service.GetDetail(navid); //如果当前栏目含有子栏目,则默认加载第一个子栏目 var children = service.GetSortedListByParentId(nav.NavId.ToString()); if (children.Count > 0) { nav = children[0]; } } if (!IsPostBack) { bindInformation(); } }
private string getTreeItemText(FrontendNavigation nav, int indent) { //0 栏目名称 //1 编号 //2 前台路径 //3 描述 //4 栏目类别 //5 显示栏目名称的span的宽度 //6 状态 //7 command url string command_url = "/handler/command/Frontend_NavigationCommand.ashx"; string item_format = @" <span title='{3}' class='nav_name' style='width:{5}px' > <span>{0}</span> </span> <span class='nav_url'>路径:{2}</span> <span class='nav_type'>类别:{4}</span> <a class='active' href='/Information/FrontendNavigationAdd.aspx?pid={1}' >添加子栏目</a> <a class='active' href='/Information/FrontendNavigationAdd.aspx?nid={1}'><img src='/!images/icon_edit.png' title='点击编辑' alt='编辑' /></a> <span class='command'> <!--JS调用在default.js中--> <!--参数--> <input name='entity_state' type='hidden' value='{6}' /> <input name='command_url' type='hidden' value='{7}' /> <input name='command_argument' type='hidden' value='{1}' /> <!--修改状态--> <a href='javascript:void()' name='disable'> <img alt='禁用' src='/!images/icon_enable.png' title='点击禁用' /></a> <a href='javascript:void()' name='enable'> <img alt='启用' src='/!images/icon_disable.png' title='点击启用' /></a> <!--删除--> <a href='javascript:void()' name='delete'> <img alt='删除' src='/!images/icon_delete.png' title='点击删除' /> </a> </span> "; //手动解决TreeView缩进对样式的影响 int width = 300; int name_width = width - indent; string type = Utility.EnumHelper.GetEnumDesc(typeof(NavigationType), nav.Type); return string.Format(item_format, nav.NavName, nav.NavId, nav.Url, nav.Description, type, name_width, nav.State, command_url); }
protected void Page_Load(object sender, EventArgs e) { leftNav = service.GetDetail(Common.AGRICLUTURE_IDEA_ID); }
protected IList<FrontendNavigation> GetChildren(FrontendNavigation parent) { return service.GetSortedListByParentId(parent.NavId.ToString()) .Where(n => n.State == (int)EnumHelper.State.Enable) .ToList(); }
protected IList<CookBook> GetRightDataSource(FrontendNavigation nav) { var rightNav = GetRightSubNav(nav); int count; return service.GetActiveSortedPagedListByNavId(rightNav.NavId.ToString(), 1, PAGE_SIZE, out count); }
protected FrontendNavigation GetRightSubNav(FrontendNavigation nav) { return navService.GetSortedListByParentId(nav.NavId.ToString()) .ElementAtOrDefault(1); }