public void RowDataBoundByEvents(GridViewRowEventArgs e) { //还原出数据 Playngo_ClientZone_Event DataItem = e.Row.DataItem as Playngo_ClientZone_Event; if (DataItem != null && DataItem.ID > 0) { TemplateFormat xf = new TemplateFormat(this); HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink; hlFileName.Text = DataItem.Title; Image imgFileName = e.Row.FindControl("imgFileName") as Image; //发布者信息 e.Row.Cells[2].Text = "--"; if (DataItem.LastUser > 0) { UserInfo uInfo = UserController.GetUserById(PortalId, DataItem.LastUser); if (uInfo != null && uInfo.UserID > 0) { e.Row.Cells[2].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName); } } //发布时间 e.Row.Cells[3].Text = DataItem.CreateTime.ToShortDateString(); //状态 e.Row.Cells[4].Text = EnumHelper.GetEnumTextVal(DataItem.Status, typeof(EnumStatus)); } }
/// <summary> /// 列表行绑定 /// </summary> protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_DownloadFile Event = e.Row.DataItem as Playngo_ClientZone_DownloadFile; if (Event != null && Event.ID > 0) { HyperLink hlEdit = e.Row.FindControl("hlEdit") as HyperLink; HyperLink hlMobileEdit = e.Row.FindControl("hlMobileEdit") as HyperLink; LinkButton btnRemove = e.Row.FindControl("btnRemove") as LinkButton; LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton; HyperLink hlNewsletter = e.Row.FindControl("hlNewsletter") as HyperLink; Literal liNewsletterClientID = e.Row.FindControl("liNewsletterClientID") as Literal; HyperLink hlRegisters = e.Row.FindControl("hlRegisters") as HyperLink; HyperLink hlRepeats = e.Row.FindControl("hlRepeats") as HyperLink; Literal liRepeatsClientID = e.Row.FindControl("liRepeatsClientID") as Literal; HyperLink HLEventTitle = e.Row.FindControl("HLEventTitle") as HyperLink; //设置按钮的CommandArgument btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Event.ID.ToString(); //设置删除按钮的提示 if (Event.Status == (Int32)EnumStatus.Recycle) { btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); } else { btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); } hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Event.ID.ToString(), "Downloads-Edit"); HLEventTitle.Text = Event.Title; //HLEventTitle.NavigateUrl = CommonFriendlyUrls.EventFriendlyUrl(Event, this); //Globals.NavigateURL("", "Token=Info", "EventID=" + Convert.ToString( Event.ID)); //获取用户名称 DotNetNuke.Entities.Users.UserInfo createUser = new DotNetNuke.Entities.Users.UserController().GetUser(PortalId, Event.CreateUser); e.Row.Cells[3].Text = createUser != null && createUser.UserID > 0 ? createUser.Username : ""; //文章状态 e.Row.Cells[6].Text = EnumHelper.GetEnumTextVal(Event.Status, typeof(EnumStatus)); //格式化3种时间为短日期格式 e.Row.Cells[4].Text = Event.ReleaseDate.ToShortDateString(); e.Row.Cells[5].Text = Event.StartTime.ToShortDateString(); //e.Row.Cells[6].Text = Event.CreateTime.ToShortDateString(); } } }
/// <summary> /// 列表行绑定 /// </summary> protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_DownloadFile Media = e.Row.DataItem as Playngo_ClientZone_DownloadFile; if (Media != null && Media.ID > 0) { TemplateFormat xf = new TemplateFormat(this); HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink; hlFileName.Text = Media.Title; Image imgFileName = e.Row.FindControl("imgFileName") as Image; //imgFileName.ImageUrl = xf.ViewLinkUrl(Media.) //Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label; //lblFileExtension.Text = Media.FileExtension; //Image imgFileName = e.Row.FindControl("imgFileName") as Image; //HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink; //hlFileName.Text = Media.FileName.Replace("." + Media.FileExtension, ""); //imgFileName.ImageUrl = GetPhotoExtension(Media.FileExtension, Media.FilePath); //hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath); //发布者信息 e.Row.Cells[2].Text = "--"; if (Media.LastUser > 0) { UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser); if (uInfo != null && uInfo.UserID > 0) { e.Row.Cells[2].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName); } } //发布时间 e.Row.Cells[3].Text = Media.LastTime.ToShortDateString(); //状态 e.Row.Cells[4].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumStatus)); } } }
/// <summary> /// 列表行绑定 /// </summary> protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_Files Media = e.Row.DataItem as Playngo_ClientZone_Files; if (Media != null && Media.ID > 0) { Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label; lblFileExtension.Text = Media.FileExtension; Image imgFileName = e.Row.FindControl("imgFileName") as Image; HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink; hlFileName.Text = Media.FileName.Replace("." + Media.FileExtension, ""); imgFileName.ImageUrl = GetPhotoExtension(Media.FileExtension, Media.FilePath); hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath); HyperLink hlAdd = e.Row.FindControl("hlAdd") as HyperLink; if (InsertType) { //插入到文章内容 hlAdd.Attributes.Add("onclick", String.Format("ReturnHtmlPicture('{0}',{1});", GetPhotoExtension(Media.FileExtension, Media.FilePath), Media.ID)); } else { hlAdd.Attributes.Add("onclick", String.Format("ReturnPicture('{0}',{1});", GetPhotoExtension(Media.FileExtension, Media.FilePath), Media.ID)); } //发布者信息 e.Row.Cells[1].Text = "--"; if (Media.LastUser > 0) { UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser); if (uInfo != null && uInfo.UserID > 0) { e.Row.Cells[1].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName); } } //发布时间 e.Row.Cells[2].Text = Media.LastTime.ToShortDateString(); //状态 e.Row.Cells[3].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumFileStatus)); } } }
protected void RepeaterItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Playngo_ClientZone_DynamicItem DynamicItem = e.Item.DataItem as Playngo_ClientZone_DynamicItem; HyperLink hlDynamicItemEdit = e.Item.FindControl("hlDynamicItemEdit") as HyperLink; if (hlDynamicItemEdit != null) { hlDynamicItemEdit.Attributes.Add("data-href", DynamicItem_IframeUrl(DynamicItem.ID, DynamicItem.DynamicID, ((EnumDynamicItemType)DynamicItem.Type).ToString())); } Literal liItemType = e.Item.FindControl("liItemType") as Literal; if (liItemType != null) { liItemType.Text = EnumHelper.GetEnumTextVal(DynamicItem.Type, typeof(EnumDynamicItemType)); } } }
/// <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_Campaign Event = Playngo_ClientZone_Campaign.FindByKeyForEdit(IDX); if (Event != null && Event.ID > 0) { if (Event.Status == (Int32)EnumStatus.Recycle && Status == (Int32)EnumStatus.Recycle) { if (Event.Delete() > 0) { } } 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); } }
public void Execute(BasePage Context) { Dictionary <String, Object> jsonDicts = new Dictionary <String, Object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); Common.UpdateDictionary(jsonDicts, "Message", ""); Common.UpdateDictionary(jsonDicts, "Result", "false"); Int32 DownloadID = WebHelper.GetIntParam(Context.Request, "DownloadID", 0); Int32 ItemID = WebHelper.GetIntParam(Context.Request, "ItemID", 0); if (DownloadID > 0 && ItemID > 0) { var DownloadRelation = new Playngo_ClientZone_DownloadRelation(); Int32 PageType = WebHelper.GetIntParam(Context.Request, "PageType", 0); Int32 RecordCount = 0; QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.DownloadID, DownloadID, SearchType.Equal)); qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.PageType, PageType, SearchType.Equal)); qp.Where.Add(new SearchParam(Playngo_ClientZone_DownloadRelation._.ItemID, ItemID, SearchType.Equal)); if (Playngo_ClientZone_DownloadRelation.FindCount(qp) == 0) { DownloadRelation.PageType = PageType; DownloadRelation.DownloadID = DownloadID; DownloadRelation.ItemID = ItemID; DownloadRelation.Sort = Playngo_ClientZone_DownloadRelation.FindMaxSrot(DownloadID, PageType) + 1; DownloadRelation.ModuleId = Context.ModuleId; DownloadRelation.PortalId = Context.PortalId; DownloadRelation.CreateTime = xUserTime.LocalTime(); DownloadRelation.CreateUser = Context.UserId; DownloadRelation.ID = DownloadRelation.Insert(); if (DownloadRelation.ID > 0) { foreach (var Field in Playngo_ClientZone_DownloadRelation.Meta.Fields) { jsonDicts.Add(Field.ColumnName, DownloadRelation[Field.ColumnName]); } Common.UpdateDictionary(jsonDicts, "PageTypeText", EnumHelper.GetEnumTextVal(DownloadRelation.PageType, typeof(EnumDisplayModuleType))); Common.UpdateDictionary(jsonDicts, "Title", WebHelper.GetStringParam(Context.Request, "Title", "")); Common.UpdateDictionary(jsonDicts, "Result", "true"); } else { Common.UpdateDictionary(jsonDicts, "Message", "添加数据不成功"); } } else { //DownloadRelation = Playngo_ClientZone_DownloadRelation.FindItem(qp, out RecordCount); Common.UpdateDictionary(jsonDicts, "Message", "数据已经存在忽略"); } } else { //出入的ID数据不对 Common.UpdateDictionary(jsonDicts, "Message", "出入的ID数据不对"); } //转换数据为json ResponseString = jsSerializer.Serialize(jsonDicts); }
public void Execute(BasePage Context) { JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>(); TemplateFormat xf = new TemplateFormat(); QueryParam qp = new QueryParam(); qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1); qp.PageSize = WebHelper.GetIntParam(Context.Request, "PageSize", xf.ViewSettingT <Int32>("General.GameSheets.Pagings", 12)); //排序的规则 Int32 Sort = WebHelper.GetIntParam(Context.Request, "Sort", 0); if (Sort == (Int32)EnumSortQueryByGame.GameName_DESC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.Title; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.GameName_ASC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.Title; qp.OrderType = 0; } else if (Sort == (Int32)EnumSortQueryByGame.GameID_DESC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.GameID; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.GameID_ASC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.GameID; qp.OrderType = 0; } else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_DESC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.ReleaseDate; qp.OrderType = 1; } else if (Sort == (Int32)EnumSortQueryByGame.ReleaseDate_ASC) { qp.Orderfld = Playngo_ClientZone_GameSheet._.ReleaseDate; qp.OrderType = 0; } else { qp.Orderfld = Playngo_ClientZone_GameSheet._.ID; qp.OrderType = 1; } //查询语句 qp = CreateQueryParam(qp, Context); //权限筛选 qp = CreateQueryByRoles(qp, Context); //区域筛选 qp = CreateQueryByJurisdictions(qp, Context); //游戏分类筛选 qp = CreateQueryByGameGategorys(qp, Context); int RecordCount = 0; List <Playngo_ClientZone_GameSheet> GameSheetList = Playngo_ClientZone_GameSheet.FindAll(qp, out RecordCount); //配置值 XmlFormat xmlFormat = new XmlFormat(Context.Server.MapPath(String.Format("{0}Resource/xml/Config.Setting.GameSheets.xml", Context.ModulePath))); var XmlItemSetting = xmlFormat.ToList <SettingEntity>(); List <Dictionary <String, Object> > DictFiles = new List <Dictionary <string, object> >(); foreach (var GameSheetItem in GameSheetList) { int index = GameSheetList.IndexOf(GameSheetItem); //index 为索引值 Dictionary <String, Object> jsonDict = new Dictionary <String, Object>(); //循环输出所有的固定项 foreach (var Field in Playngo_ClientZone_GameSheet.Meta.Fields) { jsonDict.Add(Field.ColumnName, GameSheetItem[Field.ColumnName]); } if (XmlItemSetting != null && XmlItemSetting.Count > 0) { var ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(GameSheetItem.Options); foreach (var ItemSetting in XmlItemSetting) { jsonDict = Common.UpdateDictionary(jsonDict, ItemSetting.Name, xf.ViewItemSetting(GameSheetItem, ItemSetting.Name, ItemSetting.DefaultValue)); } } jsonDict = Common.UpdateDictionary(jsonDict, "ReleaseDateString", GameSheetItem.ReleaseDate.ToShortDateString()); jsonDict = Common.UpdateDictionary(jsonDict, "Image", xf.ViewLinkUrl(xf.ViewItemSettingT <string>(GameSheetItem, "Image", ""), "", Context)); jsonDict = Common.UpdateDictionary(jsonDict, "Url", xf.GoUrl(GameSheetItem)); //未来日期出现Coming Soon jsonDict = Common.UpdateDictionary(jsonDict, "ComingSoonDisplay", GameSheetItem.ReleaseDate > xUserTime.LocalTime()); Int32 NotifyStatus = (Int32)EnumNotificationStatus.None; if (GameSheetItem.NotifyInclude == 1) //&& GameSheetItem.StartTime >= xUserTime.LocalTime().AddDays(-xf.ViewSettingT<Int32>("General.ExpiryTimeNotification", 7))) { NotifyStatus = GameSheetItem.NotifyStatus; } jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatus", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus))); jsonDict = Common.UpdateDictionary(jsonDict, "NotificationStatusClass", EnumHelper.GetEnumTextVal(NotifyStatus, typeof(EnumNotificationStatus)).ToLower()); DictFiles.Add(jsonDict); } jsonPictures.Add("data", DictFiles); jsonPictures.Add("Pages", qp.Pages); jsonPictures.Add("RecordCount", RecordCount); //转换数据为json ResponseString = jsSerializer.Serialize(jsonPictures); }
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); }
/// <summary> /// 设置数据项 /// </summary> private void SetDataItem() { Dictionary <String, Object> DynamicItemJsons = new Dictionary <String, Object>(); Playngo_ClientZone_DynamicItem Dynamic = DynamicItem; List <KeyValueEntity> list = new List <KeyValueEntity>(); if (divOptions.Visible) { Dynamic.Options = SetItemSettings(ref list); } if (list.Exists(r => r.Key == "Title")) { var TitleItem = list.Find(r => r.Key == "Title"); Dynamic.Title = TitleItem.Value.ToString(); } //更新项 Dynamic.LastIP = WebHelper.UserHost; Dynamic.LastTime = xUserTime.UtcTime(); Dynamic.LastUser = UserId; if (Dynamic.ID > 0) { //更新 } else { //新增 Dynamic.ModuleId = ModuleId; Dynamic.PortalId = PortalId; Dynamic.DynamicID = DynamicID; if (ConfigName == EnumDynamicItemType.ImageText.ToString()) { Dynamic.Type = (Int32)EnumDynamicItemType.ImageText; } else if (ConfigName == EnumDynamicItemType.Video.ToString()) { Dynamic.Type = (Int32)EnumDynamicItemType.Video; } else if (ConfigName == EnumDynamicItemType.Image.ToString()) { Dynamic.Type = (Int32)EnumDynamicItemType.Image; } else if (ConfigName == EnumDynamicItemType.xFrame.ToString()) { Dynamic.Type = (Int32)EnumDynamicItemType.xFrame; } else { Dynamic.Type = (Int32)EnumDynamicItemType.Text; } QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicItem._.ModuleId, ModuleId, SearchType.Equal)); qp.Where.Add(new SearchParam(Playngo_ClientZone_DynamicItem._.DynamicID, DynamicID, SearchType.Equal)); Dynamic.Sort = Playngo_ClientZone_DynamicItem.FindCount(qp) + 10; } int ResultDynamic = 0; if (Dynamic.ID > 0) { ResultDynamic = Dynamic.Update(); DynamicItemJsons.Add("Action", "Update"); } else { ResultDynamic = Dynamic.ID = Dynamic.Insert(); DynamicItemJsons.Add("Action", "Insert"); } foreach (var Field in Playngo_ClientZone_DynamicItem.Meta.Fields) { DynamicItemJsons.Add(Field.ColumnName, Dynamic[Field.ColumnName]); } DynamicItemJsons.Add("TypeText", EnumHelper.GetEnumTextVal(Dynamic.Type, typeof(EnumDynamicItemType))); DynamicItemJsons.Add("EditUrl", DynamicItem_IframeUrl(Dynamic.ID, Dynamic.DynamicID, ((EnumDynamicItemType)Dynamic.Type).ToString())); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); jsSerializer.MaxJsonLength = Int32.MaxValue; String JsonString = jsSerializer.Serialize(DynamicItemJsons); Response.Write(String.Format("<script>window.parent.EditDynamicItems({0});</script>", JsonString)); }
/// <summary> /// 列表行绑定 /// </summary> protected void gvCommentList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_Files Media = e.Row.DataItem as Playngo_ClientZone_Files; if (Media != null && Media.ID > 0) { #region "编辑&删除按钮" HyperLink hlEdit = e.Row.FindControl("hlEdit") as HyperLink; HyperLink hlMobileEdit = e.Row.FindControl("hlMobileEdit") as HyperLink; LinkButton btnRemove = e.Row.FindControl("btnRemove") as LinkButton; LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton; //设置按钮的CommandArgument btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Media.ID.ToString(); //设置删除按钮的提示 //if (Media.Status == (Int32)EnumFileStatus.Recycle) //{ btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); //} //else //{ // btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); // btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); //} hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Media.ID.ToString(), "AddMedia"); #endregion //发布者信息 e.Row.Cells[3].Text = "--"; if (Media.LastUser > 0) { UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser); if (uInfo != null && uInfo.UserID > 0) { e.Row.Cells[3].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName); } } //发布时间 e.Row.Cells[4].Text = Media.LastTime.ToShortDateString(); //状态 e.Row.Cells[5].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumFileStatus)); Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label; lblFileExtension.Text = Media.FileExtension; Image imgFileName = e.Row.FindControl("imgFileName") as Image; HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink; hlFileName.Text = Media.FileName.Replace("." + Media.FileExtension, ""); imgFileName.ImageUrl = GetPhotoExtension(Media.FileExtension, Media.FilePath); hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath); Label lblSize = e.Row.FindControl("lblSize") as Label; if (Media.FileSize > 1024) { lblSize.Text = String.Format("{0} MB", Media.FileSize / 1024); } else { lblSize.Text = String.Format("{0} KB", Media.FileSize); } } } }