/// <summary>
        /// 显示图片文件的大小 kb/mb
        /// </summary>
        /// <param name="DataItem"></param>
        /// <param name="FieldName"></param>
        /// <returns></returns>
        public String PictureSize(DNNGo_DNNGalleryPro_Layer DataItem, String FieldName)
        {
            String _PictureSize = "0kb";
            String _PictureUrl  = Convert.ToString(ViewLayerSetting(DataItem, FieldName, ""));

            if (!String.IsNullOrEmpty(_PictureUrl) && _PictureUrl.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) >= 0)
            {
                int MediaID = 0;
                if (int.TryParse(_PictureUrl.Replace("MediaID=", ""), out MediaID) && MediaID > 0)
                {
                    DNNGo_DNNGalleryPro_Files Multimedia = DNNGo_DNNGalleryPro_Files.FindByID(MediaID);
                    if (Multimedia != null && Multimedia.ID > 0 && Multimedia.FileSize > 0)
                    {
                        if (Multimedia.FileSize > (1024 * 1024))
                        {
                            _PictureSize = String.Format("{0:N}gb", Convert.ToSingle(Multimedia.FileSize) / (1024 * 1024));
                        }
                        else if (Multimedia.FileSize > 1024)
                        {
                            _PictureSize = String.Format("{0:N}mb", Convert.ToSingle(Multimedia.FileSize) / Convert.ToSingle(1024));
                        }
                        else
                        {
                            _PictureSize = String.Format("{0}kb", Multimedia.FileSize);
                        }
                    }
                }
            }
            return(_PictureSize);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    mTips.IsPostBack = true;

                    DNNGo_DNNGalleryPro_Slider Article = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Article != null && Article.ID > 0)
                    {
                        if (Article.Status == (Int32)EnumStatus.RecycleBin)
                        {
                            if (Article.Delete() > 0)
                            {
                                //删除相关的的层
                                DNNGo_DNNGalleryPro_Layer.Deletes(Article);

                                //操作成功
                                mTips.LoadMessage("DeleteGallerySuccess", EnumTips.Success, this);
                            }
                            else
                            {
                                //操作失败
                                mTips.LoadMessage("DeleteGalleryError", EnumTips.Success, this);
                            }
                        }
                        else
                        {
                            Article.Status = (Int32)EnumStatus.RecycleBin;
                            if (Article.Update() > 0)
                            {
                                //移动到回收站操作成功
                                mTips.LoadMessage("DeleteGallerySuccess", EnumTips.Success, this);
                            }
                            else
                            {
                                //移动到回收站操作失败
                                mTips.LoadMessage("DeleteGalleryError", EnumTips.Success, this);
                            }
                        }

                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
 /// <summary>
 /// 下载文件
 /// </summary>
 /// <param name="LayerItem"></param>
 /// <param name="SettingName"></param>
 /// <returns></returns>
 public String GoDownloadUrl(DNNGo_DNNGalleryPro_Layer LayerItem, String SettingName)
 {
     return(String.Format("{0}Resource_Service.aspx?Token=download&PortalID={1}&TabID={2}&ModuleID={3}&SliderID={4}&LayerID={5}&SettingName={6}",
                          bpm.ModulePath,
                          bpm.Settings_PortalID,
                          bpm.Settings_TabID,
                          bpm.Settings_ModuleID,
                          LayerItem.SliderID,
                          LayerItem.ID,
                          SettingName));
 }
 /// <summary>
 /// 热度的链接
 /// </summary>
 /// <param name="LayerItem"></param>
 /// <param name="Heat">热度+1 或者 -1</param>
 /// <returns></returns>
 public String GoHeatsUrl(DNNGo_DNNGalleryPro_Layer LayerItem, Int32 Heat)
 {
     return(String.Format("{0}Resource_Service.aspx?Token=heats&PortalID={1}&TabID={2}&ModuleID={3}&SliderID={4}&LayerID={5}&Heat={6}",
                          bpm.ModulePath,
                          bpm.Settings_PortalID,
                          bpm.Settings_TabID,
                          bpm.Settings_ModuleID,
                          LayerItem.SliderID,
                          LayerItem.ID,
                          Heat));
 }
        /// <summary>
        /// Layer列表
        /// </summary>
        /// <returns></returns>
        public List <DNNGo_DNNGalleryPro_Layer> GetLayerList()
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld  = DNNGo_DNNGalleryPro_Layer._.Sort;
            qp.OrderType = 0;
            int RecordCount = 0;

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
            return(DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 点赞
        /// </summary>
        public void ClickHeats()
        {
            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);
            Int32 LayerID  = WebHelper.GetIntParam(Request, "LayerID", 0);
            Int32 Heat     = WebHelper.GetIntParam(Request, "Heat", 1);//热度+1 或者 -1


            Int32 Heats = 0;

            DNNGo_DNNGalleryPro_Slider SliderItem = new DNNGo_DNNGalleryPro_Slider();

            if (LayerID > 0)
            {
                DNNGo_DNNGalleryPro_Layer LayerItem = DNNGo_DNNGalleryPro_Layer.FindByKeyForEdit(LayerID);
                if (LayerItem != null && LayerItem.ID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        //背景下载技术
                        SliderItem.Heats += Heat;
                        SliderItem.Update();
                    }
                    //层下载技术
                    LayerItem.Heats += Heat;
                    LayerItem.Update();

                    Heats = LayerItem.Heats;
                }
                else
                {
                    //没有找到文件记录
                }
            }
            else if (SliderID > 0)
            {
                SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                if (SliderItem != null && SliderItem.ID > 0)
                {
                    SliderItem.Heats += Heat;
                    SliderItem.Update();

                    Heats = SliderItem.Heats;
                }
            }


            Response.Clear();
            Response.Write(Heats);
            Response.End();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Gallery数据转XML实体
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public XmlLayerEntity EntityToXml(DNNGo_DNNGalleryPro_Layer ContentItem)
        {
            XmlLayerEntity ContentXml = new XmlLayerEntity();

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



            //将Options提取出来处理后再还原
            ContentXml.Options = ConvertOptions(ContentItem.Options, Setting_LayerSettingDB);

            return(ContentXml);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            DNNGo_DNNGalleryPro_Slider Article = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(IDX);
                            if (Article != null && Article.ID > 0)
                            {
                                if (Article.Status == (Int32)EnumStatus.RecycleBin && Status == (Int32)EnumStatus.RecycleBin)
                                {
                                    if (Article.Delete() > 0)
                                    {
                                        //删除相关的的层
                                        DNNGo_DNNGalleryPro_Layer.Deletes(Article);
                                    }
                                }
                                else
                                {
                                    Article.Status = Status;
                                    if (Article.Update() > 0)
                                    {
                                    }
                                }
                            }
                        }
                    }
                    BindDataList();

                    mTips.IsPostBack = true;
                    mTips.LoadMessage("ApplyStatusSuccess", EnumTips.Success, this, new String[] { EnumHelper.GetEnumTextVal(Status, typeof(EnumStatus)) });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 设置数据项
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Layer SetDataItem()
        {
            Int32 LayerResult = 0;

            DNNGo_DNNGalleryPro_Layer Layer = LayerItem;

            Layer.Options = SetItemSettings();


            Layer.LastIP   = WebHelper.UserHost;
            Layer.LastTime = xUserTime.UtcTime();
            Layer.LastUser = UserId;

            if (Layer.ID > 0)
            {
                LayerResult = Layer.Update();
            }
            else
            {
                Layer.CreateTime = xUserTime.UtcTime();
                Layer.CreateUser = UserId;

                Layer.ModuleId = ModuleId;
                Layer.PortalId = PortalId;

                Layer.SliderID = SliderID;

                Layer.Status = (Int32)EnumStatus.Activated;


                QueryParam Sqp = new QueryParam();
                Sqp.ReturnFields = Sqp.Orderfld = DNNGo_DNNGalleryPro_Layer._.Sort;
                Sqp.OrderType    = 1;
                Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.ModuleId, ModuleId, SearchType.Equal));
                Layer.Sort = Convert.ToInt32(DNNGo_DNNGalleryPro_Layer.FindScalar(Sqp)) + 2;


                Layer.ID = Layer.Insert();
            }



            return(Layer);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 排序列表
        /// </summary>
        public void LayerListSort()
        {
            Int32 ReturnString = 0;

            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                String SortList = WebHelper.GetStringParam(Request, "json", "");
                if (!String.IsNullOrEmpty(SortList))
                {
                    JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

                    try
                    {
                        object[] Sorts = jsSerializer.DeserializeObject(SortList) as object[];

                        if (Sorts != null && Sorts.Length > 0)
                        {
                            foreach (object so in Sorts)
                            {
                                Dictionary <string, object> SortDict = so as Dictionary <string, object>;

                                if (SortDict != null && SortDict.Count == 2)
                                {
                                    String setClause   = String.Format(" {0} = {1} ", DNNGo_DNNGalleryPro_Layer._.Sort, SortDict[DNNGo_DNNGalleryPro_Layer._.Sort]);
                                    String whereClause = String.Format(" {0} = {1} ", DNNGo_DNNGalleryPro_Layer._.ID, SortDict[DNNGo_DNNGalleryPro_Layer._.ID]);

                                    ReturnString += DNNGo_DNNGalleryPro_Layer.Update(setClause, whereClause);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }
Exemplo n.º 11
0
        /// <summary>
        /// 相册XML转数据实体
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Layer XmlToEntity(XmlLayerEntity ContentXml)
        {
            DNNGo_DNNGalleryPro_Layer ContentItem = new DNNGo_DNNGalleryPro_Layer();


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


            ContentItem.Options = Common.XmlDecode(ContentXml.Options);


            ContentItem.ModuleId = ModuleID;
            ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;

            ContentItem.LastIP   = WebHelper.UserHost;
            ContentItem.LastTime = xUserTime.UtcTime();
            ContentItem.LastUser = UserId;
            return(ContentItem);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 读取数据项参数
        /// </summary>
        /// <param name="DataItem">数据项</param>
        /// <param name="Name">参数名</param>
        /// <param name="DefaultValue">默认值</param>
        /// <returns></returns>
        public object ViewLayerSetting(DNNGo_DNNGalleryPro_Layer DataItem, String Name, object DefaultValue)
        {
            object o = DefaultValue;

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options))
            {
                try
                {
                    List <KeyValueEntity> ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(DataItem.Options);
                    KeyValueEntity        KeyValue     = ItemSettings.Find(r1 => r1.Key.ToLower() == Name.ToLower());
                    if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key))
                    {
                        o = KeyValue.Value;
                    }
                }
                catch
                {
                }
            }
            return(o);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 删除LayerItem
        /// </summary>
        public void DeleteLayerItem()
        {
            String ReturnString = "0";

            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                Int32 LayerID = WebHelper.GetIntParam(Request, "LayerID", 0);
                if (LayerID > 0)
                {
                    DNNGo_DNNGalleryPro_Layer Layer = new DNNGo_DNNGalleryPro_Layer();
                    Layer.ID = LayerID;

                    ReturnString = Layer.Delete().ToString();
                }
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }
Exemplo n.º 14
0
        /// <summary>
        /// 导入项
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="ContentEntity"></param>
        /// <returns></returns>
        public Int32 ImportLayers(DNNGo_DNNGalleryPro_Slider Content, String ItemList)
        {
            Int32 Result = 0;

            if (Content != null && Content.ID > 0 && !String.IsNullOrEmpty(ItemList))
            {
                //还原出项的列表
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.LoadXml(Common.XmlDecode(ItemList));

                List <XmlLayerEntity> list = xf.ToList <XmlLayerEntity>();

                foreach (XmlLayerEntity itemEntity in list)
                {
                    DNNGo_DNNGalleryPro_Layer item = new DNNGo_DNNGalleryPro_Layer();

                    item.Options = ConvertOptions_XML(Common.XmlDecode(itemEntity.Options), Setting_LayerSettingDB);
                    item.Status  = itemEntity.Status;
                    item.Sort    = itemEntity.Sort;

                    item.CreateTime = itemEntity.CreateTime;

                    item.ModuleId = Content.ModuleId;
                    item.PortalId = Content.PortalId;
                    item.LastTime = Content.LastTime;
                    item.LastUser = Content.LastUser;
                    item.LastIP   = Content.LastIP;
                    item.SliderID = Content.ID;

                    //添加项
                    if (item.Insert() > 0)
                    {
                        Result++;
                    }
                }
            }
            return(Result);
        }
Exemplo n.º 15
0
        public String ConvertLayers(DNNGo_DNNGalleryPro_Slider SliderItem)
        {
            String Layers_XML = String.Empty;

            if (SliderItem != null && SliderItem.ID > 0)
            {
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderItem.ID, SearchType.Equal));
                List <DNNGo_DNNGalleryPro_Layer> list = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);
                if (list != null && list.Count > 0)
                {
                    List <XmlLayerEntity> LayerList = new List <XmlLayerEntity>();
                    foreach (var item in list)
                    {
                        LayerList.Add(EntityToXml(item));
                    }
                    XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/LayerEntity.xml", ModulePath)));
                    Layers_XML = xf.ToXml <XmlLayerEntity>(LayerList);
                }
            }
            return(Layers_XML);
        }
        /// <summary>
        /// 更新内容
        /// </summary>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DNNGo_DNNGalleryPro_Layer Layer = SetDataItem();

                if (Layer != null && Layer.ID > 0)
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.AppendFormat("<script>window.parent.LayerList.Post({0});</script>", Layer.ID).AppendLine();
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PostLayerItem", sb.ToString());
                    //Response.Write(sb.ToString());
                    //Response.End();
                }

                //mTips.LoadMessage("SaveOptionsSuccess", EnumTips.Success, this, new String[] { });

                //Response.Redirect(WebHelper.GetScriptUrl, false);
            }
            catch (Exception exc)
            {
                ProcessModuleLoadException(exc);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 选中激活LayerItem
        /// </summary>
        public void CheckedLayerItem()
        {
            String ReturnString = "0";

            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                Int32 LayerID = WebHelper.GetIntParam(Request, "LayerID", 0);
                if (LayerID > 0)
                {
                    DNNGo_DNNGalleryPro_Layer Layer = DNNGo_DNNGalleryPro_Layer.FindByKeyForEdit(LayerID);


                    Layer.Status = WebHelper.GetBooleanParam(Request, "checked", false) ? (Int32)EnumStatus.Activated : (Int32)EnumStatus.Hidden;


                    ReturnString = Layer.Update().ToString();
                }
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Layer列表的HTML生成
        /// </summary>
        public void PushLayerListHtml()
        {
            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                QueryParam qp = new QueryParam();
                qp.Orderfld  = DNNGo_DNNGalleryPro_Layer._.Sort;
                qp.OrderType = 0;
                qp.PageIndex = WebHelper.GetIntParam(Request, "PageIndex", 1);
                qp.PageSize  = WebHelper.GetIntParam(Request, "PageSize", Int32.MaxValue);

                Int32 LayerID = WebHelper.GetIntParam(Request, "LayerID", 0);
                if (LayerID > 0)
                {
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.ID, LayerID, SearchType.Equal));
                }

                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderID, SearchType.Equal));


                int RecordCount = 0;
                List <DNNGo_DNNGalleryPro_Layer> LayerList = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);

                Dictionary <String, Object> jsonLayers = new Dictionary <string, Object>();

                TemplateFormat xf = new TemplateFormat();


                foreach (var LayerItem in LayerList)
                {
                    int index = LayerList.IndexOf(LayerItem); //index 为索引值

                    Dictionary <String, Object> jsonLayer = new Dictionary <String, Object>();

                    jsonLayer.Add("ID", LayerItem.ID);
                    jsonLayer.Add("Sort", LayerItem.Sort);
                    jsonLayer.Add("CreateTime", LayerItem.CreateTime);
                    jsonLayer.Add("Status", LayerItem.Status == 1 ? "checked=\"checked\"" : "");
                    jsonLayer.Add("Title", WebHelper.leftx(xf.ViewLayerSettingT <String>(LayerItem, "Title", ""), 30, "..."));


                    String LayerType = xf.ViewLayerSettingT <String>(LayerItem, "LayerType", "");
                    jsonLayer.Add("LayerType", String.IsNullOrEmpty(LayerType) ? "Common" : LayerType);

                    jsonLayer.Add("Edit", String.Format("{0}Resource_Item.aspx?ModuleId={1}&PortalId={2}&TabId={3}&SliderID={4}&LayerID={5}&LayerType={6}", ModulePath, ModuleId, PortalId, TabId, SliderID, LayerItem.ID, LayerType));



                    String Thumbnail = xf.ViewLayerSettingT <String>(LayerItem, "Thumbnail", "");
                    if (String.IsNullOrEmpty(Thumbnail))
                    {
                        Thumbnail = xf.ViewLayerSettingT <String>(LayerItem, "Picture", "");
                    }

                    if (!String.IsNullOrEmpty(Thumbnail))
                    {
                        jsonLayer.Add("Thumbnail", String.Format("<img style=\"border-width:0px; max-height:60px;max-width:80px;\"  src=\"{0}\" onError=\"this.src='{1}Resource/images/no_image.png'\"  /> ", ViewLinkUrl(Thumbnail), ModulePath));
                    }
                    else
                    {
                        jsonLayer.Add("Thumbnail", "");
                    }
                    jsonLayers.Add((10000 - index).ToString(), jsonLayer);
                }

                //转换数据为json
                JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                Response.Clear();
                Response.Write(jsSerializer.Serialize(jsonLayers));
                Response.End();
            }
        }
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <typeparam name="T">参数类型</typeparam>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public T ViewLayerSettingT <T>(DNNGo_DNNGalleryPro_Layer DataItem, String Name, T DefaultValue)
 {
     return(bpm.ViewLayerSettingT <T>(DataItem, Name, DefaultValue));
 }
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <param name="DataItem">数据项</param>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public object ViewLayerSetting(DNNGo_DNNGalleryPro_Layer DataItem, String Name, object DefaultValue)
 {
     return(bpm.ViewLayerSetting(DataItem, Name, DefaultValue));
 }
Exemplo n.º 21
0
        /// <summary>
        /// 媒体库文件下载
        /// </summary>
        public void FileDownLoads()
        {
            Int32  SliderID    = WebHelper.GetIntParam(Request, "SliderID", 0);
            Int32  LayerID     = WebHelper.GetIntParam(Request, "LayerID", 0);
            String SettingName = WebHelper.GetStringParam(Request, "SettingName", "");

            if (!String.IsNullOrEmpty(SettingName))
            {
                String SettingValue = String.Empty;

                DNNGo_DNNGalleryPro_Slider SliderItem = new DNNGo_DNNGalleryPro_Slider();
                if (LayerID > 0)
                {
                    DNNGo_DNNGalleryPro_Layer LayerItem = DNNGo_DNNGalleryPro_Layer.FindByKeyForEdit(LayerID);
                    if (LayerItem != null && LayerItem.ID > 0)
                    {
                        SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                        if (SliderItem != null && SliderItem.ID > 0)
                        {
                            //背景下载技术
                            SliderItem.Clicks += 1;
                            SliderItem.Update();
                        }
                        //层下载技术
                        LayerItem.Clicks += 1;
                        LayerItem.Update();
                        //取出层中的下载链接
                        SettingValue = ViewLayerSettingT <String>(LayerItem, SettingName, "");
                    }
                    else
                    {
                        //没有找到文件记录
                    }
                }
                else if (SliderID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        SliderItem.Clicks += 1;
                        SliderItem.Update();
                        //取出背景中的下载链接
                        SettingValue = ViewSliderSettingT <String>(SliderItem, SettingName, "");
                    }
                }

                if (!String.IsNullOrEmpty(SettingValue))
                {
                    String DownLoadUrl = HttpUtility.UrlDecode(ViewLinkUrl(SettingValue, false));
                    if (!String.IsNullOrEmpty(DownLoadUrl))
                    {
                        //记录下载信息到日志表里面***暂时忽略


                        if (SettingValue.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            String ServerPath = MapPath(DownLoadUrl);

                            if (false)
                            {
                                FileSystemUtils.DownloadFile(ServerPath, Path.GetFileName(ServerPath));//下载媒体库中的文件
                            }
                            else
                            {
                                Response.Redirect(DownLoadUrl);
                            }
                        }
                        else
                        {
                            Response.Redirect(DownLoadUrl);//除了媒体库中的文件,其他一律跳转
                        }
                    }
                    else
                    {
                        //下载链接不存在
                    }
                }
                else
                {
                    //没有取到下载链接
                }
            }
            else
            {
                //没有找到文件参数
            }
        }
        /// <summary>
        /// 显示图片地址
        /// </summary>
        /// <param name="DataItem"></param>
        /// <param name="FieldName"></param>
        /// <returns></returns>
        public String PictureUrl(DNNGo_DNNGalleryPro_Layer DataItem, String FieldName, String DefaultValue)
        {
            String _PictureUrl = Convert.ToString(ViewLayerSetting(DataItem, FieldName, ""));

            return(ViewLinkUrl(_PictureUrl, DefaultValue));
        }
Exemplo n.º 23
0
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <typeparam name="T">参数类型</typeparam>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public T ViewLayerSettingT <T>(DNNGo_DNNGalleryPro_Layer DataItem, String Name, T DefaultValue)
 {
     return((T)Convert.ChangeType(ViewLayerSetting(DataItem, Name, DefaultValue), typeof(T)));
 }