Пример #1
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;

                    FontDB FontItem = new FontDBHelper(this).Find(btnRemove.CommandArgument);

                    if (FontItem != null && !String.IsNullOrEmpty(FontItem.PrimaryGuid))
                    {
                        if (FontItem.IsSystem.HasValue && !FontItem.IsSystem.Value)
                        {
                            new FontDBHelper(this).Delete(FontItem.PrimaryGuid);

                            mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias });
                        }
                        else
                        {
                            //这是系统内置的字体不允许删除
                            mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias });
                        }

                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
 protected void cmdSynchronizeFiles_Click(object sender, EventArgs e)
 {
     try
     {
         int SynchronizeCount = SynchronizeAllFiles();
         if (SynchronizeCount > 0)
         {
             mTips.LoadMessage("SynchronizeFilesSuccess", EnumTips.Success, this, new object[] { SynchronizeCount });
             Response.Redirect(xUrl("Library"), false);
         }
         else
         {
             mTips.LoadMessage("SynchronizeFilesError", EnumTips.Success, this);
             Response.Redirect(xUrl("Synchronize"), false);
         }
     }
     catch (Exception ex)
     {
         DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
        /// <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_xBlog_Articles Article = DNNGo_xBlog_Articles.FindByKeyForEdit(IDX);
                            //if (Article != null && Article.ID > 0)
                            //{

                            //    if (Article.Status == (Int32)EnumArticleStatus.Recycle && Status == (Int32)EnumArticleStatus.Recycle)
                            //    {
                            //        if (Article.Delete() > 0)
                            //        {
                            //            //删除分类项
                            //            DNNGo_xBlog_Category_Relationships.DeleteByArticleID(Article.ID);
                            //            DNNGo_xBlog_Comments.DeleteByArticleID(Article.ID);
                            //        }
                            //    }
                            //    else
                            //    {
                            //        Article.Status = Status;
                            //        if (Article.Update() > 0)
                            //        {
                            //        }
                            //    }
                            //}
                        }
                    }
                    BindDataList();

                    mTips.IsPostBack = true;
                    mTips.LoadMessage("ApplyStatusSuccess", EnumTips.Success, this, new String[] { EnumHelper.GetEnumTextVal(Status, typeof(EnumArticleStatus)) });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Пример #4
0
        /// <summary>
        /// 更新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置需要绑定的方案项
                SetDataItem();

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

                //refresh cache
                SynchronizeModule();

                Response.Redirect(xUrl("jQuerySettings"), false);
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(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_ThemePlugin_Multimedia Multimedia = DNNGo_ThemePlugin_Multimedia.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Multimedia != null && Multimedia.ID > 0)
                    {
                        //if (Multimedia.Status == (Int32)EnumFileStatus.Recycle)
                        //{
                        //要删除实际的文件
                        String DeletePath = Server.MapPath(GetPhotoPath(Multimedia.FilePath));
                        if (Multimedia.Delete() > 0)
                        {
                            //删除分类项
                            //DNNGo_ThemePlugin_Articles_Files.DeleteByMultimedia(Multimedia.ID);
                            //更新所属图片为空
                            //DNNGo_ThemePlugin_Articles.DeleteByMultimedia(Multimedia.ID);

                            //删除文件
                            if (File.Exists(DeletePath))
                            {
                                File.Delete(DeletePath);
                            }

                            //操作成功
                            mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        else
                        {
                            //操作失败
                            mTips.LoadMessage("DeleteMediaLibraryError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        //}
                        //else
                        //{
                        //    Multimedia.Status = (Int32)EnumFileStatus.Recycle;
                        //    if (Multimedia.Update() > 0)
                        //    {
                        //        //移动到回收站操作成功
                        //        mTips.LoadMessage("DeleteCommentSuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //    else
                        //    {
                        //        //移动到回收站操作失败
                        //        mTips.LoadMessage("DeleteCommentError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //}
                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }