Exemple #1
0
        /// <summary>
        /// 绑定数据项到前台
        /// </summary>
        public void BindDataItem(EffectDBEntity EffectDB)
        {
            Hashtable      Puts = new Hashtable();
            TemplateFormat xf   = new TemplateFormat(this);

            xf.PhContent = PhContent;


            DNNGo_DNNGalleryProGame_Slider SliderItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);

            if (!(SliderItem != null && SliderItem.ID > 0) && !String.IsNullOrEmpty(FriendlyUrl))
            {
                SliderItem = DNNGo_DNNGalleryProGame_Slider.FindItemByFriendlyUrl(FriendlyUrl, Settings_ModuleID);
            }

            //if (SliderItem != null && SliderItem.ID > 0)
            //{
            //    Page.Title = String.Format("{0} - Games", xf.ViewSliderSettingT<String>(SliderItem, "Title", SliderItem.Title));
            //}

            Puts.Add("ThemeName", Settings_EffectThemeName);
            Puts.Add("SliderItem", SliderItem);
            Puts.Add("EffectName", Settings_EffectName);

            Puts.Add("LayerList", EffectDB.Layers ? GetLayerList(SliderItem) : new List <DNNGo_DNNGalleryProGame_Layer>());
            liContent.Text = HttpUtility.HtmlDecode(ViewTemplate(EffectDB, "Layer.html", Puts, xf));
        }
        protected void lbSort_Click(object sender, EventArgs e)
        {
            LinkButton ImgbutSort = (LinkButton)sender;

            if (ImgbutSort != null)
            {
                //查出当前要排序的字段
                DNNGo_DNNGalleryProGame_Slider objC = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(ImgbutSort.CommandArgument);

                mTips.IsPostBack = true;//回发时就要触发
                if (ImgbutSort.ToolTip == "up")
                {
                    DNNGo_DNNGalleryProGame_Slider.MoveField(objC, EnumMoveType.Up, ModuleId, ArticleStatus);
                    //字段上移成功
                    mTips.LoadMessage("UpMoveGallerySuccess", EnumTips.Success, this, new String[] { "" });
                }
                else
                {
                    DNNGo_DNNGalleryProGame_Slider.MoveField(objC, EnumMoveType.Down, ModuleId, ArticleStatus);
                    //字段下移成功

                    mTips.LoadMessage("DownMoveGallerySuccess", EnumTips.Success, this, new String[] { "" });
                }
                //绑定一下
                BindDataList();
            }
        }
Exemple #3
0
        protected new void Page_PreRender(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    TemplateFormat xf = new TemplateFormat(this);

                    DNNGo_DNNGalleryProGame_Slider SliderItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);

                    if (!(SliderItem != null && SliderItem.ID > 0) && !String.IsNullOrEmpty(FriendlyUrl))
                    {
                        SliderItem = DNNGo_DNNGalleryProGame_Slider.FindItemByFriendlyUrl(FriendlyUrl, Settings_ModuleID);
                    }

                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        Page.Title = String.Format("{0} - Games", xf.ViewSliderSettingT <String>(SliderItem, "Title", SliderItem.Title));
                    }

                    base.Page_PreRender(sender, e);
                }
            }
            catch (Exception ex) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        /// <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_DNNGalleryProGame_Slider Article = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Article != null && Article.ID > 0)
                    {
                        if (Article.Status == (Int32)EnumStatus.RecycleBin)
                        {
                            if (Article.Delete() > 0)
                            {
                                //删除相关的的层
                                DNNGo_DNNGalleryProGame_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);
            }
        }
Exemple #5
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_DNNGalleryProGame_Slider SliderItem = new DNNGo_DNNGalleryProGame_Slider();

            if (LayerID > 0)
            {
                DNNGo_DNNGalleryProGame_Layer LayerItem = DNNGo_DNNGalleryProGame_Layer.FindByKeyForEdit(LayerID);
                if (LayerItem != null && LayerItem.ID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);
                if (SliderItem != null && SliderItem.ID > 0)
                {
                    SliderItem.Heats += Heat;
                    SliderItem.Update();

                    Heats = SliderItem.Heats;
                }
            }


            Response.Clear();
            Response.Write(Heats);
            Response.End();
        }
        /// <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_DNNGalleryProGame_Slider Article = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(IDX);
                            if (Article != null && Article.ID > 0)
                            {
                                if (Article.Status == (Int32)EnumStatus.RecycleBin && Status == (Int32)EnumStatus.RecycleBin)
                                {
                                    if (Article.Delete() > 0)
                                    {
                                        //删除相关的的层
                                        DNNGo_DNNGalleryProGame_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);
            }
        }
Exemple #7
0
        /// <summary>
        /// 绑定动态模块到页面
        /// </summary>
        private void BindRelationsToPage()
        {
            //绑定动态模块的模态窗口 Resource_Attachments|Manager_Modal_SelectDownloadFiles
            hlSelectRelations.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Setting_Modal_Sliders&SliderID={5}", ModulePath, PortalId, TabId, ModuleId, language, SliderID));



            List <GridItem> Items = new List <GridItem>();

            if (SliderItem != null && SliderItem.ID > 0 && !String.IsNullOrEmpty(SliderItem.Relations))
            {
                List <String> Relations = Common.GetList(SliderItem.Relations);


                if (Relations != null && Relations.Count > 0)
                {
                    TemplateFormat xf = new TemplateFormat(this);


                    foreach (var RelationId in Relations)
                    {
                        DNNGo_DNNGalleryProGame_Slider Slider = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(RelationId);
                        if (Slider != null && Slider.ID > 0)
                        {
                            Items.Add(new GridItem()
                            {
                                ID      = Slider.ID,
                                Title   = Slider.Title,
                                Picture = xf.ViewPictureUrl(Slider),
                                Groups  = xf.ToGroups(Slider)
                            });
                        }
                    }
                }
            }

            if (Items != null && Items.Count > 0)
            {
                //绑定参数项
                RepeaterRelations.DataSource = Items;
                RepeaterRelations.DataBind();
            }
        }
Exemple #8
0
        /// <summary>
        /// 获取相关联的SiderList
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <DNNGo_DNNGalleryProGame_Slider> GetRelations(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            List <DNNGo_DNNGalleryProGame_Slider> DataList = new List <DNNGo_DNNGalleryProGame_Slider>();

            if (SliderItem != null && SliderItem.ID > 0)
            {
                if (!String.IsNullOrEmpty(SliderItem.Relations))
                {
                    List <String> Relations = Common.GetList(SliderItem.Relations);
                    if (Relations != null && Relations.Count > 0)
                    {
                        foreach (var RelationId in Relations)
                        {
                            DNNGo_DNNGalleryProGame_Slider Slider = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(RelationId);
                            if (Slider != null && Slider.ID > 0)
                            {
                                DataList.Add(Slider);
                            }
                        }
                    }
                }

                //没有数据时需要用相关分类填充
                if (!(DataList != null && DataList.Count > 0))
                {
                    Int32      RecordCount = 0;
                    QueryParam qp          = new QueryParam();
                    qp.Orderfld  = DNNGo_DNNGalleryProGame_Slider._.Sort;
                    qp.OrderType = 1;
                    qp.PageSize  = ViewXmlSettingT <Int32>("RelatedSize", 10);

                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual));

                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, bpm.Settings_ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, DNNGo_DNNGalleryProGame_Slider_Group.BuilderSliderIDsBySliderID(SliderItem.ID), SearchType.In));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, SliderItem.ID, SearchType.NotIn));

                    //需要根据条件来查找相应的权限
                    if (bpm.UserId > 0)
                    {
                        if (!bpm.UserInfo.IsSuperUser)//超级管理员不限制
                        {
                            qp.WhereSql.Append(" ( ");
                            //公开的
                            qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal).ToSql());

                            //有角色的
                            if (bpm.UserInfo.Roles != null && bpm.UserInfo.Roles.Length > 0)
                            {
                                qp.WhereSql.Append(" OR ");
                                qp.WhereSql.Append(" ( ");

                                Int32 RoleIndex = 0;
                                foreach (var r in bpm.UserInfo.Roles)
                                {
                                    if (RoleIndex > 0)
                                    {
                                        qp.WhereSql.Append(" OR ");
                                    }

                                    qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_Roles, String.Format(",{0},", r), SearchType.Like).ToSql());

                                    RoleIndex++;
                                }
                                qp.WhereSql.Append(" ) ");
                            }
                            qp.WhereSql.Append(" ) ");
                        }
                    }
                    else
                    {
                        qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal));
                    }

                    DataList = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
                }
            }
            return(DataList);
        }
Exemple #9
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_DNNGalleryProGame_Slider SliderItem = new DNNGo_DNNGalleryProGame_Slider();
                if (LayerID > 0)
                {
                    DNNGo_DNNGalleryProGame_Layer LayerItem = DNNGo_DNNGalleryProGame_Layer.FindByKeyForEdit(LayerID);
                    if (LayerItem != null && LayerItem.ID > 0)
                    {
                        SliderItem = DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_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
            {
                //没有找到文件参数
            }
        }
Exemple #10
0
        /// <summary>
        /// 创建文章自定义模型的JSON信息
        /// </summary>
        public void PushCustomModels()
        {
            Dictionary <String, Object> jsonCustomModels = new Dictionary <String, Object>();

            //读取出该事件的信息
            Int32 SliderID = WebHelper.GetIntParam(HttpContext.Current.Request, "SliderID", 0);

            if (SliderID > 0)
            {
                DNNGo_DNNGalleryProGame_Slider EventItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);

                if (EventItem != null && EventItem.ID > 0 && !String.IsNullOrEmpty(EventItem.Extension))
                {
                    //取出扩展项
                    List <KeyValueEntity> ExtensionSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(EventItem.Extension);

                    foreach (KeyValueEntity k in ExtensionSettings)
                    {
                        if (!jsonCustomModels.ContainsKey(k.Key))
                        {
                            Dictionary <String, Object> jsonItem = new Dictionary <String, Object>();
                            jsonItem.Add("Name", k.Key);
                            jsonItem.Add("Value", k.Value);
                            jsonItem.Add("Index", jsonCustomModels.Count);

                            jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonItem);
                        }
                    }
                }
            }

            //提取预设值的自定义模型
            String CustomModels = ViewXmlSettingT <String>("CustomModels", "");

            if (!String.IsNullOrEmpty(CustomModels))
            {
                //提取共用属性名
                List <String> ExtensionKeys = Common.GetList(CustomModels, "\r\n");;
                foreach (String k in ExtensionKeys)
                {
                    if (!String.IsNullOrEmpty(k) && !jsonCustomModels.ContainsKey(k))
                    {
                        Dictionary <String, Object> jsonItem = new Dictionary <String, Object>();
                        jsonItem.Add("Name", k);
                        jsonItem.Add("Value", "");
                        jsonItem.Add("Index", jsonCustomModels.Count);

                        jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonItem);
                    }
                }
            }


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

            jsonNull.Add("Name", "");
            jsonNull.Add("Value", "");
            jsonNull.Add("Index", jsonCustomModels.Count);
            jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonNull);



            //转换数据为json
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            Response.Clear();
            Response.Write(jsSerializer.Serialize(jsonCustomModels));
            Response.End();
        }