Exemple #1
0
        /// <summary>
        /// Gallery数据转XML实体
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public XmlSliserEntity EntityToXml(DNNGo_DNNGalleryPro_Slider ContentItem)
        {
            XmlSliserEntity ContentXml = new XmlSliserEntity();

            ContentXml.Sort   = ContentItem.Sort;
            ContentXml.Status = ContentItem.Status;

            //将Options提取出来处理后再还原
            ContentXml.Options = Common.XmlEncode(ConvertOptions(ContentItem.Options, Setting_SliderSettingDB));
            ContentXml.Groups  = DNNGo_DNNGalleryPro_Group.FindGroupsBySliderID(ContentItem.ID);

            ContentXml.Extension = ContentItem.Extension;

            //提取所有的Layers信息
            ContentXml.Layers = Common.XmlEncode(ConvertLayers(ContentItem));

            ContentXml.StartTime  = ContentItem.StartTime;
            ContentXml.EndTime    = ContentItem.EndTime;
            ContentXml.CreateTime = ContentItem.CreateTime;

            return(ContentXml);
        }
Exemple #2
0
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvArticleList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                DNNGo_DNNGalleryPro_Slider Article = e.Row.DataItem as DNNGo_DNNGalleryPro_Slider;

                if (Article != null && Article.ID > 0)
                {
                    HyperLink  hlEdit          = e.Row.FindControl("hlEdit") as HyperLink;
                    HyperLink  hlMobileEdit    = e.Row.FindControl("hlMobileEdit") as HyperLink;
                    LinkButton btnRemove       = e.Row.FindControl("btnRemove") as LinkButton;
                    LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton;

                    //移动分类按钮
                    LinkButton lbSortUp         = e.Row.FindControl("lbSortUp") as LinkButton;
                    LinkButton lbSortDown       = e.Row.FindControl("lbSortDown") as LinkButton;
                    LinkButton lbMobileSortUp   = e.Row.FindControl("lbMobileSortUp") as LinkButton;
                    LinkButton lbMobileSortDown = e.Row.FindControl("lbMobileSortDown") as LinkButton;
                    lbSortUp.CommandArgument                     =
                        lbSortDown.CommandArgument               =
                            lbMobileSortUp.CommandArgument       =
                                lbMobileSortDown.CommandArgument = Article.ID.ToString();

                    //设置按钮的CommandArgument
                    btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Article.ID.ToString();
                    //设置删除按钮的提示
                    if (Article.Status == (Int32)EnumStatus.RecycleBin)
                    {
                        btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                        btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    }
                    else
                    {
                        btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                        btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    }

                    hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Article.ID.ToString(), "AddNew");


                    //文章状态
                    e.Row.Cells[7].Text = EnumHelper.GetEnumTextVal(Article.Status, typeof(EnumStatus));

                    //格式化2种时间为短日期格式
                    e.Row.Cells[5].Text = Article.StartTime.ToShortDateString();
                    e.Row.Cells[6].Text = Article.EndTime.ToShortDateString();

                    //显示分组
                    if (Setting_EffectDB.Groups)
                    {
                        e.Row.Cells[4].Text = DNNGo_DNNGalleryPro_Group.FindGroupsBySliderID(Article.ID);
                    }

                    if (!String.IsNullOrEmpty(Article.Options))
                    {
                        if (gvArticleList.Columns[1].Visible || gvArticleList.Columns[2].Visible)
                        {
                            List <KeyValueEntity> kvList = new List <KeyValueEntity>();
                            try
                            {
                                kvList = ConvertTo.Deserialize <List <KeyValueEntity> >(Article.Options);
                            }
                            catch
                            { }


                            if (kvList != null && kvList.Count > 0)
                            {
                                if (kvList.Exists(r => r.Key == "Title"))
                                {
                                    KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Title");
                                    if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key))
                                    {
                                        e.Row.Cells[2].Text = Convert.ToString(rowEntity.Value);
                                    }
                                }

                                TemplateFormat tf         = new TemplateFormat(this);
                                Image          imgPicture = e.Row.FindControl("imgPicture") as Image;
                                if (kvList.Exists(r => r.Key == "Thumbnails"))
                                {
                                    KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Thumbnails");
                                    if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key))
                                    {
                                        imgPicture.ImageUrl = tf.ViewLinkUrl(Convert.ToString(rowEntity.Value));
                                    }
                                }
                                else if (kvList.Exists(r => r.Key == "Picture"))
                                {
                                    KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Picture");
                                    if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key))
                                    {
                                        imgPicture.ImageUrl = tf.ViewLinkUrl(Convert.ToString(rowEntity.Value));
                                    }
                                }
                                else
                                {
                                    imgPicture.Visible = false;
                                }
                            }
                        }
                    }
                }
            }
        }