/// <summary> /// 绑定左边项 /// </summary> private void BindDataItem() { if (CategoryID > 0) { cmdDelete.Visible = true; cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); Playngo_ClientZone_FileType item = CategoryItem; txtName.Text = item.Name; txtContentText.Text = item.ContentText; } else { //新增界面 cmdDelete.Visible = false; txtName.Text = ""; txtContentText.Text = ""; } DotNetNuke.UI.Utilities.ClientAPI.RegisterKeyCapture(txtSearch, btnSearch, 13); }
protected void lbSort_Click(object sender, EventArgs e) { LinkButton ImgbutSort = (LinkButton)sender; if (ImgbutSort != null) { //查出当前要排序的字段 Playngo_ClientZone_FileType objC = Playngo_ClientZone_FileType.FindByKeyForEdit(ImgbutSort.CommandArgument); mTips.IsPostBack = true;//回发时就要触发 if (ImgbutSort.ToolTip == "up") { Playngo_ClientZone_FileType.MoveField(objC, EnumMoveType.Up, ModuleId); //字段上移成功 mTips.LoadMessage("UpMoveGroupSuccess", EnumTips.Success, this, new String[] { "" }); } else { Playngo_ClientZone_FileType.MoveField(objC, EnumMoveType.Down, ModuleId); //字段下移成功 mTips.LoadMessage("DownMoveGroupSuccess", EnumTips.Success, this, new String[] { "" }); } //绑定一下 BindDataList(); } }
/// <summary> /// 绑定右边列表 /// </summary> private void BindDataList() { QueryParam qp = new QueryParam(); qp.Orderfld = Orderfld; qp.OrderType = 0; qp.PageSize = 9999; int RecordCount = 0; //查询的方法 qp.Where = BindSearch(); List <Playngo_ClientZone_FileType> lst = Playngo_ClientZone_FileType.FindAll(qp, out RecordCount); qp.RecordCount = RecordCount; RecordPages = qp.Pages; lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages")); if (lst != null && lst.Count > 0) { gvEventList.DataSource = SortList(lst, 0, 0); } //tlview.DataBind(); gvEventList.DataBind(); }
private int Compare(Playngo_ClientZone_FileType info1, Playngo_ClientZone_FileType info2) { int result; CaseInsensitiveComparer ObjectCompare = new CaseInsensitiveComparer(); result = ObjectCompare.Compare(info1.Sort, info2.Sort); return(result); }
protected void cmdDeleteCategory_Click(object sender, EventArgs e) { try { Playngo_ClientZone_FileType item = Playngo_ClientZone_FileType.FindByKeyForEdit(CategoryID); if (item.ID > 0 && item.Delete() > 0) { mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name }); } else { mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name }); } Response.Redirect(xUrl("FileTypes"), false); } 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_FileType item = Playngo_ClientZone_FileType.FindByKeyForEdit(IDX); if (item != null && item.ID > 0) { mTips.IsPostBack = true; if (item.Delete() > 0) { //mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name }); } else { //mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name }); } } } } BindDataList(); } } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 列表上的项删除事件 /// </summary> protected void btnRemove_Click(object sender, EventArgs e) { try { LinkButton btnRemove = (LinkButton)sender; Playngo_ClientZone_FileType item = Playngo_ClientZone_FileType.FindByKeyForEdit(btnRemove.CommandArgument); mTips.IsPostBack = true; if (item.ID > 0 && item.Delete() > 0) { mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name }); } else { mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name }); } BindDataList(); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 列表行绑定 /// </summary> protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_FileType Categorie = e.Row.DataItem as Playngo_ClientZone_FileType; //移动分类按钮 LinkButton lbSortUp = e.Row.FindControl("lbSortUp") as LinkButton; LinkButton lbSortDown = e.Row.FindControl("lbSortDown") as LinkButton; LinkButton lbMobileSortUp = e.Row.FindControl("lbMobileSortUp") as LinkButton; LinkButton lbMobileSortDown = e.Row.FindControl("lbMobileSortDown") as LinkButton; lbSortUp.CommandArgument = lbSortDown.CommandArgument = lbMobileSortUp.CommandArgument = lbMobileSortDown.CommandArgument = Categorie.ID.ToString(); //编辑按钮 HyperLink hlMobileEdit = e.Row.FindControl("hlMobileEdit") as HyperLink; HyperLink hlEdit = e.Row.FindControl("hlEdit") as HyperLink; hlMobileEdit.NavigateUrl = hlEdit.NavigateUrl = xUrl("CategoryID", Categorie.ID.ToString(), "FileTypes"); //删除按钮 LinkButton btnRemove = e.Row.FindControl("btnRemove") as LinkButton; LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton; btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Categorie.ID.ToString(); btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); //分类名称 HyperLink hlCategorie = e.Row.FindControl("hlCategorie") as HyperLink; hlCategorie.Text = Categorie.Name; //hlCategorie.NavigateUrl = new TemplateFormat(this).GoUrl(Categorie); } }
/// <summary> /// 绑定数据项 /// </summary> private void BindDataItem() { Playngo_ClientZone_DownloadFile Event = EventItem; //验证文章是否存在 if (DownloadID > 0 && (Event == null || DownloadID != Event.ID)) { //需要给出提示,载入文章错误 mTips.LoadMessage("LoadingEventError", EnumTips.Error, this, new String[] { "" }); Response.Redirect(xUrl("Downloads"), false); } if (Event == null) { Event = new Playngo_ClientZone_DownloadFile(); } //这里需要验证一下权限,当作者进入到别人的文章时,需要跳到列表页面 if (Event != null && Event.ID > 0 && (!IsAdministrator && !IsAdmin) && Event.CreateUser != UserId) { //需要给出提示,你无权编辑其他作者的文章 mTips.LoadMessage("NoPermissionEventAlert", EnumTips.Warning, this, new String[] { Event.Title }); Response.Redirect(xUrl("Downloads"), false); } if (Event != null && Event.ID > 0) { liLastUpdated.Text = Event.LastTime.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.DateTimeFormatInfo.InvariantInfo); } txtTitle.Text = Common.RestoreEscape(Event.Title); //txtGameID.Text = Event.GameID; txtVersion.Text = Event.Version; cbIncludeNotification.Checked = Event.NotifyInclude == 1; WebHelper.SelectedListByValue(ddlNotificationStatus, Event.NotifyStatus); cbNotifySubscribers.Checked = Event.NotifySubscribers == 1; txtStartDate.Text = Event.StartTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo); txtStartTime.Text = Event.StartTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo); txtReleaseDate.Text = Event.ReleaseDate.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo); txtReleaseTime.Text = Event.ReleaseDate.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo); txtDisableDate.Text = Event.EndTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo); txtDisableTime.Text = Event.EndTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo); //角色 DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController(); WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName"); WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Event.Per_Roles); cbPermissionsAllUsers.Checked = Event.Per_AllUsers == 0; //区域 cbAllJurisdictions.Checked = Event.Per_AllJurisdictions == 0; WebHelper.BindList(cblJurisdictions, Playngo_ClientZone_Jurisdiction.GetAllCheckList(ModuleId), "Name", "ID"); WebHelper.SelectedListMultiByValue(cblJurisdictions, Event.Per_Jurisdictions); //Game Categorys WebHelper.BindList(cblGameCategory, Playngo_ClientZone_GameCategory.GetAllCheckList(ModuleId), "Name", "ID"); WebHelper.SelectedListMultiByValue(cblGameCategory, Event.GameCategories); //File Types WebHelper.BindList(cblFileType, Playngo_ClientZone_FileType.GetAllCheckList(ModuleId), "Name", "ID"); WebHelper.SelectedListMultiByValue(cblFileType, Event.FileTypes); Event.CreateUser = Event.CreateUser == 0 ? UserId : Event.CreateUser; UserInfo CreateUserInfo = UserController.GetUserById(PortalId, Event.CreateUser); hfEventAuthor.Value = Event.CreateUser.ToString(); lbEventAuthor.Text = CreateUserInfo != null && CreateUserInfo.UserID > 0 ? CreateUserInfo.DisplayName : "None"; imgEventAuthor.ImageUrl = ViewUserPic(CreateUserInfo); WebHelper.SelectedListByValue(ddlEventStatus, Event.Status);//管理员看到的文章状态 }
/// <summary> /// 创建邮件内容 /// </summary> /// <param name="EmailTo"></param> /// <returns></returns> public EmailInfo CreateMailHtml(Playngo_ClientZone_DownloadFile DataItem, UserInfo UserItem) { //构造邮件信息 EmailInfo emailItem = new EmailInfo(); emailItem.Settings = Settings; emailItem.PushSettings(); //事件作者 UserInfo EventUser = UserController.GetUserById(DataItem.PortalId, DataItem.CreateUser); string Template_Subject = NetHelper.ReplaceNoCase(MailSetting.MailSubject, "[TITLE]", DataItem.Title); Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[MAILSETTING_TIME]", MailSetting.MailTime.ToString()); Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_MAIL]", EventUser.Email); Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_USERNAME]", EventUser.Username); Template_Subject = NetHelper.ReplaceNoCase(Template_Subject, "[AUTHOR_DISPLAYNAME]", EventUser.DisplayName); emailItem.Subject = Template_Subject; #region "构造邮件信息" String Template_Content = NetHelper.ReplaceNoCase(MailSetting.MailBody, "[TITLE]", DataItem.Title); //Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CONTENTTEXT]", HttpUtility.HtmlDecode(DataItem.ContentText)); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CREATETIME]", DataItem.CreateTime.ToString()); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[CREATEDATE]", DataItem.CreateTime.ToShortDateString()); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[MAILSETTING_TIME]", MailSetting.MailTime.ToString()); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[DATETIME_NOW]", xUserTime.LocalTime().ToString()); //注册的信息丢进来 Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_MAIL]", EventUser.Email); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_USERNAME]", EventUser.Username); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[AUTHOR_DISPLAYNAME]", EventUser.DisplayName); //订阅用户的信息丢进来 Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_MAIL]", UserItem.Email); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_USERNAME]", UserItem.Username); Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[USER_DISPLAYNAME]", UserItem.DisplayName); //图片替换 if (Common.Contains(Template_Content, "[PICTURE]")) { Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[PICTURE]", FormatThumbnailUrl(DataItem)); } //文章链接 if (Common.Contains(Template_Content, "[LINK]")) { Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[LINK]", FormatItemUrl(DataItem)); } if (Common.Contains(Template_Content, "[FILETYPES]")) { Template_Content = NetHelper.ReplaceNoCase(Template_Content, "[FILETYPES]", Playngo_ClientZone_FileType.ConvertFileTypes(DataItem.FileTypes)); } emailItem.Content = Template_Content; #endregion emailItem.MailTo = MailSetting.MailTo; if (MailSetting.MailTo.ToUpper() == "[AUTHOR_MAIL]")//用户邮件需要发送给用户 { emailItem.MailTo = EventUser.Email; } else if (MailSetting.MailTo.ToUpper() == "[USER_MAIL]")//用户邮件需要发送给用户 { emailItem.MailTo = UserItem.Email; } emailItem.MailCC = MailSetting.MailCC; return(emailItem); }
public void Execute(BasePage Context) { Dictionary <String, Object> jsonDatas = new Dictionary <string, Object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); TemplateFormat xf = new TemplateFormat(Context); QueryParam qp = new QueryParam(); qp.Orderfld = WebHelper.GetStringParam(Context.Request, "Orderfld", "ID"); qp.OrderType = WebHelper.GetIntParam(Context.Request, "OrderType", 1); qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1); qp.PageSize = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.Downloads.Pagings", 10)); //查询语句 qp = CreateQueryParam(qp, Context); //权限筛选 qp = CreateQueryByRoles(qp, Context); //区域筛选 qp = CreateQueryByJurisdictions(qp, Context); //文件类型筛选 qp = CreateQueryByFileTypes(qp, Context); //游戏分类筛选 qp = CreateQueryByGameGategorys(qp, Context); int RecordCount = 0; List <Playngo_ClientZone_DownloadFile> fileList = Playngo_ClientZone_DownloadFile.FindAll(qp, out RecordCount); //配置值 XmlFormat xmlFormat = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.Downloads.xml", Context.ModulePath))); var XmlItemSetting = xmlFormat.ToList <SettingEntity>(); List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >(); foreach (var fileItem in fileList) { int index = fileList.IndexOf(fileItem); //index 为索引值 Dictionary <String, Object> jsonDict = new Dictionary <String, Object>(); //循环输出所有的固定项 foreach (var Field in Playngo_ClientZone_DownloadFile.Meta.Fields) { jsonDict.Add(Field.ColumnName, fileItem[Field.ColumnName]); } if (XmlItemSetting != null && XmlItemSetting.Count > 0) { var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(fileItem.Options); foreach (var ItemSetting in XmlItemSetting) { jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(fileItem, ItemSetting.Name, ItemSetting.DefaultValue)); } } //下载地址 String DownloadUrl = String.Format("{0}Resource_Service.aspx?ModuleId={1}&Token={2}&TabId={3}&PortalId={4}&language={5}&FileId={6}", Context.ModulePath, Context.Settings_ModuleID, "DownloadFile", Context.Settings_TabID, Context.PortalId, Context.language, fileItem.ID); jsonDict = Common.UpdateDictionary(jsonDict, "DownloadUrl", DownloadUrl); jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", fileItem.ReleaseDate.ToShortDateString()); //文件类型转换 jsonDict = Common.UpdateDictionary(jsonDict, "FileTypesString", Playngo_ClientZone_FileType.ConvertFileTypes(fileItem.FileTypes)); //订阅状态等 Int32 NotifyStatus = (Int32)EnumNotificationStatus.None; if (fileItem.NotifyInclude == 1) //&& fileItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7))) { NotifyStatus = fileItem.NotifyStatus; } jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus))); jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower()); //未来日期出现Coming Soon jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", fileItem.ReleaseDate > xUserTime.LocalTime()); DictFiles.Add(jsonDict); } jsonDatas.Add("data", DictFiles); jsonDatas.Add("Pages", qp.Pages); jsonDatas.Add("RecordCount", RecordCount); //转换数据为json ResponseString = jsSerializer.Serialize(jsonDatas); }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { Playngo_ClientZone_FileType item = Playngo_ClientZone_FileType.FindByKeyForEdit(CategoryID); item.ContentText = txtContentText.Text; item.Name = txtName.Text; List <KeyValueEntity> list = new List <KeyValueEntity>(); if (divOptions.Visible) { item.Options = SetItemSettings(out list); } item.LastIP = WebHelper.UserHost; item.LastTime = xUserTime.UtcTime(); item.LastUser = UserId; if (item.ID > 0) { } else { QueryParam qp = new QueryParam(); item.Sort = Playngo_ClientZone_FileType.FindMaxSort(ModuleId) + 1; item.ModuleId = ModuleId; item.PortalId = PortalId; } int Resultitem = 0; if (item.ID > 0) { Resultitem = item.Update(); } else { Resultitem = item.Insert(); } if (Resultitem > 0) { mTips.LoadMessage("SaveCategorySuccess", EnumTips.Success, this, new String[] { item.Name }); } else { //保存失败 mTips.LoadMessage("SaveCategoryError", EnumTips.Success, this, new String[] { item.Name }); } Response.Redirect(xUrl("FileTypes"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }