/// <summary> /// 栏目列表信息遍历 /// </summary> /// <param name="ParentId"></param> /// <param name="Line"></param> protected void MenuListBind(int ParentId, string Line) { DataView dv = new DataView(dsList.Tables[0]); dv.RowFilter = "ParentId = " + ParentId + " and IsLock=0 "; foreach (DataRowView dr in dv) { MenuList += "<tr onMouseOver=\"over()\" onClick=\"change()\" onMouseOut=\"out()\" class=\"td_bg\">\n"; MenuList += "<td align=\"center\">" + dr[0] + "</td>\n"; foreach (string j in GetField()) { MenuList += "<td>"; if (Getnext(Convert.ToInt32(dr[0]))) { MenuList += "<a href='../Model/Model_Manage.aspx?MenuId=" + dr[0] + "'>"; } if (j == "Title") { MenuList += Line + bM.GetMenuIsSub((int)dr[0]); } MenuList += StringDeal.StrFormat(dr[j]); if (Getnext(Convert.ToInt32(dr[0]))) { MenuList += "</a>"; } MenuList += "</td>\n"; } if (MenuId == 0) { //MenuList += "<td align=\"center\" nowrap=\"nowrap\"><a href=\"MenuModel_Set.aspx?Id=" + dr[0] + "\" title=\"设置此栏目以及下属栏目的所需要字段\">栏目</a> <a href=\"Model_Set.aspx?Id=" + dr[0] + "\" title=\"设置此栏目以及下属栏目信息的所需要字段\">信息</a></td>"; } MenuList += "<td align=\"center\" nowrap=\"nowrap\">"; MenuList += "<a href=\"Menu_Edit.aspx?MenuId=" + dr[0] + "\">添加子栏目</a> "; MenuList += "<a href=\"?MenuId=" + MenuId + "&Action=up&Id=" + dr[0] + "\">上移</a>"; MenuList += " <a href=\"?MenuId=" + MenuId + "&Action=down&Id=" + dr[0] + "\">下移</a>"; //MenuList += " <a href=\"?MenuId=" + MenuId + "&Action=top&Id=" + dr[0] + "\">" + StringDeal.GetTop(StringDeal.ToBool(dr["IsTop"]), "栏目") + "</a>"; //MenuList += " <a href=\"?MenuId=" + MenuId + "&Action=lock&Id=" + dr[0] + "\">" + StringDeal.GetLock(StringDeal.ToBool(dr["IsLock"]), "栏目") + "</a>"; MenuList += " <a href=\"Menu_Edit.aspx?MenuId=" + (MenuId == 0?dr[9]:MenuId) + "&Id=" + dr[0] + "\">修改</a>"; MenuList += " <a onClick=\"return confirm('确认删除')\" href=\"?MenuId=" + MenuId + "&Action=del&Id=" + dr[0] + "\">删除</a>"; MenuList += "</td>\n</tr>\n"; MenuListBind(StringDeal.ToInt(dr[0]), "<img alt=\"\" src=\"../skin/01/ico/tree_treemiddle.gif\" width=\"18\" height=\"18\" align=\"absmiddle\">" + Line); } Depth++; }
/// <summary> /// 保存信息 /// </summary> protected void SetSave() { string[] IsOpen = Request.Form.GetValues("IsOpen"); string[] IsList = Request.Form.GetValues("IsList"); string[] ListWidth = Request.Form.GetValues("ListWidth"); string[] Title = Request.Form.GetValues("Title"); string Model_Field = "", Model_List = ""; if (StringDeal.StrFormat(IsOpen) != "") { for (int i = 0; i < IsOpen.Length; i++) { string _Title = Title[i].Replace(",", "‚").Replace("|", "│"); if (String.IsNullOrEmpty(_Title)) { _Title = bF.GetFieldTitle(IsOpen[i], mF.TableName); } Model_Field += IsOpen[i] + "," + _Title + "|"; if (StringDeal.StrFormat(IsList) != "") { foreach (string j in IsList) { if (j == IsOpen[i]) { Model_List += j + "," + _Title + "," + ListWidth[i] + "|"; } } } else { StringDeal.Alter("至少选择一项列表显示"); } } } else { StringDeal.Alter("至少选择一项开启状态"); } mM.Model_Field = Model_Field.Trim('|'); mM.Model_List = Model_List.Trim('|'); bM.MenuSet(mM); Response.Redirect("Menu_Manage.aspx"); }
/// <summary> /// 模型绑定 /// </summary> protected void BindModel() { bTable bT = new bTable(); this.Model.DataSource = bT.TableList(); this.Model.DataTextField = "Title"; this.Model.DataValueField = "Id"; this.Model.DataBind(); this.Model.SelectedValue = MenuReader("Model"); if (MenuId > 0) { this.ModelId.Attributes.Add("style", "display:none;"); if (mM.Id == 0) { mM.Temp = "Model"; this.Model.SelectedValue = StringDeal.StrFormat(bM.GetMenuField(mM, MenuId)); } } }
/// <summary> /// 获取字段的标题 /// </summary> /// <param name="Id"></param> /// <param name="Title"></param> /// <returns></returns> protected string GetFieldTitle(object FieldName, object Title) { string Results = ""; if (String.IsNullOrEmpty(Arry[0])) { Results = StringDeal.StrFormat(Title); } else { foreach (string x in Arry) { if (x.Split(',')[0] == FieldName.ToString()) { Results = x.Split(',')[1]; } } } return(Results); }
/// <summary> /// 保存频道修改/添加 /// </summary> protected void AdminGroupSave() { mAG.Title = this.Title.Text; mAG.ParentId = StringDeal.ToInt(this.ParentId.Text); mAG.Note = this.Note.Text; mAG.GroupSetting = StringDeal.StrFormat(Request.Form["GroupSetting"]); mAG.OtherSetting = StringDeal.StrFormat(GetOtherValue(mAG.GroupSetting)); if (mAG.Id > 0) { if (bAG.AdminGroupUpdate(mAG) == 1) { StringDeal.Alter("父级组不能为其本身!"); } } else { bAG.AdminGroupInsert(mAG); } StringDeal.Alter("保存完成!", "AdminGroup_Manage.aspx"); }
/// <summary> /// 栏目列表标题遍历 /// </summary> protected void MenuListTitleBind() { int i = 4; if (MenuId > 0) { i = Arry.Length + 2; } MenuList = "<tr>\n"; MenuList += "<td colspan=\"" + i + "\" class=\"redbold\">" + MenuTitle + "列表</td>\n"; MenuList += "</tr>\n"; MenuList += "<tr onMouseOver=\"over()\" onClick=\"change()\" onMouseOut=\"out()\" class=\"td_bg\">\n"; MenuList += "<th width=\"10%\" align=\"center\">序号</th>\n"; if (MenuId == 0) { MenuList += "<th>栏目名称</th>\n"; //MenuList += "<th width=\"15%\" align=\"center\" nowrap=\"nowrap\">模型设置</th>"; } else if (String.IsNullOrEmpty(Arry[0])) { MenuList += "<th >栏目名称</th>\n"; } else { foreach (string x in Arry) { string width = ""; if (StringDeal.ToInt(x.Split(',')[2]) > 0) { width = " width='" + x.Split(',')[2] + "%'"; } MenuList += "<th" + width + ">" + StringDeal.StrFormat(x.Split(',')[1]) + "</th>\n"; } } MenuList += "<th width=\"26%\" align=\"center\">操作</th>\n"; MenuList += "</tr>\n"; }
/// <summary> /// 栏目列表标题遍历 /// </summary> protected void ListTitleBind() { int i = Arry.Length + 6; InfoList = "<tr>\n"; InfoList += "<td colspan=\"" + i + "\" class=\"redbold\">" + this.MenuTitle.Text + "列表</td>\n"; InfoList += "</tr>\n"; InfoList += "<tr onMouseOver=\"over()\" onClick=\"change()\" onMouseOut=\"out()\" class=\"td_bg\">\n"; InfoList += "<th><input type=\"checkbox\" onClick=\"check();\" /></th>\n"; InfoList += "<th aling=\"center\" nowrap=\"nowrap\" title=\"信息ID\">Id</th>"; foreach (string x in Arry) { string width = ""; if (StringDeal.ToInt(x.Split(',')[2]) > 0) { width = " width='" + x.Split(',')[2] + "%'"; } InfoList += "<th" + width + ">" + StringDeal.StrFormat(x.Split(',')[1]) + "</th>\n"; } InfoList += "<th aling=\"center\" nowrap=\"nowrap\" title=\"排序号\">排序</th>\n"; InfoList += "<th aling=\"center\" nowrap=\"nowrap\" title=\"锁定状态\">状态</th>\n"; InfoList += "<th align=\"center\">操作</th>\n"; InfoList += "</tr>\n"; }
protected void Page_Load(object sender, EventArgs e) { LoginCheck.AdminManage(); Pages = StringDeal.ToInt(Request.QueryString["Page"]); string Action = Request.QueryString["Action"]; mU.Temp = Request.Params["Id"]; mU.GroupId = StringDeal.ToInt(Request.QueryString["GroupId"]); this.InsertId.HRef = "User_Edit.aspx?GroupId=" + mU.GroupId; if (!IsPostBack) { if (Action == "del") { bU.UserDel(mU); Response.Redirect("User_Manage.aspx?GroupId=" + mU.GroupId + "&Page=" + Pages); } else if (Action == "lock") { mU.Id = StringDeal.ToInt(Request.QueryString["Id"]); if (bU.GetUserLock(mU)) { mU.IsLock = false; } else { mU.IsLock = true; } bU.UserLock(mU); Response.Redirect("User_Manage.aspx?GroupId=" + mU.GroupId + "&Page=" + Pages); } mU.UserName = StringDeal.StrFormat(Request.QueryString["UserName"]); mU.Temp = StringDeal.StrFormat(Request.QueryString["IsLock"]); this.GroupTitle.Text = bU.GetUserGroupTitle(mU); UserBind(); } }
private void MenuList(int Id, string Separator, string MenuId) { DataView dv = new DataView(dsList.Tables[0]); dv.RowFilter = "ParentId = " + Id; foreach (DataRowView dr in dv) { HttpContext.Current.Response.Write(" <option value='" + dr["Id"] + "'" + StringDeal.GetSelected(dr["Id"], MenuId) + ">" + Separator + StringDeal.StrFormat(dr["Title"]) + "</option>"); MenuList(StringDeal.ToInt(dr[0]), "┃" + Separator, MenuId); } }
/// <summary> /// 根据字段名和表明获取字段排序号 /// </summary> /// <param name="Field"></param> /// <param name="Table"></param> /// <returns></returns> public string GetFieldSort(string Field, string Table) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetFieldSort", 0, Field, Table))); }
/// <summary> /// 根据ID获取字段的标题 /// </summary> /// <param name="Id"></param> /// <returns></returns> public string GetFiledTitle(int Id) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetFieldTitle", Id, "", ""))); }
/// <summary> /// 根据模型ID,获取模型标题 /// </summary> /// <param name="ModelId"></param> /// <returns></returns> public string GetModelTitle(object ModelId) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetTableTitle", StringDeal.ToInt(ModelId)))); }
/// <summary> /// 获取栏目模型字段信息 /// </summary> /// <param name="Info"></param> /// <returns></returns> public string GetMenuField(mMenu Info, int MenuId) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetMenuField", MenuId, Info.Temp))); }
/// <summary> /// 根据组ID,获取用户组模型 /// </summary> /// <param name="Info"></param> /// <returns></returns> public string GetTableName(mUser Info) { int Id = StringDeal.ToInt(SQLHelper.ExecuteScalar("Select TOP 1 Model FROM tb_UserGroup WHERE Id = " + Info.GroupId + "")); return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetTableName", Id))); }
/// <summary> /// 根据用户组ID获取组名称 /// </summary> /// <param name="Info"></param> /// <returns></returns> public string GetUserGroupTitle(mUser Info) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetUserGroupTitle", Info.GroupId))); }
/// <summary> /// 栏目列表信息遍历 /// </summary> /// <param name="ParentId"></param> /// <param name="Line"></param> protected void ListBind(int MenuId) { #region 2010-05-25 mjh string mmod = "style=\"display:none;\""; string mdel = "style=\"display:none;\""; string mshow = "style=\"display:none;\""; if (mM.Id != 0) { DataSet dst = bM.MenuReader(mM); if (dst.Tables[0].Rows.Count > 0) { string[] Arry2 = dst.Tables[0].Rows[0]["Sitting"].ToString().Split(','); for (int i = 0; i < Arry2.Length; i++) { if (Arry2[i] == "2") { mmod = ""; } if (Arry2[i] == "3") { mdel = ""; } if (Arry2[i] == "5") { mshow = ""; } } } } #endregion mm.FieldList = GetField(); mm.Condition = " ClassId=" + MenuId; mm.Sort = "Sort DESC"; mm.PageSize = 20; mm.PageIndex = StringDeal.ToInt(Request.QueryString["Page"]); DataSet ds = bm.ModelList(mm); //----分页开始----- SgqPage pg = new SgqPage(); pg.PageSize = mm.PageSize; pg.PageIndex = mm.PageIndex; pg.RecordCount = (int)ds.Tables[1].Rows[0][0];//获取数据总数 this.PageView.Text = pg.PageView2(); //----分页结束----- foreach (DataRow dr in ds.Tables[0].Rows) { InfoList += "<tr onMouseOver=\"over()\" onClick=\"change()\" onMouseOut=\"out()\" class=\"td_bg\">\n"; InfoList += "<td align=\"center\"><input type=\"checkbox\" name=\"Id\" value=\"" + dr[0] + "\" /></td>\n"; InfoList += "<td align=\"center\">" + dr[0] + "</td>\n"; int x = 0; foreach (string j in GetField().Split(',')) { int i = 0; if (x == 0) { if (StringDeal.GetTrueOfStr(dr["IsTop"], "[置顶]") != string.Empty) { i++; } if (StringDeal.GetTrueOfStr(dr["IsElite"], "[推荐]") != string.Empty) { i++; } if (StringDeal.GetTrueOfStr(dr["IsHot"], "[热门]") != string.Empty) { i++; } i = i * 6; } InfoList += "<td><div class=\"editfieldbox\" title=\"" + StringDeal.StrFormat(dr[j]) + "\">" + HXD.Common.StringDeal.Substrings1(StringDeal.StrFormat(dr[j]).ToString(), 44 - i) + " "; if (x == 0) { InfoList += "<span style=\"color:green;\">"; InfoList += StringDeal.GetTrueOfStr(dr["IsTop"], "[置顶]"); InfoList += StringDeal.GetTrueOfStr(dr["IsElite"], "[推荐]"); InfoList += StringDeal.GetTrueOfStr(dr["IsHot"], "[热门]"); InfoList += "</span>"; } InfoList += "</div></td>\n"; x++; } InfoList += "<td align=\"center\" nowrap=\"nowrap\"><input type=\"type\" onchange=\"IsNum(this.value," + dr[0] + ");\" class=\"input required\" size=\"3\" id=\"SortId_" + dr[0] + "\" name=\"SortId\" value=\"" + dr["Sort"] + "\" /><span id='s" + dr[0] + "'></span></td>\n"; InfoList += "<td align=\"center\" nowrap=\"nowrap\">" + StringDeal.GetYesOrNo(dr["IsStatus"]) + "</td>\n"; InfoList += "<td align=\"center\" nowrap=\"nowrap\">"; InfoList += " <a href=\"Useradd.aspx?MenuId=" + dr[0] + "\">添加管理员</a> <a " + mshow + " href=\"Model_show.aspx?MenuId=" + MenuId + "&Id=" + dr[0] + "\">查看</a> <a " + mmod + " href=\"Model_Edit.aspx?MenuId=" + MenuId + "&Id=" + dr[0] + "\">修改</a> <a " + mdel + " onclick=\"return confirm('确认删除');\" href=\"?Action=del&MenuId=" + MenuId + "&Id=" + dr[0] + "\">删除</a>"; InfoList += "</td>\n</tr>\n"; } }
/// <summary> /// 根据模型表ID获取表名 /// </summary> /// <param name="Id"></param> /// <returns></returns> public string GetTableName(int Id) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetTableName", Id))); }
/// <summary> /// 根据ID获取栏目标题 /// </summary> /// <param name="MenuId"></param> /// <returns></returns> public string GetMenuTitle(int MenuId) { return(StringDeal.StrFormat(SQLHelper.ExecuteScalar("GetMenuTitle", MenuId))); }