protected void lbSort_Click(object sender, EventArgs e) { LinkButton ImgbutSort = (LinkButton)sender; if (ImgbutSort != null) { //查出当前要排序的字段 DNNGo_DNNGalleryPro_Slider objC = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(ImgbutSort.CommandArgument); mTips.IsPostBack = true;//回发时就要触发 if (ImgbutSort.ToolTip == "up") { DNNGo_DNNGalleryPro_Slider.MoveField(objC, EnumMoveType.Up, ModuleId, ArticleStatus); //字段上移成功 mTips.LoadMessage("UpMoveGallerySuccess", EnumTips.Success, this, new String[] { "" }); } else { DNNGo_DNNGalleryPro_Slider.MoveField(objC, EnumMoveType.Down, ModuleId, ArticleStatus); //字段下移成功 mTips.LoadMessage("DownMoveGallerySuccess", EnumTips.Success, this, new String[] { "" }); } //绑定一下 BindDataList(); } }
/// <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> 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(); }
/// <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> public void BindDataItem(EffectDBEntity EffectDB) { Hashtable Puts = new Hashtable(); TemplateFormat xf = new TemplateFormat(this); xf.PhContent = PhContent; DNNGo_DNNGalleryPro_Slider SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID); Puts.Add("ThemeName", Settings_EffectThemeName); Puts.Add("SliderItem", SliderItem); Puts.Add("EffectName", Settings_EffectName); Puts.Add("LayerList", EffectDB.Layers ? GetLayerList() : new List <DNNGo_DNNGalleryPro_Layer>()); liContent.Text = HttpUtility.HtmlDecode(ViewTemplate(EffectDB, "Layer.html", Puts, xf)); }
/// <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> /// 创建文章自定义模型的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_DNNGalleryPro_Slider EventItem = DNNGo_DNNGalleryPro_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(); }