protected virtual void Del_Click(object sender, EventArgs e) { string idlist = GetIdList(); int id = Common.Util.ChangeStrToInt(idlist); if (Request.Url.ToString().ToLower().IndexOf("user/index.aspx") != -1) { AdvAli.Entity.User targetUser = Logic.Consult.GetUser(id); if (id == GetLoggedMemberId()) { Common.MsgBox.JumpAlert("Msg", "<p>对不起,你的用户权限不够,无法完成该操作!</p>"); return; } if (user.GroupId <= targetUser.GroupId && user.Username != targetUser.Username) { Common.MsgBox.JumpAlert("Msg", "<p>对不起,你的用户权限不够,无法完成该操作!</p>"); return; } } if (string.IsNullOrEmpty(idlist)) { Common.MsgBox.JumpAlert("Msg", "<p>请选择需要删除的数据!</p>"); return; } Logic.Consult.DeleteBatch(idlist, deltable); Common.MsgBox.JumpAlert("Msg", "<p>删除数据成功!</p>"); }
protected override void OnInit(EventArgs e) { this.MemberId = this.GetLoggedMemberId(); if (this.MemberId > 0) { this.user = Logic.Consult.GetUser(this.MemberId); if (object.Equals(user, null)) { AdvAli.Common.MsgBox.ScriptAlert("Msg", "<p>对不起,您没有权限访问该模块!</p>", AdvAli.Config.Global.config.WebSiteUrl + "/login.aspx", "top"); } } else { AdvAli.Common.MsgBox.ScriptAlert("Msg", "<p>对不起,您还没有登陆,请登陆后重新访问!</p>", AdvAli.Config.Global.config.WebSiteUrl + "/login.aspx", "top"); } base.OnInit(e); }
protected void Rights_Click(object sender, EventArgs e) { string idlist = GetIdList(); int id = Common.Util.ChangeStrToInt(idlist); if (string.IsNullOrEmpty(idlist)) { Common.MsgBox.JumpAlert("Msg", "<p>请选择一个用户设置权限!</p>"); return; } if (idlist.IndexOf(",") != -1) { Common.MsgBox.JumpAlert("Msg", "<p>同一时间只能对一个用户进行权限设置!</p>"); return; } if (Request.Url.ToString().ToLower().IndexOf("user/index.aspx") != -1) { AdvAli.Entity.User targetUser = Logic.Consult.GetUser(id); if (id == GetLoggedMemberId()) { Common.MsgBox.JumpAlert("Msg", "<p>对不起,你的用户权限不够,无法完成该操作!</p>"); return; } if (user.GroupId <= targetUser.GroupId && user.Username != targetUser.Username) { Common.MsgBox.JumpAlert("Msg", "<p>对不起,你的用户权限不够,无法完成该操作!</p>"); return; } } if (id != 0) { HttpContext.Current.Response.Redirect(string.Format("{0}?id={1}", RightsUrl, id), true); } else { Common.MsgBox.JumpAlert("Msg", "<p>选择错误,请重新选择!</p>"); return; } }
protected void GetForum(HtmlTable data) { string[] fieldsname = FieldName.Split(new char[] { ',' }); string[] fieldswidth = FieldWidth.Split(new char[] { ',' }); int userid = this.GetLoggedMemberId(); if (this.GetLoggedUserGroupId() >= 8) { userid = 0; } int isre = 0; if (Common.Util.GetPageParamsAndToInt("isre") != -100) { isre = Common.Util.GetPageParamsAndToInt("isre"); } int pageIndex = (Common.Util.GetPageParamsAndToInt("Page") > 0) ? Common.Util.GetPageParamsAndToInt("Page") : 1; bool remove = false; if (Common.Util.GetPageParamsAndToInt("remove") != -100) { remove = Common.Util.ChangeStrToBool(Common.Util.GetPageParams("remove")); } using (DataSet ds = Logic.Consult.GetForum(userid, isre, remove, pageIndex, HtmlPager.PageSize, out recordcount)) { if (Common.Util.CheckDataSet(ds)) { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("class", "title"); HtmlTableCell htc = new HtmlTableCell(); htc.InnerHtml = "<span><input onclick=checkall() type=checkbox id=selall></span>"; htc.Width = "30"; tr.Cells.Add(htc); for (int i = 0; i < fieldsname.Length; i++) { HtmlTableCell td = new HtmlTableCell(); td.Width = fieldswidth[i]; td.InnerHtml = fieldsname[i]; tr.Cells.Add(td); } data.Rows.Add(tr); Random ro = new Random(DateTime.Now.Millisecond); int startid = ro.Next(1, 100); HtmlInputHidden hih = new HtmlInputHidden(); hih.ID = "startid"; hih.Value = startid.ToString(); Page.Form.Controls.Add(hih); HtmlInputHidden hid = new HtmlInputHidden(); hid.ID = "idlist"; hid.Value = ""; Page.Form.Controls.Add(hid); int runv = 0; foreach (DataRow reader in ds.Tables[0].Rows) { tr = new HtmlTableRow(); htc = new HtmlTableCell(); htc.InnerHtml = "<input value=\"" + reader["id"].ToString() + "\" type=checkbox onclick=\"SetHid('" + reader["id"].ToString() + "');\" id=sel" + (startid + runv).ToString() + " />"; tr.Cells.Add(htc); htc = new HtmlTableCell(); htc.InnerHtml = string.Format("<a href=\"javascript:showContext('c{1}')\">{0}</a>", reader["title"].ToString(), (startid + runv).ToString()); tr.Cells.Add(htc); htc = new HtmlTableCell(); AdvAli.Entity.User getUser = Logic.Consult.GetUser(Common.Util.ChangeStrToInt(reader["userid"].ToString())); htc.InnerHtml = getUser.Inc; htc.Attributes.Add("title", reader["postip"].ToString() + "\n" + Common.QQWry.GetIpLocation(Server.MapPath("~/data/qqwry.dat"), reader["postip"].ToString()).Country); tr.Cells.Add(htc); data.Rows.Add(tr); tr = new HtmlTableRow(); htc = new HtmlTableCell(); tr.Style.Add("display", "none"); tr.Attributes.Add("id", ("c" + (startid + runv)).ToString()); htc.Attributes.Add("class", "context"); htc.ColSpan = 3; if (this.GetLoggedUserGroupId() >= 8) { htc.InnerHtml = string.Format("<div class=\"post\"> {0} <a href=\"javascript:repost({4})\" class=\"respan\">[回复]</a><br /><span class=\"timer\">({1})</span></div><div class=\"re\"><span class=\"mng\">管理员回复:</span><br /> {2}<br /><span class=\"timer\">({3})</span></div>", reader["context"].ToString(), Common.Util.ConvertToDateTime(reader["postdate"].ToString()).ToString("yyyy年MM月dd日 hh:mm:ss"), reader["re"].ToString(), Common.Util.ConvertToDateTime(reader["redate"].ToString()).ToString("yyyy年MM月dd日 hh:mm:ss"), reader["id"].ToString()); } else if (Common.Util.ChangeStrToBool(reader["isre"].ToString())) { htc.InnerHtml = string.Format("<div class=\"post\"> {0}<br /><span class=\"timer\">({1})</span></div><div class=\"re\"><span class=\"mng\">管理员回复:</span><br /> {2}<br /><span class=\"timer\">({3})</span></div>", reader["context"].ToString(), Common.Util.ConvertToDateTime(reader["postdate"].ToString()).ToString("yyyy年MM月dd日 hh:mm:ss"), reader["re"].ToString(), Common.Util.ConvertToDateTime(reader["redate"].ToString()).ToString("yyyy年MM月dd日 hh:mm:ss")); } else { htc.InnerHtml = string.Format("<div class=\"post\"> {0}<br /><span class=\"timer\">({1})</span></div>", reader["context"].ToString(), Common.Util.ConvertToDateTime(reader["postdate"].ToString()).ToString("yyyy年MM月dd日 hh:mm:ss")); } tr.Cells.Add(htc); data.Rows.Add(tr); runv++; } } } }
protected int GetLoggedUserGroupId() { AdvAli.Entity.User user = Logic.Consult.GetUser(this.GetLoggedMemberId()); return(user.GroupId); }