/// <Description> /// 更新文章 /// </Description> protected void cmdPublish_Click(object sender, EventArgs e) { try { // 设置方案项 DNNGo_DNNGalleryPro_Slider Article = new DNNGo_DNNGalleryPro_Slider(); Int32 SaveResult = SaveDataItem(-1, ref Article); if (SaveResult > 0) { mTips.LoadMessage("SaveSliderSuccess", EnumTips.Success, this); if (SliderID == 0) { Response.Redirect(xUrl("ID", Article.ID.ToString(), "AddNew"), false); } else { Response.Redirect(xUrl("ManagerList"), false); } } else { mTips.IsPostBack = false; mTips.LoadMessage("SaveSliderError", EnumTips.Success, this, new String[] { "" }); } } 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_DNNGalleryPro_Files Multimedia = DNNGo_DNNGalleryPro_Files.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) { //删除文件 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); } }
/// <summary> /// 应用效果 /// </summary> protected void btnApply_Click(object sender, EventArgs e) { try { LinkButton btnApply = (LinkButton)sender; //要修改默认的主题样式 String EffectDirPath = String.Format("{0}Effects/{1}/Themes/", Server.MapPath(ModulePath), btnApply.CommandArgument); DirectoryInfo EffectDir = new DirectoryInfo(EffectDirPath); if (!EffectDir.Exists) { EffectDir.Create(); } DirectoryInfo[] ThemeDirs = EffectDir.GetDirectories(); if (ThemeDirs != null && ThemeDirs.Length > 0) { UpdateModuleSetting("DNNGalleryPro_EffectThemeName", ThemeDirs[0].Name); } UpdateModuleSetting("DNNGalleryPro_EffectName", btnApply.CommandArgument); mTips.LoadMessage("SaveEffectSuccess", EnumTips.Success, this, new String[] { btnApply.CommandArgument }); Response.Redirect(xUrl("Effect_List"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 导出数据到XML /// </summary> protected void cmdExportToXml_Click(object sender, EventArgs e) { try { ImportExportHelper ieHelper = new ImportExportHelper(); ieHelper.ModuleID = ModuleId; ieHelper.UserId = UserId; StringBuilder PostContent = new StringBuilder(); PostContent.Append(ieHelper.Export()); if (PostContent != null && PostContent.Length > 0) { PostContent.AppendLine() .AppendLine().Append(" ") .AppendLine() .AppendLine() .AppendLine() .AppendLine() .AppendLine().Append(" "); Response.Clear(); Response.ClearContent(); Response.AddHeader("Content-disposition", "attachment;filename=DNNGalleryPro.xml"); Response.AddHeader("content-length", PostContent.Length.ToString()); Response.ContentEncoding = Encoding.UTF8; Response.ContentType = "text/xml"; Response.Write(PostContent); Response.Flush(); Response.Close(); Response.End(); } else { //没有可导出的文章条目 mTips.IsPostBack = true; mTips.LoadMessage("ExportContentError", EnumTips.Success, this, new String[] { "" }); } } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, 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 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="sender"></param> /// <param name="e"></param> protected void cmdUpdate_Click(object sender, EventArgs e) { try { // 设置需要绑定的方案项 SetDataItem(); mTips.LoadMessage("SaveStyleSuccess", EnumTips.Success, this, new String[] { "" }); Response.Redirect(xUrl("Effect_Style"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <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("Effect_Options"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 列表上的项删除事件 /// </summary> protected void btnRemove_Click(object sender, EventArgs e) { try { LinkButton btnRemove = (LinkButton)sender; DNNGo_DNNGalleryPro_Group item = DNNGo_DNNGalleryPro_Group.FindByKeyForEdit(btnRemove.CommandArgument); mTips.IsPostBack = true; if (item.ID > 0 && item.Delete() > 0) { mTips.LoadMessage("DeleteGroupSuccess", EnumTips.Success, this, new String[] { item.Name }); } else { mTips.LoadMessage("DeleteGroupError", EnumTips.Success, this, new String[] { item.Name }); } BindDataList(); } catch (Exception ex) { ProcessModuleLoadException(ex); } }