/// <summary> /// 设置数据项 /// </summary> private void SetSortList() { //查询出当前字段的列表 String jsonFields = WebHelper.GetStringParam(Request, nestable_output.UniqueID, ""); if (!String.IsNullOrEmpty(jsonFields)) { JavaScriptSerializer json = new JavaScriptSerializer(); List <DNNGo_ThemePlugin_Relationships> json_fields = json.Deserialize <List <DNNGo_ThemePlugin_Relationships> >(jsonFields); if (json_fields != null && json_fields.Count > 0) { List <DNNGo_ThemePlugin_Relationships> FieldLists = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType); for (int i = 0; i < json_fields.Count; i++) { DNNGo_ThemePlugin_Relationships DBField = FieldLists.Find(r => r.ID == json_fields[i].ID); if (DBField != null && DBField.ID > 0 && DBField.Sort != i) { DBField.Sort = i; DBField.Update(); } } } } }
/// <summary> /// 绑定相册集 /// </summary> private void BindPictures(TabInfo Article) { List <String> SelectList = new List <String>(); if (Article != null && Article.TabID > 0) { //填充相册集的关系 List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType); RepeaterFields.DataSource = Relationships; RepeaterFields.DataBind(); foreach (DNNGo_ThemePlugin_Relationships Albums in Relationships) { SelectList.Add(Albums.FileID.ToString()); } } if (Article != null && Article.TabID > 0 && SelectList.Count > 0) { //绑定所有分类到页面 QueryParam qp = new QueryParam(); int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalId, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(SelectList), SearchType.In)); List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount); //拼接顶级分类的方法 StringBuilder sb = new StringBuilder(); StringBuilder sbIDs = new StringBuilder(); foreach (String FileID in SelectList) { if (lst.Exists(r => r.ID.ToString() == FileID)) { DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID); sb.AppendFormat("<tr data-value='{0}'>", PictureItem.ID).AppendLine(); sb.AppendFormat("<td>{0}<br/><img src=\"{1}\" style=\"max-width:120px; margin-right:15px;\"/></td>", PictureItem.FileName, GetPhotoExtension(PictureItem.FileExtension, PictureItem.FilePath)).AppendLine(); sb.AppendFormat("<td class=\"center\"><a data-value='{0}' class=\"btn btn-xs btn-bricky tooltips\" href=\"javascript:;\" data-placement=\"top\" data-original-title=\"Delete\"><i class=\"fa fa-times fa fa-white\"></i></a></td>", PictureItem.ID).AppendLine(); sb.Append("</tr>").AppendLine(); sbIDs.AppendFormat("{0},", PictureItem.ID); } } hfPictures.Value = sbIDs.ToString(); liPictures.Text = sb.ToString(); } }