protected void btnReport_ServerClick(object sender, EventArgs e)//举报 { //举报,通过connectCriticism.value获取被举报的评论的id(举报的框在页面最下面,还没样式) //判断是否登录 SomeMethod.IfLogin(this); Message message = new Message() { Sender = Convert.ToString(Session["memberId"]), Recipient = "0000000000", MessageId = MessageManagement.CreateMessageId(), CreateTime = DateTime.Now, MessageType = "举报", MessageState = "未查看" }; //获取被举报者编号 if (connectCriticism.Value.Trim() == "Theme") { message.MessageText = "【主题" + Request["themeid"] + "】" + reportText.Value.Trim(); } else { message.MessageText = "【评论" + connectCriticism.Value.Trim() + "】" + reportText.Value.Trim(); } if (message.IsError) { Msg = "参数格式错误"; printMsgToClient(); return; } Msg = MessageManagement.Send(message); printMsgToClient(); }
protected void BtnRegister_Click(object sender, EventArgs e) { string Msg; userInfoId = UserInfoManagement.CreateUserInfoId(); UserInfo userInfo = GetUserInfo(); if (userInfo.IsError) { Msg = "参数格式错误"; SomeMethod.PrintMsgToClient(this.ClientScript, Msg); return; } UserInfoManagement.AddUserInfo(userInfo); //获取数据 Member member = GetMember(); //检验数据是否出错 if (member.IsError) { Msg = "参数格式错误"; SomeMethod.PrintMsgToClient(this.ClientScript, Msg); return; } //执行并返回执行结果 MemberManagement.AddMember(member); SomeMethod.PrintMsgToClient(this.ClientScript, "注册成功"); }
void Bind() { string memberId = Convert.ToString(Request["memberId"]); DataTable dt; if (memberId != null) { dt = MemberManagement.SelectSixTable(memberId); if (dt.Rows.Count == 0) { SomeMethod.PrintMsgToClient(this.ClientScript, "未查找到相关会员的信息"); return; } string pic = SomeMethod.GetUserPicPath(dt.Rows[0]["picture"]); //获取图片路径 divPic.Attributes.Add("style", "background-image:url(" + pic + ");"); //添加背景图片 hlkSendMsg.NavigateUrl = "~/MyMessage.aspx?recipient=" + Convert.ToString(dt.Rows[0]["member_id"]); lblConcernNum.Text = Convert.ToString(dt.Rows[0]["concern_num"]); lblFans.Text = Convert.ToString(dt.Rows[0]["fans"]); lblMotto.Text = Convert.ToString(dt.Rows[0]["motto"]); lblName.Text = Convert.ToString(dt.Rows[0]["name"]); lblPubCriticism.Text = "发表评论:" + Convert.ToString(dt.Rows[0]["criticism_num"]) + " "; lblPubTheme.Text = "发表主题:" + Convert.ToString(dt.Rows[0]["theme_num"]); } }
protected void subEdit_ServerClick(object sender, ImageClickEventArgs e) { //【1】修改个人信息 UserInfo userInfo = new UserInfo() { Addr = adress.Value.Trim(), Age = Convert.ToInt32(age.Value.Trim()), Email = email.Value.Trim(), Job = job.Value.Trim(), Motto = motto.Value.Trim(), Name = realname.Value.Trim(), Tel = phone.Value.Trim(), Sex = radlSex.SelectedValue, UserInfoId = MemberManagement.ShowMember(Convert.ToString(Session["memberId"])).UserInfoId }; SomeMethod.PrintMsgToClient(this.ClientScript, UserInfoManagement.UpdateUserInfo(userInfo)); //【2】修改用户名 string Msg = MemberManagement.UpdateName(Convert.ToString(Session["memberId"]), username.Value.Trim()); if (Msg == "修改用户名成功") { Session["UserName"] = username.Value.Trim(); } SomeMethod.PrintMsgToClient(this.ClientScript, Msg); Bind(); }
protected void btnCreateDivision_Click(object sender, EventArgs e) { Division division = GetDivision(); Msg = DivisionManagement.CreateDivision(division); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); Bind(); }
protected void Page_Load(object sender, EventArgs e) { SomeMethod.IfAdmin(this); if (!IsPostBack) { Bind(); } }
void Bind() { SomeMethod.IfLogin(this.Page); DataTable dt = ConcernManagement.SelectMember(Convert.ToString(Session["memberId"])); vwConcern.DataSource = dt; vwConcern.DataBind(); }
void Bind() { SomeMethod.IfLogin(this); DataTable dt = CriticismManagement.SelectCToC(Convert.ToString(Session["memberId"])); vwCriticism.DataSource = CriticismManagement.SelectCToC(Convert.ToString(Session["memberId"])); vwCriticism.DataBind(); }
void Bind() { DataTable dt = MemberManagement.SelectNPX(Convert.ToString(Session["memberId"])); if (dt.Rows.Count != 0) { pic.Attributes.Add("style", "background-image:url(../" + SomeMethod.GetUserPicPath(dt.Rows[0]["picture"]) + ");"); } }
protected void lvCriticism_ItemCommand(object sender, ListViewCommandEventArgs e) { string criticismId = (lvCriticism.Items[(e.Item.DataItemIndex)].FindControl("hfldCriticismId") as HiddenField).Value.Trim(); if (e.CommandName == "Del") { SomeMethod.PrintMsgToClient(this.ClientScript, CriticismManagement.Delete(criticismId)); Bind(); } }
protected void btnSelect_Click(object sender, EventArgs e) { if (ddlKey.SelectedValue == "所有") { Bind(); return; } if (ddlKey.SelectedValue == "主题") { Theme theme = new Model.Theme() { ThemeId = txtKey.Text.Trim() }; if (theme.IsError) { Msg = "参数格式错误"; SomeMethod.PrintMsgToClient(this.ClientScript, Msg); return; } Bind(CriticismManagement.SelectByThemeId(theme.ThemeId)); return; } if (ddlKey.SelectedValue == "会员") { Member member = new Member() { MemberId = txtKey.Text.Trim() }; if (member.IsError) { Msg = "参数格式错误"; SomeMethod.PrintMsgToClient(this.ClientScript, Msg); return; } Bind(CriticismManagement.SeleteByMemberId(member.MemberId)); return; } if (ddlKey.SelectedValue == "编号") { Criticism criticism = new Criticism() { CriticismId = txtKey.Text.Trim() }; if (criticism.IsError) { Msg = "参数格式错误"; SomeMethod.PrintMsgToClient(this.ClientScript, Msg); return; } Bind(CriticismManagement.SelectByCriticismId(criticism.CriticismId)); return; } }
protected void Page_Load(object sender, EventArgs e) { //【1】绑定头像 if (Session["memberId"] != null) { DataTable dt = MemberManagement.SelectNPX(Convert.ToString(Session["memberId"])); if (dt.Rows.Count == 1) { imgHeadPic.ImageUrl = SomeMethod.GetUserPicPath(dt.Rows[0]["picture"]); } } }
void Bind() { SomeMethod.IfLogin(this); dt = ThemeManagement.SelectMyCollect(Convert.ToString(Session["memberId"])); if (dt.Rows.Count == 0) { Msg = "暂未收藏任何主题"; printMsgToClient(); } lvTheme.DataSource = dt; lvTheme.DataBind(); }
/// <summary> /// 根据消息类型查找消息并绑定到相应的ListView控件 /// </summary> /// <param name="messageType"></param> /// <param name="lv"></param> void selectMessage(string messageType, ListView vw) { dt = MessageManagement.SelectByRecipient("0000000000", getMessageState(), messageType); if (dt.Rows.Count == 0) { SomeMethod.PrintMsgToClient(this.ClientScript, "未查找到消息"); } else { vw.DataSource = dt; vw.DataBind(); } }
void Bind() { SomeMethod.IfLogin(this); vwNotView.DataSource = MessageManagement.SelectByRecipient(Convert.ToString(Session["memberId"]), "未查看"); vwNotView.DataBind(); vwSend.DataSource = MessageManagement.SelectBySender(Convert.ToString(Session["memberId"])); vwSend.DataBind(); vwReview.DataSource = MessageManagement.SelectByRecipient(Convert.ToString(Session["memberId"]), "已查看"); vwReview.DataBind(); if (Request["recipient"] != null) { txtMemberId.Text = Convert.ToString(Request["recipient"]); } }
protected void lvMember_ItemCommand(object sender, ListViewCommandEventArgs e) { //获取点击按钮所在项的MemberId(会员编号) string MemberId = (lvMember.Items[(e.Item.DataItemIndex)].FindControl("lblMemberId") as Label).Text; if (e.CommandName == "Edit") { Response.Redirect("MemberManage.aspx?memberId=" + MemberId); } else if (e.CommandName == "Del") { string Msg = MemberManagement.Delete(MemberId); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); Bind(); } }
protected void btnConcern_ServerClick(object sender, EventArgs e) { //判断是否登录 SomeMethod.IfLogin(this); //关注,通过connectCriticism.value获取被关注的会员的id if (Session["memberId"] != null) { Concern con = new Concern() { ConcernId = ConcernManagement.CreatConcernId(), ConcernMember = Session["memberId"].ToString().Trim(), ConcernTo = Request["memberId"].ToString().Trim() }; SomeMethod.PrintMsgToClient(this.ClientScript, ConcernManagement.AddConcern(con)); } }
protected void btnSend_Click(object sender, EventArgs e) { SomeMethod.IfLogin(this); Message message = new Message() { Sender = Convert.ToString(Session["memberId"]), Recipient = txtRecipient.Text.Trim(), MessageId = MessageManagement.CreateMessageId(), CreateTime = DateTime.Now, MessageType = "普通", MessageState = "未查看", MessageText = txtMsg.Text.Trim() }; SomeMethod.PrintMsgToClient(this.ClientScript, MessageManagement.Send(message)); }
protected void vwConcern_ItemCommand(object sender, ListViewCommandEventArgs e) { SomeMethod.IfLogin(this.Page); string memberId = (vwConcern.Items[e.Item.DataItemIndex].FindControl("hfldMemberId") as HiddenField).Value.Trim(); if (e.CommandName == "Cancal")//取消关注 { string Msg = ConcernManagement.UnConcern(Convert.ToString(Session["memberId"]), memberId); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); Bind(); } else if (e.CommandName == "More") { Response.Redirect("~/Others.aspx?memberId=" + memberId); } }
protected void btnPubTheme_Click(object sender, EventArgs e) { //判断是否登录 SomeMethod.IfLogin(this.Parent.Page); Theme theme = new Theme() { BelongToDivision = ddlDivision.SelectedValue.Trim(), Clicks = 0, Creator = Convert.ToString(Session["memberId"]), IsEssence = false, IsSettop = false, PublishTime = DateTime.Now, ThemeId = ThemeManagement.CreateThemeId(), ThemeText = Server.UrlDecode(hidContent.Value.Trim()), Title = txtTitle.Text.Trim() }; printMsgToClient(ThemeManagement.CreateTheme(theme)); }
protected void lvMember_ItemCommand(object sender, ListViewCommandEventArgs e) { SomeMethod.IfLogin(this); string memberId = (lvMember.Items[e.Item.DataItemIndex].FindControl("hidMemberId") as HiddenField).Value.Trim(); if (e.CommandName == "Concern") { Concern con = new Concern() { ConcernId = ConcernManagement.CreatConcernId(), ConcernMember = Convert.ToString(Session["memberId"]), ConcernTo = memberId }; printMsgToClient(ConcernManagement.AddConcern(con)); } else if (e.CommandName == "MsgSend") { Response.Redirect("~/MyMessage.aspx?recipient=" + memberId); } }
void Bind() { DataTable dt = MemberManagement.SelectNPX(Convert.ToString(Session["memberId"])); if (dt.Rows.Count > 0) { pic.Attributes.Add("style", "background-image:url(" + SomeMethod.GetUserPicPath(dt.Rows[0]["picture"]) + ");"); } int col = 3;//定义一行中显示的版块数 StringBuilder sb = new StringBuilder(); #region 动态生成版块列表 dt = DivisionManagement.ShowAll(); sb.Append("<table>"); for (int i = 0; i < dt.Rows.Count; i++) { if (i % col == 0) { sb.Append("<tr>"); } //<td> // <a href="ThemeList.aspx?divisionName=游戏"> // <img src="Image/Login/bg.jpg" /> // </a> //</td> sb.Append("<td><a href=\"ThemeList.aspx?divisionName="); sb.Append(dt.Rows[i]["division_name"]); //板块 sb.Append("\"><img src=\""); sb.Append("Image/DivisionPic/" + dt.Rows[i]["division_picture"]); //图片 sb.Append("\" title=\""); sb.Append(dt.Rows[i]["division_name"]); sb.Append("\" /></a></td>"); if ((i + 1) % col == 0) { sb.Append("</tr>"); } } sb.Append("</table>"); #endregion List.InnerHtml = Convert.ToString(sb); }
protected void lvDivision_ItemCommand(object sender, ListViewCommandEventArgs e) { //获取按钮所在项的版块编号 string divisionId = (lvDivision.Items[(e.Item.DataItemIndex)].FindControl("lblDivisionId") as Label).Text; if (e.CommandName == "Check") { txtDivisionId.Text = divisionId; txtDivisionName.Text = (lvDivision.Items[(e.Item.DataItemIndex)].FindControl("lblDivisionName") as Label).Text; } if (e.CommandName == "Del") { string Msg = DeleteDivision(divisionId); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); } if (e.CommandName == "FindModerator") { Response.Redirect("~/BackgroundPages/MemberSet.aspx?DivisionId=" + divisionId); } Bind(); }
protected void btnApply_Click(object sender, EventArgs e)//申请版主 { //判断是否登录 if (Session["memberId"] == null) { SomeMethod.PrintMsgToClient(this.ClientScript, "只有会员才能申请版主"); return; } if ((string)Session["role"] == "版主") { SomeMethod.PrintMsgToClient(this.ClientScript, "您已经是版主了,无法再申请"); return; } if ((string)Session["role"] == "管理员") { Msg = "管理员无需申请版主"; printMsgToClient(); return; } Message message = new Message() { CreateTime = DateTime.Now, MessageId = MessageManagement.CreateMessageId(), MessageState = "未查看", MessageText = "会员【" + Convert.ToString(Session["UserName"]) + "】申请成为【" + Convert.ToString(Request["divisionName"]) + "】版块的版主", MessageType = "申请版主", Recipient = "0000000000", Sender = Convert.ToString(Session["memberId"]) }; if (message.IsError) { Msg = "参数格式错误"; printMsgToClient(); return; } Msg = MessageManagement.Send(message); printMsgToClient(); Bind(); }
void Bind() { DataTable dt = UserInfoManagement.SelectInfo(Convert.ToString(Session["memberId"])); if (dt.Rows.Count == 1) { adress.Value = Convert.ToString(dt.Rows[0]["Addr"]); age.Value = Convert.ToString(dt.Rows[0]["Age"]); email.Value = Convert.ToString(dt.Rows[0]["Email"]); job.Value = Convert.ToString(dt.Rows[0]["Job"]); motto.Value = Convert.ToString(dt.Rows[0]["Motto"]); realname.Value = Convert.ToString(dt.Rows[0]["Name"]); phone.Value = Convert.ToString(dt.Rows[0]["Tel"]); radlSex.SelectedValue = Convert.ToString(dt.Rows[0]["Sex"]); } username.Value = Convert.ToString(Session["UserName"]); //绑定用户名 dt = MemberManagement.SelectNPX(Convert.ToString(Session["memberId"])); //绑定头像 if (dt.Rows.Count == 1) { pic.Attributes.Add("style", "background-image:url(" + SomeMethod.GetUserPicPath(dt.Rows[0]["picture"]) + ");"); } }
protected void btnPubCriticism_Click(object sender, EventArgs e)//评论 { //判断是否登录 SomeMethod.IfLogin(this); Criticism criticism = new Criticism() { CriticismId = CriticismManagement.CreateCriticismId(), MemberId = Session["memberId"].ToString().Trim(), ThemeId = Request["themeId"].ToString(), CriticismText = Server.UrlDecode(hidContent.Value.Trim()), PublishTime = DateTime.Now }; if (connectCriticism.Value.Trim() == "Theme") { if (criticism.IsError) { Msg = "参数格式错误"; printMsgToClient(); return; } Msg = CriticismManagement.PublishCriticism(criticism); } else { criticism.ConnectedCriticism = connectCriticism.Value.Trim(); if (criticism.IsError) { Msg = "参数格式错误"; printMsgToClient(); return; } Msg = CriticismManagement.ReplyCriticism(criticism); } printMsgToClient(); Bind(); }
/// <summary> /// 以弹窗的方式向客户端输出提示信息 /// </summary> void printMsgToClient() { SomeMethod.PrintMsgToClient(Page.ClientScript, Msg); }
protected void btnDeleteDivision_Click(object sender, EventArgs e) { Msg = DeleteDivision(txtDivisionId.Text.Trim()); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); }
protected void ChangePwd_ServerClick(object sender, ImageClickEventArgs e) { string Msg = MemberManagement.UpdatePwd(Convert.ToString(Session["memberId"]), oldPwd.Value.Trim(), newpwd.Value.Trim()); SomeMethod.PrintMsgToClient(this.ClientScript, Msg); }
void printMsgToClient(string Msg) { SomeMethod.PrintMsgToClient(this.Parent.Page.ClientScript, Msg); }