protected void rptDraft_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); //发布日志 if (e.CommandName == "Submit") { int logid = Convert.ToInt32(e.CommandArgument.ToString()); int id = Convert.ToInt32(Session["id"].ToString()); DataTable dt = new DataTable(); string sql = "select * from Log where logid ='" + logid + "'"; dt = myclass.JudgeIor(sql); string title = dt.Rows[0][1].ToString(); string simplify = dt.Rows[0][8].ToString(); DateTime now = DateTime.Now; //判断分类决定是否要同步动态到个人中心 sql = "select * from Log where logid = '" + logid + "'"; dt = myclass.JudgeIor(sql); string compare = "所有人可见"; if (string.Compare(compare, dt.Rows[0][5].ToString()) == 0) { sql = "update Log set draft = '1',logtime='" + now + "' where logid='" + logid + "'"; int flag = myclass.DataSQL(sql); string name = myclass.RerdName(id); string sculpture = myclass.RerdSculpture(id); string other = name + "发表了日志" + title; string state = "insert into State (stater,statetime,other,statelike,statername,staterscu,logs,lable) values('" + id + "','" + now + "','" + other + "',',','" + name + "','" + sculpture + "','" + logid + "','" + simplify + "')"; int stateflag = myclass.DataSQL(state); } Response.Write("<script>alert('发布成功!')</script>"); Server.Transfer("Log.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { string id = Session["id"].ToString(); string hobby = Session["hobby"].ToString(); string sql1 = "select * from UserList where hobby ='" + hobby + "' and id <> '" + id + "'"; myClass myclass = new myClass(); DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql1); rptsomeFriend.DataSource = dt; rptsomeFriend.DataBind(); string sql2 = "select * from UserList where id <> '" + id + "'"; dt = myclass.JudgeIor(sql2); rptallFriend.DataSource = dt; rptallFriend.DataBind(); if (!IsPostBack) { divSome.Visible = true; divAll.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { int id; if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); divMe.Visible = false; divFr.Visible = true; } else { id = Convert.ToInt32(Session["id"].ToString()); } myClass myclass = new myClass(); string sql = "select * from Album where owner='" + id + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); //构建视图排序 DataView dv = new DataView(dt); dv.Sort = "albumid desc"; dt = dv.ToTable(); //绑定用户视角repeater rptAlbum.DataSource = dt; rptAlbum.DataBind(); //绑定好友视角repeater sql = "select * from Album where owner='" + id + "' and authority='所有人可见'"; dt = myclass.JudgeIor(sql); DataView dvx = new DataView(dt); dv.Sort = "albumid desc"; dt = dvx.ToTable(); rptFr.DataSource = dt; rptFr.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { myClass myclass = new myClass(); if (Session["id"] == null) { Response.Write("<script>alert('请先登录!')</script>"); Server.Transfer("Login.aspx"); } else { int id = Convert.ToInt32(Session["id"].ToString()); DataTable dt = new DataTable(); int i, count; DataTable newdt = new DataTable(); string sql = "select * from State "; newdt = myclass.JudgeIor(sql); sql = "select * from Friends where me='" + id + "'"; dt = myclass.JudgeIor(sql); count = dt.Rows.Count; if (count > 0) { for (i = 0; i < dt.Rows.Count; i++) { sql = "select * from State where stater='" + Convert.ToInt32(dt.Rows[0][i].ToString()) + "'"; dt = myclass.JudgeIor(sql); if (dt.Rows.Count != 0) { newdt.Merge(dt); } } DataView dv = new DataView(newdt); dv.Sort = "stateid desc"; dt = dv.ToTable(); rptState.DataSource = dt; rptState.DataBind(); } } } }
//内层repeater绑定 protected void rptState_ItemDataBound(object sender, RepeaterItemEventArgs e) { myClass myclass = new myClass(); //内层repeater绑定 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drvw = (DataRowView)e.Item.DataItem; int ID = Convert.ToInt32(drvw["stateid"]); string sql = "select * from StateComment where _stateid=" + ID + ""; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); Repeater rept = (Repeater)e.Item.FindControl("rptComment"); rept.DataSource = dt; rept.DataBind(); } //判断外层repeater中部分控件是否显示 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drvw = (DataRowView)e.Item.DataItem; int ID = Convert.ToInt32(drvw["stateid"]); string sql = "select * from State where stateid=" + ID + ""; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); //显示图片相关控件 if (dt.Rows[0][10].ToString().Length == 0) { LinkButton Log = (LinkButton)e.Item.FindControl("lbtLog"); Log.Visible = false; } //显示日志部分控件 if (dt.Rows[0][11].ToString().Length == 0) { LinkButton Photo = (LinkButton)e.Item.FindControl("lbtPhoto"); Photo.Visible = false; Image imgPhoto = (Image)e.Item.FindControl("imgPhoto"); imgPhoto.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt16(Session["id"].ToString()); myClass myclass = new myClass(); int logid = Convert.ToInt32(Request.QueryString["logid"]); string sql = "select * from Log where logid='" + logid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); lbTitle.Text = dt.Rows[0][1].ToString(); lbTime.Text = dt.Rows[0][4].ToString(); lbPower.Text = dt.Rows[0][5].ToString(); lbText.Text = dt.Rows[0][2].ToString(); sql = "select top 1 * from Log where author = '" + id + "' and draft = '0' and logid<'" + logid + "' order by logid DESC"; dt = myclass.JudgeIor(sql); if (dt.Rows.Count == 0) { lbtLast.Text = ""; } else { lbtLast.Text = "←上一篇:" + dt.Rows[0][1].ToString(); } sql = "select top 1 * from Log where author = '" + id + "' and draft = '0' and logid>'" + logid + "' order by logid ASC"; dt = myclass.JudgeIor(sql); if (dt.Rows.Count == 0) { lbtForrow.Text = ""; } else { lbtForrow.Text = dt.Rows[0][1].ToString() + "下一篇→"; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { myClass myclass = new myClass(); int id = Convert.ToInt32(Session["id"].ToString()); string sql = "select * from UserList where id = '" + id + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); lbName.Text = dt.Rows[0][1].ToString(); } { if (!IsPostBack) { int logid = Convert.ToInt32(Session["logtextid"].ToString()); myClass myclass = new myClass(); DataTable dt = new DataTable(); string sql = "select * from Log where logid='" + logid + "'"; dt = myclass.JudgeIor(sql); txtTitle.Text = dt.Rows[0][1].ToString(); content1.InnerText = dt.Rows[0][2].ToString(); int _classfyid = Convert.ToInt32(dt.Rows[0][6].ToString()); int id = Convert.ToInt32(Session["id"].ToString()); sql = "select * from LogClass where logowner='" + id + "'"; dt = myclass.JudgeIor(sql); dropClass.DataSource = dt; dropClass.DataTextField = "classfyname"; dropClass.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { int id; string sql; if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); divMe.Visible = false; divMetoo.Visible = false; divRpt.Visible = false; rptFr1.Visible = true; sql = "select * from Log where author='" + id + "'and draft = '0' and logpower = '所有人可见'"; } else { id = Convert.ToInt32(Session["id"].ToString()); sql = "select * from Log where author='" + id + "'and draft = '0'"; } myClass myclass = new myClass(); DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); rptLog.DataSource = dt; rptLog.DataBind(); sql = "select * from LogClass where logowner = '" + id + "'"; dt = myclass.JudgeIor(sql); rptClassfy.DataSource = dt; rptClassfy.DataBind(); rptFr.DataSource = dt; rptFr.DataBind(); } }
protected void btnSub_Click(object sender, EventArgs e) { if (txtID.Text.Length == 0 || txtID.Text.Length >= 12) { Response.Write("<script>alert('请合法输入!')</script>"); } else { int id = Convert.ToInt32(txtID.Text); string sql = "select * from UserList where id = '" + id + "'"; myClass myclass = new myClass(); DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); string email = dt.Rows[0][7].ToString(); string Massage = "*****@*****.**"; Int16 x = 1000; Random Random = new System.Random(); string rad = Convert.ToString(Random.Next(x, x * 10)); string massage = "您的随机验证码是" + rad + ",收到后请将验证码输于找回页面。"; bool flag = Sendemails(Massage, email, "找回密码", massage); if (flag) { Response.Write("<script>alert('发送成功!');location='Test.aspx'</script>"); Session["rad"] = rad; Session["id"] = Convert.ToString(id); } } }
protected void Page_Load(object sender, EventArgs e) { int id; if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); divMe.Visible = false; divFr.Visible = true; } else { id = Convert.ToInt32(Session["id"].ToString()); } if (!IsPostBack) { myClass myclass = new myClass(); string sql = "select * from UserList where id = '" + id + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); scup.ImageUrl = dt.Rows[0][6].ToString(); lbName.Text = dt.Rows[0][1].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { //验证登陆 if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { myClass myclass = new myClass(); int id = Convert.ToInt32(Session["id"].ToString()); scup.ImageUrl = "../" + myclass.RerdSculpture(id); lbName.Text = myclass.RerdName(id); string sql = "select * from LogClass where logowner='" + id + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); //动态绑定下拉框 dropClass.DataSource = dt; dropClass.DataTextField = "classfyname"; dropClass.DataBind(); } }
//好友内层repeater绑定 protected void rptFr_ItemDataBound(object sender, RepeaterItemEventArgs e) { myClass myclass = new myClass(); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drvw = (DataRowView)e.Item.DataItem; int ID = Convert.ToInt32(drvw["replyid"]); string replyclass = "photo"; string sql = "select * from ReplyComment where _thereplyid=" + ID + " and _replyclass = '" + replyclass + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); Repeater rept = (Repeater)e.Item.FindControl("rptFrC"); rept.DataSource = dt; rept.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { if (!IsPostBack) { int id = Convert.ToInt32(Session["id"].ToString()); string sql = "select * from LogClass where logowner = '" + id + "'"; myClass myclass = new myClass(); DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); rptClass.DataSource = dt; rptClass.DataBind(); } } }
protected void rptClassfy_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); if (e.CommandName == "Delete") { int classfyid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "select * from LogClass where classfyid = '" + classfyid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); string campare = "默认分类"; if (string.Compare(campare, dt.Rows[0][1].ToString()) == 0) { Response.Write("<script>alert('默认分类不能删除!')</script>"); } else { sql = "delete from LogClass where classfyid='" + classfyid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('删除成功!')</script>"); Server.Transfer("Abstract.aspx"); } } } }
protected void lbtForrow_Click(object sender, EventArgs e) { int id; if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); } else { id = Convert.ToInt32(Session["id"].ToString()); } int logid = Convert.ToInt32(Request.QueryString["logid"]); string sql = "select top 1 * from Log where author = '" + id + "' and draft = '0' and logid>'" + logid + "' order by logid ASC"; DataTable dt = new DataTable(); myClass myclass = new myClass(); dt = myclass.JudgeIor(sql); lbtForrow.PostBackUrl = "LogContent.aspx?logid=" + dt.Rows[0][0].ToString(); //Response.Redirect('LogContent.aspx'); Response.Write("<script>window.location='LogContent.aspx'</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { int id = Convert.ToInt32(Session["id"].ToString()); myClass myclass = new myClass(); DataTable dt = new DataTable(); string sql; sql = "select * from Visitor where bevisitor='" + id + "' and visitor <> '" + id + "'"; dt = myclass.JudgeIor(sql); rptHistory.DataSource = dt; rptHistory.DataBind(); lbCountAll.Text = "历史访问量:" + Convert.ToString(dt.Rows.Count); } }
protected void rptComment_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); //跳页 if (e.CommandName == "Jump1") { int friendid = Convert.ToInt32(e.CommandArgument.ToString()); Session["Friendid"] = friendid.ToString(); Response.Write("<script>window.location='Person/Person.aspx'</script>"); } if (e.CommandName == "Jump2") { int friendid = Convert.ToInt32(e.CommandArgument.ToString()); Session["Friendid"] = friendid.ToString(); //Server.Transfer("Person/Person.asxp"); Response.Write("<script>window.location='Myhistory.aspx'</script>"); } //删除评论 if (e.CommandName == "Delete") { int statecommentid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "select * from StateComment where statecommentid = '" + statecommentid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); string time = dt.Rows[0][3].ToString(); //同步删除照片评论 if (dt.Rows[0][6].ToString().Length == 0) { int classid = Convert.ToInt32(dt.Rows[0][7].ToString()); string classfy = "photo"; sql = "delete from Reply where replytime='" + time + "' and classid ='" + classid + "' and replyclass = '" + classfy + "' "; myclass.DataSQL(sql); } //同步删除日志评论 else { int classid = Convert.ToInt32(dt.Rows[0][6].ToString()); string classfy = "log"; sql = "delete from Reply where replytime='" + time + "' and classid ='" + classid + "' and replyclass = '" + classfy + "' "; myclass.DataSQL(sql); } //删除评论 sql = "delete from StateComment where statecommentid='" + statecommentid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('删除成功!');location='Myhistory.aspx'</script>"); } } }
//用户外层repeater protected void rptMassage_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); if (e.CommandName == "Delete") { int massageid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "delete from Massage where massageid='" + massageid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('删除成功!')</script>"); } Server.Transfer("Message.aspx"); } if (e.CommandName == "Anwser") { int id = Convert.ToInt32(Session["id"].ToString()); int massageid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "select * from Massage where massageid= '" + massageid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); int massageuserid = Convert.ToInt32(dt.Rows[0][3].ToString()); DateTime now = DateTime.Now; string txt = ((TextBox)e.Item.FindControl("txtAnwserCom")).Text; //sql = "insert into MassageComment (_massageid,_massageownerid,_massageuserid,massagecommendtext,_publishtime) values('" + massageid + "','" + massageuserid + "','" + id + "','" + txt + "','" + now + "')"; string massageusername = myclass.RerdName(id); string massageownername = myclass.RerdName(massageuserid); sql = "insert into MassageComment (_massageid,_massageownerid,_massageuserid,massagecommendtext,_publishtime,_massageownername,_massageusername) values('" + massageid + "','" + massageuserid + "','" + id + "','" + txt + "','" + now + "','" + massageownername + "','" + massageusername + "')"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('回复成功!')</script>"); } Server.Transfer("Message.aspx"); } if (e.CommandName == "Jump") { int friendid = Convert.ToInt32(e.CommandArgument.ToString()); Session["Friendid"] = friendid.ToString(); Response.Write("<script>window.location='../Person/Person.aspx'</script>"); } }
protected void btnReply_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Session["id"].ToString()); int friendid; //判断是否在好友页面 if (Session["Friendid"] == null) { friendid = id; } else { friendid = Convert.ToInt32(Session["Friendid"].ToString()); } string reply = txtReply.Text; //验证空值 if (reply.Length == 0) { Response.Write("<script>alert('输入不能为空!')</script>"); } else { int photoid = Convert.ToInt32(Request.QueryString["photoid"]); DateTime now = DateTime.Now; myClass myclass = new myClass(); string replyername = myclass.RerdName(id); string replyowenername = myclass.RerdName(friendid); string replyerscu = myclass.RerdSculpture(id); string replyownerscu = myclass.RerdSculpture(friendid); string replyclass = "photo"; string sql = "insert into Reply (replytime,replyer,replyowner,replytext,replyername,replyownername,replyownerscu,replyerscu,replyclass,classid) values('" + now + "','" + id + "','" + friendid + "','" + reply + "','" + replyername + "','" + replyowenername + "','" + replyerscu + "','" + replyowenername + "','" + replyclass + "','" + photoid + "')"; int flag = myclass.DataSQL(sql); //评论同时添加到个人中心 DataTable dt = new DataTable(); sql = "select * from State where photos = '" + photoid + "'"; dt = myclass.JudgeIor(sql); int stateid = Convert.ToInt32(dt.Rows[0][0].ToString()); sql = "insert into StateComment (_stateid,_stater,_stateowner,_statetime,_statement,_photoid,_statername,_staterownername) values('" + stateid + "','" + id + "','" + friendid + "','" + now + "','" + reply + "','" + photoid + "','" + replyername + "','" + replyowenername + "')"; int stateflag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('发布成功!')</script>"); Server.Transfer("ThePhoto.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { int id; string sql; //判断是否登陆 if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { id = Convert.ToInt32(Session["id"].ToString()); DataTable dt = new DataTable(); myClass myclass = new myClass(); //判断为哪种查找方式再进行模糊查找 if (Session["name"] == null) { int number = Convert.ToInt32(Session["number"].ToString()); sql = "select * from UserList where id like'%" + number + "%'"; dt = myclass.JudgeIor(sql); } else { string name = Session["name"].ToString(); sql = "select * from UserList where name like'%" + name + "%'"; dt = myclass.JudgeIor(sql); } rptAdd.DataSource = dt; rptAdd.DataBind(); } }
public string RerdSculpture(int id) { string sql = "select * from UserList where id = '" + id + "'"; DataTable dt = new DataTable(); myClass myclass = new myClass(); dt = myclass.JudgeIor(sql); string sculpture = dt.Rows[0][6].ToString(); return(sculpture); }
protected void btnPub_Click(object sender, EventArgs e) { int id = Convert.ToInt16(Session["id"].ToString()); int logid = Convert.ToInt32(Request.QueryString["logid"]); string title = txtTitle.Text; string content = Request.Form["content1"]; string classr = dropClass.SelectedValue; string power = dropPower.SelectedValue; DateTime now = DateTime.Now; DataTable dt = new DataTable(); myClass myclass = new myClass(); if (title.Length == 0 || content.Length == 0) { Response.Write("<script>alert('输入不能为空!')</script>"); } else { string sql = "select * from LogClass where classfyname='" + classr + "'and logowner ='" + id + "'"; dt = myclass.JudgeIor(sql); int classid = Convert.ToInt16(dt.Rows[0][0].ToString()); //获取纯文本 string simplify = System.Text.RegularExpressions.Regex.Replace(content, @"<[///!]*?[^<>]*?>", "").Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace(" ", ""); //判断是否截取 if (simplify.Length >= 50) { simplify = simplify.Substring(0, 50) + "...."; } //判断是否要发动态 sql = "update Log set title='" + title + "',simplify='" + simplify + "',logtext='" + content + "',logtime='" + now + "',logpower='" + power + "', _classfyid='" + classid + "',draft='0' where logid = '" + logid + "'"; int flag = myclass.DataSQL(sql); string name = myclass.RerdName(id); string sculpture = myclass.RerdSculpture(id); string other = name + "发表了日志" + title; string state = "insert into State (stater,statetime,other,statelike,statername,staterscu,logs,lable) values('" + id + "','" + now + "','" + other + "',',','" + name + "','" + sculpture + "','" + logid + "','" + simplify + "')"; int stateflag = myclass.DataSQL(state); if (flag == 1) { Response.Write("<script>alert('发布成功!')</script>"); Server.Transfer("Draft.aspx"); } else { Response.Write("<script>alert('发布失败!')</script>"); Server.Transfer("DraftEditor.aspx"); } } }
protected void rptClass_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); if (e.CommandName == "Delete") { int classid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "delete from LogClass where classfyid='" + classid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('删除成功!')</script>"); } Server.Transfer("EditorClass.aspx"); } if (e.CommandName == "Change") { int classid = Convert.ToInt32(e.CommandArgument.ToString()); string txt = ((TextBox)e.Item.FindControl("txtName")).Text; string sql = "select * from LogClass where classfyid = '" + classid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); string campare = "默认分类"; if (txt.Length == 0) { Response.Write("<script>alert('输入不能为空!')</script>"); } else if (string.Compare(campare, dt.Rows[0][1].ToString()) == 0) { Response.Write("<script>alert('默认分类不能修改!')</script>"); } else { sql = "update LogClass set classfyname='" + txt + "' where classfyid='" + classid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('修改成功!')</script>"); } Server.Transfer("EditorClass.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { int id = Convert.ToInt32(Session["id"].ToString());; int classfyid = Convert.ToInt32(Request.QueryString["classfyid"]); myClass myclass = new myClass(); string sql = "select * from Log where author='" + id + "' and draft = '0' and _classfyid = '" + classfyid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); rptLog.DataSource = dt; rptLog.DataBind(); sql = "select * from LogClass where classfyid = '" + classfyid + "'"; dt = myclass.JudgeIor(sql); lbClass.Text = dt.Rows[0][1].ToString(); sql = "select * from LogClass where logowner = '" + id + "'"; dt = myclass.JudgeIor(sql); rptClassfy.DataSource = dt; rptClassfy.DataBind(); } }
protected void btnDrafts_Click(object sender, EventArgs e) { //功能同上 int id = Convert.ToInt32(Session["id"].ToString()); string title = txtTitle.Text; string content = Request.Form["content1"]; string classr = dropClass.SelectedValue; string power = dropPower.SelectedValue; int draft = 1; DateTime now = DateTime.Now; DataTable dt = new DataTable(); myClass myclass = new myClass(); if (title.Length == 0 || content.Length == 0) { Response.Write("<script>alert('输入不能为空!')</script>"); } else { string sql = "select * from LogClass where classfyname='" + classr + "'and logowner ='" + id + "'"; dt = myclass.JudgeIor(sql); int classid = Convert.ToInt32(dt.Rows[0][0].ToString()); string simplify = System.Text.RegularExpressions.Regex.Replace(content, @"<[///!]*?[^<>]*?>", "").Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace(" ", ""); if (simplify.Length > 50) { simplify = simplify.Substring(0, 50) + "...."; } sql = "insert into Log(title,logtext,author,logtime,logpower,_classfyid,draft,simplify) values('" + title + "','" + content + "','" + id + "','" + now + "','" + power + "','" + classid + "','" + draft + "','" + simplify + "')"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('保存成功!')</script>"); Server.Transfer("Log.aspx"); } else { Response.Write("<script>alert('保存失败!')</script>"); Server.Transfer("Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断是否登陆 myClass myclass = new myClass(); if (Session["id"] == null) { Response.Write("<script>alert('请先登录!')</script>"); Server.Transfer("Login.aspx"); } else { int id; //判断进入页面 if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); divMe.Visible = false; divFr.Visible = true; } else { id = Convert.ToInt32(Session["id"].ToString()); } DataTable dt = new DataTable(); string sql = "select * from State "; sql = "select * from State where stater ='" + id + "'"; dt = myclass.JudgeIor(sql); //新建识图排序 DataView dv = new DataView(dt); dv.Sort = "stateid desc"; dt = dv.ToTable(); //绑定用户界面repeater rptState.DataSource = dt; rptState.DataBind(); //绑定好友界面repeater rptFr.DataSource = dt; rptFr.DataBind(); } } }
protected void lbtLast_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Session["id"].ToString()); int logid = Convert.ToInt32(Request.QueryString["logid"]); string sql = "select top 1 * from Log where author = '" + id + "' and draft = '0' and logid>'" + logid + "' order by logid ASC"; DataTable dt = new DataTable(); myClass myclass = new myClass(); dt = myclass.JudgeIor(sql); Session["pagelogid1"] = dt.Rows[0][0].ToString(); Server.Transfer("LogContent1.aspx"); }
protected void rptPhoto_ItemCommand(object source, RepeaterCommandEventArgs e) { myClass myclass = new myClass(); //删除照片 if (e.CommandName == "Delete") { int photoid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "delete from Photo where photoid='" + photoid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('删除成功!')</script>"); Server.Transfer("Photo.aspx"); } } if (e.CommandName == "Interface") { //修改封面 int albumid = Convert.ToInt32(Request.QueryString["albumid"]); int photoid = Convert.ToInt32(e.CommandArgument.ToString()); string sql = "select *from Photo where photoid='" + photoid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); string path = dt.Rows[0][3].ToString(); sql = "update Album set interface='" + path + "' where albumid = '" + albumid + "'"; int flag = myclass.DataSQL(sql); if (flag == 1) { Response.Write("<script>alert('修改成功!')</script>"); Server.Transfer("Photo.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { int id; if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { if (!IsPostBack) { myClass myclass = new myClass(); if (Session["Friendid"] != null) { id = Convert.ToInt32(Session["Friendid"].ToString()); divMain.Visible = false; divFr.Visible = true; } else { id = Convert.ToInt32(Session["id"].ToString()); } string sql = "select * from Massage where massageowner = '" + id + "'"; DataTable dt = myclass.JudgeIor(sql); DataView dv = new DataView(dt); dv.Sort = "massageid desc"; dt = dv.ToTable(); rptMassage.DataSource = dt; rptMassage.DataBind(); rptFr.DataSource = dt; rptFr.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Write("<script>alert('请先登录!');location='../Login.aspx'</script>"); } else { myClass myclass = new myClass(); int albumid = Convert.ToInt32(Request.QueryString["albumid"]); string sql = "select * from Album where albumid='" + albumid + "'"; DataTable dt = new DataTable(); dt = myclass.JudgeIor(sql); albumname.Text = dt.Rows[0][1].ToString(); imgSculpture.ImageUrl = dt.Rows[0][2].ToString(); } }