예제 #1
0
        /// <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();
            }
        }
예제 #2
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void BindDataToPage()
 {
     RepeaterFields.DataSource = FieldList;
     RepeaterFields.DataBind();
 }