/// <summary> /// 绑定分组列表 /// </summary> public void BindGroupList() { Int32 RecordCount = 0; System.Text.StringBuilder GroupString = new System.Text.StringBuilder(); QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryPro_Group._.Sort; qp.OrderType = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, Settings_ModuleID, SearchType.Equal)); List <DNNGo_DNNGalleryPro_Group> GroupList = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount); DNNGo_DNNGalleryPro_Group ThisAllGroup = new DNNGo_DNNGalleryPro_Group(); ThisAllGroup.ID = 0; ThisAllGroup.Name = "All"; GroupList.Insert(0, ThisAllGroup); foreach (DNNGo_DNNGalleryPro_Group GroupItem in GroupList) { String activeClass = GroupItem.ID == GroupID ? "active" : ""; String LinkHref = xUrl(String.Format("GroupID{0}", ModuleId), GroupItem.ID.ToString(), "ManagerList", string.Format("Status={0}", ArticleStatus)); GroupString.AppendFormat("<a href=\"{0}\" class=\"btn btn-default {1}\">{2}</a>", LinkHref, activeClass, GroupItem.Name).AppendLine(); } liGroups.Text = GroupString.ToString(); }
/// <Description> /// 拼接分类的JSon数据 /// </Description> /// <param name="lst">分类列表</param> /// <param name="ParentID">上级编号</param> /// <returns>Json数据</returns> private String CreateGroupsJson(List <DNNGo_DNNGalleryPro_Group> lst, Int32 ParentID, List <Int32> SelectList) { //筛选数据并排列 QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryPro_Group._.Sort; qp.OrderType = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleId, SearchType.Equal)); int RecordCount = 0; List <DNNGo_DNNGalleryPro_Group> TempList = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount); //TempList = TempList.Sort(DNNGo_DNNGalleryPro_Group._.Sort, false); //取出数据进行拼接 StringBuilder sb = new StringBuilder(); if (ParentID == 0) { sb.Append("<ul id=\"Groupschecklist\" class=\"Categories_list list:Groups Groupschecklist form-no-clear\">"); } else { sb.Append("<ul class=\"children\">"); } foreach (DNNGo_DNNGalleryPro_Group Groups in TempList) { sb.AppendFormat("<li id=\"Groups-{0}\">", Groups.ID); sb.Append("<label class=\"checkbox-inline selectit\">"); sb.AppendFormat("<input value=\"{0}\" class=\"square-green\" type=\"checkbox\" name=\"{1}\" id=\"post_groups_{2}\" {4} />{3}</label>", Groups.ID, String.Format("post$groups${0}", ModuleId), String.Format("post_groups_{0}", ModuleId), Groups.Name, SelectList.Contains(Groups.ID) ? "checked=\"checked\"" : ""); //String ttString = CreateGroupsJson(lst, Groups.ID, SelectList); //if (!String.IsNullOrEmpty(ttString)) //{ // sb.Append(ttString); //} sb.Append("</li>"); } sb.Append("</ul>"); if (TempList.Count > 0) { return(sb.ToString()); } else { return(String.Empty); } }
/// <summary> /// 分组列表 /// </summary> /// <returns></returns> public List <DNNGo_DNNGalleryPro_Group> GetGroupList() { QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryPro_Group._.Sort; qp.OrderType = 0; int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, Settings_ModuleID, SearchType.Equal)); return(DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount)); }
/// <Description> /// 绑定树分类 /// </Description> private void BindTreeGroups(DNNGo_DNNGalleryPro_Slider Article) { List <Int32> SelectList = new List <Int32>(); StringBuilder select = new StringBuilder(); if (Article != null && Article.ID > 0) { //填充分类的关系 List <DNNGo_DNNGalleryPro_Slider_Group> Relationships = DNNGo_DNNGalleryPro_Slider_Group.FindAllByArticleID(Article.ID); foreach (DNNGo_DNNGalleryPro_Slider_Group Groups in Relationships) { SelectList.Add(Groups.GroupID); select.AppendFormat("{0},", Groups.GroupID); } } //绑定所有分类到页面 QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryPro_Group._.Sort; qp.OrderType = 0; int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleId, SearchType.Equal)); List <DNNGo_DNNGalleryPro_Group> lst = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount); //拼接顶级分类的方法 StringBuilder sb = new StringBuilder(); sb.Append("<div id=\"Groups-all\" class=\"tabs-panel\">"); String ttString = CreateGroupsJson(lst, 0, SelectList); if (!String.IsNullOrEmpty(ttString)) { sb.Append(ttString); } sb.Append("</div>"); liGroups.Text = sb.ToString(); }
/// <summary> /// 插入单项 /// </summary> /// <param name="ContentItem"></param> /// <param name="GroupName"></param> /// <returns></returns> public static Int32 InsertItem(DNNGo_DNNGalleryPro_Slider ContentItem, String GroupName) { int RecordCount = 0; if (!String.IsNullOrEmpty(GroupName)) { List <String> GroupNames = Common.GetList(GroupName); if (GroupNames != null && GroupNames.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (String GroupString in GroupNames) { sb.AppendFormat("'{0}',", GroupString); } QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ContentItem.ModuleId, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, sb.ToString().Trim(','), SearchType.In)); List <DNNGo_DNNGalleryPro_Group> Groups = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount); if (Groups != null && Groups.Count > 0) { RecordCount = 0; foreach (DNNGo_DNNGalleryPro_Group GroupItem in Groups) { DNNGo_DNNGalleryPro_Slider_Group Content_Group = new DNNGo_DNNGalleryPro_Slider_Group(); Content_Group.GroupID = GroupItem.ID; Content_Group.SliderID = ContentItem.ID; if (Content_Group.Insert() > 0) { RecordCount++; } } } } } return(RecordCount); }
/// <summary> /// 绑定右边列表 /// </summary> private void BindDataList() { QueryParam qp = new QueryParam(); qp.PageSize = 10; qp.PageIndex = PageIndex; qp.Orderfld = Orderfld; qp.OrderType = OrderType; int RecordCount = 0; //查询的方法 qp.Where = BindSearch(); List <DNNGo_DNNGalleryPro_Group> lst = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount); qp.RecordCount = RecordCount; RecordPages = qp.Pages; lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages")); gvArticleList.DataSource = lst; gvArticleList.DataBind(); }