protected void lbSort_Click(object sender, EventArgs e) { LinkButton ImgbutSort = (LinkButton)sender; if (ImgbutSort != null) { //查出当前要排序的字段 DNNGo_DNNGalleryProGame_Group objC = DNNGo_DNNGalleryProGame_Group.FindByKeyForEdit(ImgbutSort.CommandArgument); mTips.IsPostBack = true;//回发时就要触发 if (ImgbutSort.ToolTip == "up") { DNNGo_DNNGalleryProGame_Group.MoveField(objC, EnumMoveType.Up, ModuleId); //字段上移成功 mTips.LoadMessage("UpMoveGroupSuccess", EnumTips.Success, this, new String[] { "" }); } else { DNNGo_DNNGalleryProGame_Group.MoveField(objC, EnumMoveType.Down, ModuleId); //字段下移成功 mTips.LoadMessage("DownMoveGroupSuccess", EnumTips.Success, this, new String[] { "" }); } //绑定一下 BindDataList(); } }
/// <summary> /// 绑定分组列表 /// </summary> public void BindGroupList() { Int32 RecordCount = 0; System.Text.StringBuilder GroupString = new System.Text.StringBuilder(); QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryProGame_Group._.Sort; qp.OrderType = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, Settings_ModuleID, SearchType.Equal)); List <DNNGo_DNNGalleryProGame_Group> GroupList = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount); DNNGo_DNNGalleryProGame_Group ThisAllGroup = new DNNGo_DNNGalleryProGame_Group(); ThisAllGroup.ID = 0; ThisAllGroup.Name = "All"; GroupList.Insert(0, ThisAllGroup); foreach (DNNGo_DNNGalleryProGame_Group GroupItem in GroupList) { String activeClass = GroupItem.ID == GroupID ? "active" : ""; String LinkHref = xUrl(String.Format("GroupID{0}", ModuleId), GroupItem.ID.ToString(), "ManagerList", string.Format("Status={0}", ArticleStatus)); GroupString.AppendFormat("<a href=\"{0}\" class=\"btn btn-default {1}\">{2}</a>", LinkHref, activeClass, GroupItem.Name).AppendLine(); } liGroups.Text = GroupString.ToString(); }
public GalleryGroupEntity(DNNGo_DNNGalleryProGame_Group GroupItem) { Name = GroupItem.Name; Description = GroupItem.Description; QuoteCount = GroupItem.QuoteCount.ToString(); Sort = GroupItem.Sort.ToString(); }
/// <summary> /// 列表行绑定 /// </summary> protected void gvArticleList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 DNNGo_DNNGalleryProGame_Group Categorie = e.Row.DataItem as DNNGo_DNNGalleryProGame_Group; //移动分类按钮 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("ID", Categorie.ID.ToString(), "Groups"); //删除按钮 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") + "');"); } }
/// <summary> /// Gallery数据转XML实体 /// </summary> /// <param name="ContentItem"></param> /// <returns></returns> public XmlSliserEntity EntityToXml(DNNGo_DNNGalleryProGame_Slider ContentItem) { XmlSliserEntity ContentXml = new XmlSliserEntity(); ContentXml.Sort = ContentItem.Sort; ContentXml.Status = ContentItem.Status; //将Options提取出来处理后再还原 ContentXml.Options = Common.XmlEncode(ConvertOptions(ContentItem.Options, Setting_SliderSettingDB)); ContentXml.Groups = DNNGo_DNNGalleryProGame_Group.FindGroupsBySliderID(ContentItem.ID); ContentXml.Extension = ContentItem.Extension; ContentXml.Title = ContentItem.Title; ContentXml.FriendlyUrl = ContentItem.FriendlyUrl; ContentXml.Relations = ContentItem.Relations; //提取所有的Layers信息 ContentXml.Layers = Common.XmlEncode(ConvertLayers(ContentItem)); ContentXml.StartTime = ContentItem.StartTime; ContentXml.EndTime = ContentItem.EndTime; ContentXml.CreateTime = ContentItem.CreateTime; return(ContentXml); }
/// <summary> /// 导出 /// </summary> public String Export() { String PostContent = String.Empty; //查询字段的数据,填充待导出的XML实体 QueryParam qp = new QueryParam(); qp.OrderType = 0; Int32 RecordCount = 0; qp.Where.Add(new SearchParam("ModuleId", ModuleID, SearchType.Equal)); List <DNNGo_DNNGalleryProGame_Slider> ArticleList = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount); if (ArticleList != null && ArticleList.Count > 0) { List <XmlSliserEntity> xmlContentList = new List <XmlSliserEntity>(); List <GallerySettingsEntity> xmlSettingList = new List <GallerySettingsEntity>(); List <GalleryGroupEntity> xmlGroupList = new List <GalleryGroupEntity>(); //查询出所有的配置项 List <SettingEntity> EffectSettingDB = Setting_EffectSettingDB; if (EffectSettingDB != null && EffectSettingDB.Count > 0) { foreach (SettingEntity SettingItem in EffectSettingDB) { String SettingValue = ViewXmlSetting(SettingItem.Name, SettingItem.DefaultValue).ToString(); xmlSettingList.Add(new GallerySettingsEntity(EffectSettingsFormat(Settings_EffectName, SettingItem.Name), SettingValue)); } foreach (String key in DNNGalleryProGame_Settings.Keys) { if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0) { xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryProGame_Settings[key]))); } } } foreach (DNNGo_DNNGalleryProGame_Slider ContentItem in ArticleList) { xmlContentList.Add(EntityToXml(ContentItem)); } foreach (DNNGo_DNNGalleryProGame_Group GroupItem in DNNGo_DNNGalleryProGame_Group.FindAllByModuleID(ModuleID)) { xmlGroupList.Add(new GalleryGroupEntity(GroupItem)); } XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/SliderEntity.xml", ModulePath))); //将字段列表转换成XML的实体 PostContent = xf.ToXml <XmlSliserEntity>(xmlContentList, xmlSettingList, xmlGroupList); } return(PostContent); }
/// <summary> /// 更新分类类目下的数量 /// </summary> /// <param name="Category">分类关系</param> public static void UpdateCount(DNNGo_DNNGalleryProGame_Slider_Group Category) { DNNGo_DNNGalleryProGame_Group CategoryItem = DNNGo_DNNGalleryProGame_Group.FindByID(Category.GroupID); if (CategoryItem != null && CategoryItem.ID > 0) { CategoryItem.QuoteCount = DNNGo_DNNGalleryProGame_Slider_Group.FindCount(DNNGo_DNNGalleryProGame_Slider_Group._.GroupID, Category.GroupID); CategoryItem.Update(); } }
/// <Description> /// 拼接分类的JSon数据 /// </Description> /// <param name="lst">分类列表</param> /// <param name="ParentID">上级编号</param> /// <returns>Json数据</returns> private String CreateGroupsJson(List <DNNGo_DNNGalleryProGame_Group> lst, Int32 ParentID, List <Int32> SelectList) { //筛选数据并排列 QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryProGame_Group._.Sort; qp.OrderType = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ModuleId, SearchType.Equal)); int RecordCount = 0; List <DNNGo_DNNGalleryProGame_Group> TempList = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount); //TempList = TempList.Sort(DNNGo_DNNGalleryProGame_Group._.Sort, false); //取出数据进行拼接 StringBuilder sb = new StringBuilder(); if (ParentID == 0) { sb.Append("<ul id=\"Groupschecklist\" class=\"Categories_list list:Groups Groupschecklist form-no-clear\">"); } else { sb.Append("<ul class=\"children\">"); } foreach (DNNGo_DNNGalleryProGame_Group Groups in TempList) { sb.AppendFormat("<li id=\"Groups-{0}\">", Groups.ID); sb.Append("<label class=\"checkbox-inline selectit\">"); sb.AppendFormat("<input value=\"{0}\" class=\"square-green\" type=\"checkbox\" name=\"{1}\" id=\"post_groups_{2}\" {4} />{3}</label>", Groups.ID, String.Format("post$groups${0}", ModuleId), String.Format("post_groups_{0}", ModuleId), Groups.Name, SelectList.Contains(Groups.ID) ? "checked=\"checked\"" : ""); //String ttString = CreateGroupsJson(lst, Groups.ID, SelectList); //if (!String.IsNullOrEmpty(ttString)) //{ // sb.Append(ttString); //} sb.Append("</li>"); } sb.Append("</ul>"); if (TempList.Count > 0) { return(sb.ToString()); } else { return(String.Empty); } }
/// <summary> /// 分组列表 /// </summary> /// <returns></returns> public List <DNNGo_DNNGalleryProGame_Group> GetGroupList() { QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryProGame_Group._.Sort; qp.OrderType = 0; int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, Settings_ModuleID, SearchType.Equal)); return(DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount)); }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { DNNGo_DNNGalleryProGame_Group item = DNNGo_DNNGalleryProGame_Group.FindByKeyForEdit(TagID); item.Description = txtContentText.Text; item.Name = txtName.Text; if (divOptions.Visible) { item.Options = SetItemSettings(); } int Resultitem = 0; if (item.ID > 0) { Resultitem = item.Update(); } else { QueryParam Sqp = new QueryParam(); Sqp.ReturnFields = Sqp.Orderfld = DNNGo_DNNGalleryProGame_Group._.Sort; Sqp.OrderType = 1; Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ModuleId, SearchType.Equal)); item.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_Group.FindScalar(Sqp)) + 2; item.ModuleId = ModuleId; item.PortalId = PortalId; Resultitem = item.Insert(); } if (Resultitem > 0) { mTips.LoadMessage("SaveGroupSuccess", EnumTips.Success, this, new String[] { item.Name }); } else { //保存失败 mTips.LoadMessage("SaveGroupError", EnumTips.Success, this, new String[] { item.Name }); } Response.Redirect(xUrl("Groups"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 跳转到分类筛选链接 /// </summary> /// <param name="GroupItem"></param> /// <returns></returns> public String GoUrl(DNNGo_DNNGalleryProGame_Group GroupItem) { String AttributeUrl = String.Empty; if (bpm.Attribute1 >= 0) { AttributeUrl = String.Format("{0}_{1}={2}", "Attribute1", bpm.Settings_ModuleID, bpm.Attribute1); } else if (!String.IsNullOrEmpty(bpm.Attribute2)) { AttributeUrl = String.Format("{0}_{1}={2}", "Attribute2", bpm.Settings_ModuleID, bpm.Attribute2); } return(Globals.NavigateURL(bpm.Settings_TabID, "", String.Format("GroupID{0}={1}", bpm.Settings_ModuleID, GroupItem.ID), AttributeUrl)); }
/// <summary> /// 加载分组,并取消空格 /// </summary> /// <param name="_Value"></param> /// <returns></returns> public String ToGroups(DNNGo_DNNGalleryProGame_Slider DataItem) { StringBuilder sb = new StringBuilder(); List <DNNGo_DNNGalleryProGame_Group> list = DNNGo_DNNGalleryProGame_Group.FindAllBySliderID(DataItem.ID); if (list != null && list.Count > 0) { foreach (DNNGo_DNNGalleryProGame_Group item in list) { if (!String.IsNullOrEmpty(item.Name)) { sb.AppendFormat(" {0}", ToTrim2(item.Name)); } } } return(sb.ToString()); }
protected void cmdDeleteCategory_Click(object sender, EventArgs e) { try { DNNGo_DNNGalleryProGame_Group item = DNNGo_DNNGalleryProGame_Group.FindByKeyForEdit(TagID); 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 }); } Response.Redirect(xUrl("Groups"), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 创建下拉列表by 分组 /// </summary> /// <param name="FieldItem"></param> /// <param name="ControlName"></param> /// <param name="ControlID"></param> /// <returns></returns> public String ViewCreateDropDownListByGroup(SettingEntity FieldItem, String ControlName, String ControlID) { //构造国家数据 StringBuilder sb = new StringBuilder(FieldItem.ListContent); List <DNNGo_DNNGalleryProGame_Group> Groups = DNNGo_DNNGalleryProGame_Group.FindAllByModuleID(ModuleId); if (Groups != null && Groups.Count > 0) { foreach (DNNGo_DNNGalleryProGame_Group info in Groups) { if (info != null && !String.IsNullOrEmpty(info.Name)) { sb.AppendFormat("|{0}", info.Name); } } FieldItem.ListContent = sb.ToString(); } return(ViewCreateDropDownList(FieldItem, ControlName, ControlID)); }
/// <summary> /// 读取数据项参数 /// </summary> /// <param name="DataItem">数据项</param> /// <param name="Name">参数名</param> /// <param name="DefaultValue">默认值</param> /// <returns></returns> public static object ViewCategorySettingByStatic(DNNGo_DNNGalleryProGame_Group DataItem, String Name, object DefaultValue) { object o = DefaultValue; if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options)) { try { List <KeyValueEntity> ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(DataItem.Options); KeyValueEntity KeyValue = ItemSettings.Find(r1 => r1.Key.ToLower() == Name.ToLower()); if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key)) { o = KeyValue.Value; } } catch { } } return(o); }
/// <Description> /// 绑定树分类 /// </Description> private void BindTreeGroups(DNNGo_DNNGalleryProGame_Slider Article) { List <Int32> SelectList = new List <Int32>(); StringBuilder select = new StringBuilder(); if (Article != null && Article.ID > 0) { //填充分类的关系 List <DNNGo_DNNGalleryProGame_Slider_Group> Relationships = DNNGo_DNNGalleryProGame_Slider_Group.FindAllByArticleID(Article.ID); foreach (DNNGo_DNNGalleryProGame_Slider_Group Groups in Relationships) { SelectList.Add(Groups.GroupID); select.AppendFormat("{0},", Groups.GroupID); } } //绑定所有分类到页面 QueryParam qp = new QueryParam(); qp.Orderfld = DNNGo_DNNGalleryProGame_Group._.Sort; qp.OrderType = 0; int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ModuleId, SearchType.Equal)); List <DNNGo_DNNGalleryProGame_Group> lst = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount); //拼接顶级分类的方法 StringBuilder sb = new StringBuilder(); sb.Append("<div id=\"Groups-all\" class=\"tabs-panel\">"); String ttString = CreateGroupsJson(lst, 0, SelectList); if (!String.IsNullOrEmpty(ttString)) { sb.Append(ttString); } sb.Append("</div>"); liGroups.Text = sb.ToString(); }
/// <summary> /// 插入单项 /// </summary> /// <param name="ContentItem"></param> /// <param name="GroupName"></param> /// <returns></returns> public static Int32 InsertItem(DNNGo_DNNGalleryProGame_Slider ContentItem, String GroupName) { int RecordCount = 0; if (!String.IsNullOrEmpty(GroupName)) { List <String> GroupNames = Common.GetList(GroupName); if (GroupNames != null && GroupNames.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (String GroupString in GroupNames) { sb.AppendFormat("'{0}',", GroupString); } QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ContentItem.ModuleId, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.Name, sb.ToString().Trim(','), SearchType.In)); List <DNNGo_DNNGalleryProGame_Group> Groups = DNNGo_DNNGalleryProGame_Group.FindAll(qp, out RecordCount); if (Groups != null && Groups.Count > 0) { RecordCount = 0; foreach (DNNGo_DNNGalleryProGame_Group GroupItem in Groups) { DNNGo_DNNGalleryProGame_Slider_Group Content_Group = new DNNGo_DNNGalleryProGame_Slider_Group(); Content_Group.GroupID = GroupItem.ID; Content_Group.SliderID = ContentItem.ID; if (Content_Group.Insert() > 0) { RecordCount++; } } } } } return(RecordCount); }
/// <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_DNNGalleryProGame_Group item = DNNGo_DNNGalleryProGame_Group.FindByKeyForEdit(IDX); if (item != null && item.ID > 0) { mTips.IsPostBack = true; if (item.Delete() > 0) { //mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.ContentText }); } else { //mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.ContentText }); } } } } BindDataList(); } } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 绑定右边列表 /// </summary> private void BindDataList() { QueryParam qp = new QueryParam(); qp.PageSize = 10; qp.PageIndex = PageIndex; qp.Orderfld = Orderfld; qp.OrderType = OrderType; int RecordCount = 0; //查询的方法 qp.Where = BindSearch(); List <DNNGo_DNNGalleryProGame_Group> lst = DNNGo_DNNGalleryProGame_Group.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")); gvArticleList.DataSource = lst; gvArticleList.DataBind(); }
/// <summary> /// 绑定左边项 /// </summary> private void BindDataItem() { if (TagID > 0) { cmdDelete.Visible = true; cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); DNNGo_DNNGalleryProGame_Group item = DNNGo_DNNGalleryProGame_Group.FindByKeyForEdit(TagID); txtName.Text = item.Name; txtContentText.Text = item.Description; } else { //新增界面 cmdDelete.Visible = false; txtName.Text = ""; txtContentText.Text = ""; } }
/// <summary> /// 列表上的项删除事件 /// </summary> protected void btnRemove_Click(object sender, EventArgs e) { try { LinkButton btnRemove = (LinkButton)sender; DNNGo_DNNGalleryProGame_Group item = DNNGo_DNNGalleryProGame_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); } }
/// <summary> /// 读取XML参数 /// </summary> /// <typeparam name="T">参数类型</typeparam> /// <param name="Name">参数名</param> /// <param name="DefaultValue">默认值</param> /// <returns></returns> public T ViewCategorySettingT <T>(DNNGo_DNNGalleryProGame_Group DataItem, String Name, object DefaultValue) { return((T)Convert.ChangeType(ViewCategorySetting(DataItem, Name, DefaultValue), typeof(T))); }
/// <summary> /// 导入数据 /// </summary> /// <param name="XmlContent"></param> /// <returns></returns> public Int32 Import(Stream XmlContent) { //插入成功的数量 Int32 InsertResult = 0; if (XmlContent != null && XmlContent.Length > 0) { //将XML转换为实体 XmlFormat xf = new XmlFormat(); xf.XmlDoc.Load(XmlContent); List <XmlSliserEntity> XmlContentList = xf.ToList <XmlSliserEntity>(); List <GallerySettingsEntity> XmlSettingList = xf.ToList <GallerySettingsEntity>(); List <GalleryGroupEntity> XmlGroupList = xf.ToList <GalleryGroupEntity>(); //插入分组的记录 foreach (GalleryGroupEntity XmlGroupItem in XmlGroupList) { QueryParam qp = new QueryParam(); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.ModuleId, ModuleID, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Group._.Name, XmlGroupItem.Name, SearchType.Equal)); if (DNNGo_DNNGalleryProGame_Group.FindCount(qp) == 0) { DNNGo_DNNGalleryProGame_Group ContentItem = new DNNGo_DNNGalleryProGame_Group(); ContentItem.Name = XmlGroupItem.Name; ContentItem.Description = XmlGroupItem.Description; ContentItem.QuoteCount = Convert.ToInt32(XmlGroupItem.QuoteCount); ContentItem.Sort = Convert.ToInt32(XmlGroupItem.Sort); ContentItem.ModuleId = ModuleID; ContentItem.PortalId = DNNGalleryProGame_PortalSettings.PortalId; ContentItem.Insert(); } } //插入内容的记录 foreach (XmlSliserEntity XmlContentItem in XmlContentList) { DNNGo_DNNGalleryProGame_Slider ContentItem = XmlToEntity(XmlContentItem); ContentItem.ID = ContentItem.Insert(); if (ContentItem.ID > 0) { InsertResult++; ImportLayers(ContentItem, Common.XmlDecode(XmlContentItem.Layers)); //插入分组 DNNGo_DNNGalleryProGame_Slider_Group.InsertItem(ContentItem, XmlContentItem.Groups); } } //移除掉部分设置 XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_CopyOfOtherModule"); XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_CopyOfPortal"); XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_TabID"); XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryProGame_ModuleID"); //插入设置的记录 foreach (GallerySettingsEntity XmlSettingItem in XmlSettingList) { UpdateModuleSetting(ModuleID, XmlSettingItem.SettingName, XmlSettingItem.SettingValue); } } return(InsertResult); }
/// <summary> /// 列表行绑定 /// </summary> protected void gvArticleList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 DNNGo_DNNGalleryProGame_Slider Article = e.Row.DataItem as DNNGo_DNNGalleryProGame_Slider; if (Article != null && Article.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; //移动分类按钮 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 = Article.ID.ToString(); //设置按钮的CommandArgument btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Article.ID.ToString(); //设置删除按钮的提示 if (Article.Status == (Int32)EnumStatus.RecycleBin) { 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", Article.ID.ToString(), "AddNew"); //文章状态 e.Row.Cells[7].Text = EnumHelper.GetEnumTextVal(Article.Status, typeof(EnumStatus)); //格式化2种时间为短日期格式 e.Row.Cells[5].Text = Article.StartTime.ToShortDateString(); e.Row.Cells[6].Text = Article.EndTime.ToShortDateString(); //显示分组 if (Setting_EffectDB.Groups) { e.Row.Cells[4].Text = DNNGo_DNNGalleryProGame_Group.FindGroupsBySliderID(Article.ID); } if (!String.IsNullOrEmpty(Article.Options)) { if (gvArticleList.Columns[1].Visible || gvArticleList.Columns[2].Visible) { List <KeyValueEntity> kvList = new List <KeyValueEntity>(); try { kvList = ConvertTo.Deserialize <List <KeyValueEntity> >(Article.Options); } catch { } if (kvList != null && kvList.Count > 0) { if (kvList.Exists(r => r.Key == "Title")) { KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Title"); if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key)) { e.Row.Cells[2].Text = Convert.ToString(rowEntity.Value); } } TemplateFormat tf = new TemplateFormat(this); Image imgPicture = e.Row.FindControl("imgPicture") as Image; if (kvList.Exists(r => r.Key == "Thumbnails")) { KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Thumbnails"); if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key)) { imgPicture.ImageUrl = tf.ViewLinkUrl(Convert.ToString(rowEntity.Value)); } } else if (kvList.Exists(r => r.Key == "Picture")) { KeyValueEntity rowEntity = kvList.Find(r => r.Key == "Picture"); if (rowEntity != null && !String.IsNullOrEmpty(rowEntity.Key)) { imgPicture.ImageUrl = tf.ViewLinkUrl(Convert.ToString(rowEntity.Value)); } } else { imgPicture.Visible = false; } } } } } } }
/// <summary> /// 读取数据项参数 /// </summary> /// <param name="DataItem">数据项</param> /// <param name="Name">参数名</param> /// <param name="DefaultValue">默认值</param> /// <returns></returns> public object ViewCategorySetting(DNNGo_DNNGalleryProGame_Group DataItem, String Name, object DefaultValue) { return(TemplateFormat.ViewCategorySettingByStatic(DataItem, Name, DefaultValue)); }