/// <summary> /// 文章软删除(删除到回收站) /// </summary> protected void cmdDelete_Click(object sender, EventArgs e) { try { Playngo_ClientZone_GameSheet GameSheet = Playngo_ClientZone_GameSheet.FindByKeyForEdit(GameSheetID); GameSheet.Status = (Int32)EnumStatus.Recycle; if (GameSheet != null && GameSheet.ID > 0 && GameSheet.Update() > 0) { //操作成功 mTips.LoadMessage("DeleteGameSheetSuccess", EnumTips.Success, this, new String[] { GameSheet.Title }); Response.Redirect(xUrl("GameSheets"), false); } else { mTips.IsPostBack = false; //操作失败 mTips.LoadMessage("DeleteGameSheetError", EnumTips.Success, this, new String[] { GameSheet.Title }); } } 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; Playngo_ClientZone_GameSheet Event = Playngo_ClientZone_GameSheet.FindByKeyForEdit(btnRemove.CommandArgument); if (Event != null && Event.ID > 0) { if (Event.Status == (Int32)EnumStatus.Recycle) { if (Event.Delete() > 0) { //删除相关的动态模块和项 Playngo_ClientZone_DynamicModule.DeleteAll(Event); //操作成功 mTips.LoadMessage("DeleteEventSuccess", EnumTips.Success, this, new String[] { Event.Title }); } else { //操作失败 mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title }); } } else { Event.Status = (Int32)EnumStatus.Recycle; if (Event.Update() > 0) { //移动到回收站操作成功 mTips.LoadMessage("DeleteEventSuccess", EnumTips.Success, this, new String[] { Event.Title }); } else { //移动到回收站操作失败 mTips.LoadMessage("DeleteEventError", EnumTips.Success, this, new String[] { Event.Title }); } } BindDataList(); } } } catch (Exception ex) { ProcessModuleLoadException(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)) { Playngo_ClientZone_GameSheet Event = Playngo_ClientZone_GameSheet.FindByKeyForEdit(IDX); if (Event != null && Event.ID > 0) { if (Event.Status == (Int32)EnumStatus.Recycle && Status == (Int32)EnumStatus.Recycle) { if (Event.Delete() > 0) { //删除相关的动态模块和项 Playngo_ClientZone_DynamicModule.DeleteAll(Event); } } else { Event.Status = Status; if (Event.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> /// <param name="GameSheetStatus">文章状态(为-1的时候取选项的值)</param> private Boolean SaveDataItem(Int32 GameSheetStatus, out Playngo_ClientZone_GameSheet GameSheet) { Boolean SaveResult = false; GameSheet = GameSheetItem; GameSheet.Title = Common.ReplaceEscape(txtTitle.Text); GameSheet.GameID = txtGameID.Text; GameSheet.GameID_Mobile = txtGameIDMobile.Text; GameSheet.Version = txtVersion.Text; GameSheet.NotifyInclude = cbIncludeNotification.Checked ? 1 : 0; GameSheet.NotifyStatus = WebHelper.GetIntParam(Request, ddlNotificationStatus.UniqueID, 0); //GameSheet.NotifySubscribers = cbNotifySubscribers.Checked ? 1 : 0; //文件集合 //GameSheetItem.Files = hfDownLoadFiles.Value ; //权限 GameSheet.Per_AllUsers = cbPermissionsAllUsers.Checked ? 0 : 1; String textStr, idStr = String.Empty; WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr); GameSheet.Per_Roles = idStr; //区域 GameSheet.Per_AllJurisdictions = cbAllJurisdictions.Checked ? 0 : 1; String JurisdictionTexts, JurisdictionIDs = String.Empty; WebHelper.GetSelected(cblJurisdictions, out JurisdictionTexts, out JurisdictionIDs); GameSheet.Per_Jurisdictions = JurisdictionIDs; //Game Category String GameCategoryTexts, GameCategoryIDs = String.Empty; WebHelper.GetSelected(cblGameCategory, out GameCategoryTexts, out GameCategoryIDs); GameSheet.GameCategories = GameCategoryIDs; //文章的发布状态 if (GameSheetStatus == -1)//如果没有指定状态就取控件的 { GameSheet.Status = WebHelper.GetIntParam(Request, ddlEventStatus.UniqueID, (Int32)EnumStatus.Published); } else { GameSheet.Status = GameSheetStatus; } #region "关于动态选项的代码" List <KeyValueEntity> list = new List <KeyValueEntity>(); List <SettingEntity> ItemSettingDB = GameSheet_ItemSettingDB; if (ItemSettingDB != null && ItemSettingDB.Count > 0) { ControlHelper ControlItem = new ControlHelper(ModuleId); foreach (SettingEntity ri in ItemSettingDB) { KeyValueEntity item = new KeyValueEntity(); item.Key = ri.Name; item.Value = ControlHelper.GetWebFormValue(ri, this); list.Add(item); } } //从动态选项中获取Roadmap启用状态 if (list.Exists(r => r.Key == "IncludeRoadmap")) { KeyValueEntity Entity = list.Find(r => r.Key == "IncludeRoadmap"); GameSheet.IncludeRoadmap = Convert.ToBoolean(Entity.Value) ? 0 : 1; } //伪静态URL String FriendlyUrl = String.Empty; if (list.Exists(r => r.Key == "FriendlyUrl")) { KeyValueEntity TitleEntity = list.Find(r => r.Key == "FriendlyUrl"); FriendlyUrl = TitleEntity.Value.ToString(); if (String.IsNullOrEmpty(FriendlyUrl) && !String.IsNullOrEmpty(GameSheet.Title)) { FriendlyUrl = Common.FriendlySlug(GameSheet.Title); } GameSheet.UrlSlug = FriendlyUrl; TitleEntity.Value = FriendlyUrl; list[list.FindIndex(r => r.Key == "FriendlyUrl")] = TitleEntity; } GameSheet.Options = ConvertTo.Serialize <List <KeyValueEntity> >(list); #endregion //更新项 GameSheet.LastIP = WebHelper.UserHost; GameSheet.LastTime = xUserTime.LocalTime(); GameSheet.LastUser = UserId; //开始状态和时间 DateTime oTime = xUserTime.LocalTime(); string[] expectedFormats = { "G", "g", "f", "F" }; string StartDate = WebHelper.GetStringParam(Request, txtStartDate.UniqueID, oTime.ToString("MM/dd/yyyy")); string StartTime = WebHelper.GetStringParam(Request, txtStartTime.UniqueID, oTime.ToString("HH:mm:ss")); if (DateTime.TryParseExact(String.Format("{0} {1}", StartDate, StartTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oTime)) { GameSheet.StartTime = oTime; } //发布状态和时间 DateTime oReleaseTime = xUserTime.LocalTime(); string ReleaseDate = WebHelper.GetStringParam(Request, txtReleaseDate.UniqueID, oTime.ToString("MM/dd/yyyy")); string ReleaseTime = WebHelper.GetStringParam(Request, txtReleaseTime.UniqueID, oTime.ToString("HH:mm:ss")); if (DateTime.TryParseExact(String.Format("{0} {1}", ReleaseDate, ReleaseTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oReleaseTime)) { GameSheet.ReleaseDate = oReleaseTime; } //结束状态和时间 DateTime EndTime = xUserTime.LocalTime().AddDays(1); string DisableDate = WebHelper.GetStringParam(Request, txtDisableDate.UniqueID, EndTime.ToString("MM/dd/yyyy")); string DisableTime = WebHelper.GetStringParam(Request, txtDisableTime.UniqueID, EndTime.ToString("HH:mm:ss")); if (DateTime.TryParseExact(String.Format("{0} {1}", DisableDate, DisableTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out EndTime)) { GameSheet.EndTime = EndTime; } //创建用户改为可以选择 GameSheet.CreateUser = WebHelper.GetIntParam(Request, hfEventAuthor.UniqueID, UserId); if (GameSheet.ID > 0) { //更新 } else { //新增 GameSheet.ModuleId = ModuleId; GameSheet.PortalId = PortalId; GameSheet.CreateTime = xUserTime.LocalTime(); } int ResultGameSheet = 0; if (GameSheet.ID > 0) { ResultGameSheet = GameSheet.Update(); } else { ResultGameSheet = GameSheet.ID = GameSheet.Insert(); } if (ResultGameSheet > 0) { SaveResult = true; //邮件发送 //if (GameSheet.SendMail == 0 && cbNotifySubscribers.Checked) if (cbNotifySubscribers.Checked) { //利用现成发送邮件 var objs = new Dictionary <object, object>(); objs.Add("DataItem", GameSheet); objs.Add("PortalUrl", PortalUrl); ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadCreateSendMail), objs); //更新发送状态 //Playngo_ClientZone_GameSheet.Update(String.Format("SendMail={0}", 1), String.Format("ID={0}", GameSheet.ID)); } } else { SaveResult = false; } return(SaveResult); }