Ejemplo n.º 1
0
    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");
        }
    }
Ejemplo n.º 2
0
    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>");
            }
        }
    }
Ejemplo n.º 3
0
    //用户外层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>");
        }
    }
Ejemplo n.º 4
0
    protected void btnUp_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int id = Convert.ToInt32(Session["id"].ToString());

        try
        {
            if (fup.PostedFile.FileName == "")
            {
                lblInfo.Text = "请选择文件!";
            }
            else
            {
                //string filepath = fup.PostedFile.FileName;
                if (!IsAllowedExtension(fup))
                {
                    lblInfo.Text = "上传文件格式不正确!";
                }
                if (IsAllowedExtension(fup) == true)
                {
                    string filepath   = fup.PostedFile.FileName;
                    string filename   = filepath.Substring(filepath.LastIndexOf("\\") + 1);
                    string serverpath = Server.MapPath("../Album/picture/") + filename;
                    fup.PostedFile.SaveAs(serverpath);
                    serverpath = "Album/picture/" + filename;
                    string sql  = "update UserList set sculpture='" + serverpath + "' where id='" + id + "'";
                    int    flag = myclass.DataSQL(sql);
                    sql  = "update Massage set ownersculpture='" + serverpath + "' where massageowner='" + id + "'";
                    flag = myclass.DataSQL(sql);
                    sql  = "update Reply set replyerscu='" + serverpath + "' where replyer='" + id + "'";
                    flag = myclass.DataSQL(sql);
                    sql  = "update Reply set replyownerscu='" + serverpath + "' where replyowner='" + id + "'";
                    flag = myclass.DataSQL(sql);
                    sql  = "update State set staterscu='" + serverpath + "' where stater='" + id + "'";
                    flag = myclass.DataSQL(sql);
                    if (flag == 1)
                    {
                        lblInfo.Text = "上传成功!";
                        Server.Transfer("Person.aspx");
                    }
                    else
                    {
                        lblInfo.Text = "上传失败!";
                    }
                }
                else
                {
                    lblInfo.Text = "请上传图片!";
                }
            }
        }
        catch (Exception ex)
        {
            lblInfo.Text = "上传发生错误!原因是:" + ex.ToString();
        }
    }
Ejemplo n.º 5
0
    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");
            }
        }
    }
Ejemplo n.º 6
0
    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("&nbsp;", "");
            //判断是否截取
            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");
            }
        }
    }
Ejemplo n.º 7
0
    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");
            }
        }
    }
Ejemplo n.º 8
0
    protected void btnChange_Click(object sender, EventArgs e)
    {
        string pwd   = txtPwd.Text;
        string repwd = txtrePwd.Text;

        if (String.Compare(pwd, repwd) != 0)
        {
            Response.Write("<script>alert('前后两次密码不一样!')</script>");
        }
        else
        {
            int id = Convert.ToInt32(Session["id"].ToString());

            pwd = MD5(pwd);

            string sql = "update UserList set pwd='" + pwd + "' where id='" + id + "'";

            myClass myclass = new myClass();

            int flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('重置成功!');location='Login.aspx'</script>");
            }
        }
    }
Ejemplo n.º 9
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        int    id        = Convert.ToInt16(Session["id"].ToString());
        string classname = txtAdd.Text;

        if (classname.Length == 0)
        {
            Response.Write("<script>alert('输入不能为空!')</script>");
        }
        else
        {
            string sql = "insert into LogClass (logowner,classfyname) values('" + id + "','" + classname + "')";

            myClass myclass = new myClass();

            int flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('添加成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!')</script>");
            }
            Server.Transfer("Abstract.aspx");
        }
    }
Ejemplo n.º 10
0
    //用户内层repeater
    protected void rptComment_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();

        if (e.CommandName == "Delete")
        {
            int massagecommentid = Convert.ToInt32(e.CommandArgument.ToString());

            string sql = "delete from MassageComment where massagecommentid='" + massagecommentid + "'";

            int flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('删除成功!')</script>");
            }
            Server.Transfer("Message.aspx");
        }
        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();
            Response.Write("<script>window.location='../Person/Person.aspx'</script>");
        }
    }
Ejemplo n.º 11
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int      id    = Convert.ToInt32(Session["id"].ToString());
        string   state = txtState.Text;
        DateTime now   = DateTime.Now;

        //判断空值
        if (state.Length == 0)
        {
            Response.Write("<script>alert('输入不能为空!')</script>");
        }
        else
        {
            //发表说说
            string name      = myclass.RerdName(id);
            string sculpture = myclass.RerdSculpture(id);
            string sql       = "insert into State (stater,statetime,statement,statelike,statername,staterscu) values('" + id + "','" + now + "','" + state + "',',','" + name + "','" + sculpture + "')";
            int    flag      = myclass.DataSQL(sql);
            if (flag == 1)
            {
                Response.Write("<script>alert('发布成功!');location='Myhistory.aspx'</script>");
            }
        }
    }
Ejemplo n.º 12
0
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();
        int     logid   = Convert.ToInt32(Request.QueryString["logid"]);
        string  sql     = "delete from Log where logid='" + logid + "'";
        int     flag    = myclass.DataSQL(sql);

        sql  = "delete from State where logs = '" + logid + "'";
        flag = myclass.DataSQL(sql);

        if (flag == 1)
        {
            Response.Write("<script>alert('删除成功!')</script>");
            Server.Transfer("Log.aspx");
        }
    }
Ejemplo n.º 13
0
    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");
                }
            }
        }
    }
Ejemplo n.º 14
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int id = Convert.ToInt32(Session["id"].ToString());

        string name      = txtName.Text;
        string authority = rdlAuthority.SelectedValue;

        if (name.Length == 0)
        {
            Response.Write("<script>alert('名称不能为空!')</script>");
        }
        else
        {
            string interfaces = "picture/QQ截图20161126121705.png";
            string sql        = "insert into Album (albumname,interface,owner,authority) values('" + name + "','" + interfaces + "','" + id + "','" + authority + "')";
            int    flag       = myclass.DataSQL(sql);
            if (flag == 1)
            {
                Response.Write("<script>alert('添加成功!');location='Album.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');location='AddAlbum.aspx'</script>");
            }
        }
    }
Ejemplo n.º 15
0
    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");
            }
        }
    }
Ejemplo n.º 16
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string  hobby   = radlHobby.SelectedValue;
        int     id      = Convert.ToInt32(Session["id"].ToString());
        string  sql     = "update UserList set hobby = '" + hobby + "' where id='" + id + "'";
        myClass myclass = new myClass();

        myclass.DataSQL(sql);
        Session["hobby"] = hobby;
        Server.Transfer("Friends.aspx");
    }
Ejemplo n.º 17
0
    protected void btnSex_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Session["id"].ToString());

        string  sex     = rdlSex.SelectedValue;
        myClass myclass = new myClass();

        string sql  = "update UserList set sex='" + sex + "' where id='" + id + "'";
        int    flag = myclass.DataSQL(sql);

        Response.Write("<script>alert('修改成功!');location='Person.aspx'</script>");
    }
Ejemplo n.º 18
0
    protected void btnPhone_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Session["id"].ToString());

        string  phone   = txtPhone.Text;
        myClass myclass = new myClass();

        string sql  = "update UserList set phone='" + phone + "' where id='" + id + "'";
        int    flag = myclass.DataSQL(sql);

        Response.Write("<script>alert('修改成功!');location='Person.aspx'</script>");
    }
Ejemplo n.º 19
0
    protected void rptFriends_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();

        int id = Convert.ToInt32(Session["id"].ToString());

        if (e.CommandName == "Add")
        {
            int _id = Convert.ToInt32(e.CommandArgument.ToString());

            string sql1  = "select * from Friends where  me='" + id + "' and friends = '" + _id + "'";
            int    count = myclass.JudgeAcc(sql1);

            if (count > 0)
            {
                Response.Write("<script>alert('好友已存在!')</script>");
            }
            else
            {
                string name  = myclass.RerdName(id);
                string _name = myclass.RerdName(_id);

                string sql  = "insert into Friends (me,friends,myname,friendname) values('" + id + "','" + _id + "','" + name + "','" + _name + "')";
                string _sql = "insert into Friends (me,friends,myname,friendname) values('" + _id + "','" + id + "','" + _name + "','" + name + "')";

                int flag  = myclass.DataSQL(sql);
                int _flag = myclass.DataSQL(_sql);


                if (flag == 1 && _flag == 1)
                {
                    Response.Write("<script>alert('添加成功!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('添加失败!')</script>");
                }
            }
        }
    }
Ejemplo n.º 20
0
    protected void rptFriend_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();

        if (e.CommandName == "Delete")
        {
            int relationid = Convert.ToInt32(e.CommandArgument.ToString());

            string sql = "select from Friends where relationid='" + relationid + "'";

            DataTable dt = new DataTable();

            dt = myclass.JudgeIor(sql);

            int me = Convert.ToInt32(dt.Rows[0][1].ToString());

            int friend = Convert.ToInt32(dt.Rows[0][2].ToString());

            sql = "delete from Friends where me='" + me + "' and friends = '" + friend + "'";

            int flag = myclass.DataSQL(sql);

            sql = "delete from Friends where me='" + friend + "' and friends = '" + me + "'";

            flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('删除成功!');location='FriendList.aspx'</script>");
            }
        }

        if (e.CommandName == "Jump")
        {
            int friendid = Convert.ToInt32(e.CommandArgument.ToString());
            Session["Friendid"] = friendid.ToString();
            Response.Write("<script>window.location='../Person/Person.aspx'</script>");
        }
    }
Ejemplo n.º 21
0
    protected void rptAdd_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();

        //双向添加好友同时添加两条记录
        if (e.CommandName == "Add")
        {
            int _id = Convert.ToInt32(e.CommandArgument.ToString());
            int id  = Convert.ToInt32(Session["id"].ToString());

            string name  = myclass.RerdName(id);
            string _name = myclass.RerdName(_id);

            string sql  = "insert into Friends (me,friends,myname,friendname) values('" + id + "','" + _id + "','" + name + "','" + _name + "')";
            string _sql = "insert into Friends (me,friends,myname,friendname) values('" + _id + "','" + id + "','" + _name + "','" + name + "')";

            int flag  = myclass.DataSQL(sql);
            int _flag = myclass.DataSQL(_sql);


            if (flag == 1 && _flag == 1)
            {
                Response.Write("<script>alert('添加成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!')</script>");
            }
        }

        //跳转至好友空间
        if (e.CommandName == "Jump")
        {
            int friendid = Convert.ToInt32(e.CommandArgument.ToString());
            Session["Friendid"] = friendid.ToString();
            Response.Write("<script>window.location='Person/Person.aspx'</script>");
        }
    }
Ejemplo n.º 22
0
    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("&nbsp;", "");

            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");
            }
        }
    }
Ejemplo n.º 23
0
    //图片上传并将图片重命名
    protected void btnUp_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int albumid = Convert.ToInt32(Request.QueryString["albumid"]);

        if (fup.PostedFile.FileName == "")
        {
            Response.Write("<script>alert('请选择文件!')</script>");
        }
        else
        {
            //string filepath = fup.PostedFile.FileName;
            //判断文件格式类型
            if (!IsAllowedExtension(fup))
            {
                Response.Write("<script>alert('文件类型不正确!')</script>");
            }
            if (IsAllowedExtension(fup) == true)
            {
                //获取文件路径名字并把绝对路径改成相对路径存到数据库
                //修改相册封面
                string filepath   = fup.PostedFile.FileName;
                string filename   = filepath.Substring(filepath.LastIndexOf("\\") + 1);
                string serverpath = Server.MapPath("picture/") + filename;
                fup.PostedFile.SaveAs(serverpath);
                serverpath = "picture/" + filename;
                DateTime now  = DateTime.Now;
                string   sql  = "update Album set interface='" + serverpath + "' where albumid='" + albumid + "'";
                int      flag = myclass.DataSQL(sql);
                if (flag == 1)
                {
                    Response.Write("<script>alert('修改成功!')</script>");
                    Server.Transfer("EditorAlbum.aspx");
                }
                else
                {
                    Response.Write("<script>alert('修改失败!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('请上传图片!')</script>");
            }
        }
    }
Ejemplo n.º 24
0
    protected void btnSub_Click1(object sender, EventArgs e)
    {
        //修改草稿箱
        int      id      = Convert.ToInt32(Session["id"].ToString());
        int      logid   = Convert.ToInt32(Session["drafttextid"].ToString());
        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());

            sql = "update Log set title='" + title + "',logtext='" + content + "',logtime='" + now + "',draft='1',logpower='" + power + "', _classfyid='" + classid + "' where logid = '" + logid + "'";

            int flag = myclass.DataSQL(sql);


            if (flag == 1)
            {
                Response.Write("<script>alert('修改成功!')</script>");
                Server.Transfer("Draft.aspx");
            }
            else
            {
                Response.Write("<script>alert('修改失败!')</script>");
                Server.Transfer("DraftEditor.aspx");
            }
        }
    }
Ejemplo n.º 25
0
    protected void rptToday_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();


        if (e.CommandName == "Delete")
        {
            int visiid = Convert.ToInt32(e.CommandArgument.ToString());

            string sql = "delete from Visitor where visiid='" + visiid + "'";

            int flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('删除成功!');location='Visitor.aspx'</script>");
            }
        }
    }
Ejemplo n.º 26
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        int     userid;
        myClass myclass = new myClass();

        if (Session["Friendid"] != null)
        {
            userid = Convert.ToInt32(Session["Friendid"].ToString());
        }
        else
        {
            userid = Convert.ToInt32(Session["id"].ToString());
        }
        int      id      = Convert.ToInt32(Session["id"].ToString());
        string   massage = txtMassage.Text;
        DateTime now     = DateTime.Now;

        if (massage.Length == 0)
        {
            Response.Write("<script>alert('输入不能为空!')</script>");
        }
        else
        {
            string name = myclass.RerdName(id);

            string sculpture = "../" + myclass.RerdSculpture(userid);

            //string sql = "insert into Massage (massageowner,massageuser,publishtime,massagetext,ownername,ownersculpture) values ('" + id + "','" + userid + "','" + now + "','" + massage + "'.'" + name + "','" + sculpture + "')";
            string sql = "insert into Massage (massageowner,massageuser,publishtime,massagetext,ownername,ownersculpture) values('" + userid + "','" + id + "','" + now + "','" + massage + "','" + name + "','" + sculpture + "')";

            int flag = myclass.DataSQL(sql);

            if (flag == 1)
            {
                Response.Write("<script>alert('留言成功!');location='Message.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('留言失败!')</script>");
            }
        }
    }
Ejemplo n.º 27
0
    protected void btnAuthority_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int albumid = Convert.ToInt32(Request.QueryString["albumid"]);

        string authority = rdlAuthority.SelectedValue;
        string sql       = "update Album set authority='" + authority + "'where albumid = '" + albumid + "'";

        int flag = myclass.DataSQL(sql);

        if (flag == 1)
        {
            Response.Write("<script>alert('修改成功!')</script>");
        }
        else
        {
            Response.Write("<script>alert('修改失败!')</script>");
        }
    }
Ejemplo n.º 28
0
    protected void btnName_Click(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        int    albumid = Convert.ToInt32(Request.QueryString["albumid"]);
        string name    = changename.Text;

        if (name.Length == 0)
        {
            Response.Write("<script>alert('输入不能为空!')</script>");
        }
        {
            string sql  = "update Album set albumname='" + name + "' where albumid='" + albumid + "'";
            int    flag = myclass.DataSQL(sql);
            if (flag == 1)
            {
                Response.Write("<script>alert('修改成功!')</script>");
            }
            Server.Transfer("EditorAlbum.aspx");
        }
    }
Ejemplo n.º 29
0
    protected void rptState_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        myClass myclass = new myClass();

        if (e.CommandName == "Anwser")
        {
            int id = Convert.ToInt32(Session["id"].ToString());

            int stateid = Convert.ToInt32(e.CommandArgument.ToString());

            string sql = "select * from State where stateid= '" + stateid + "'";

            DataTable dt = new DataTable();

            dt = myclass.JudgeIor(sql);

            int staterid = Convert.ToInt32(dt.Rows[0][1].ToString());

            string statername = myclass.RerdName(staterid);

            string name = myclass.RerdName(id);

            DateTime now = DateTime.Now;

            string txt = ((TextBox)e.Item.FindControl("txtAnwserCom")).Text;

            if (txt.Length == 0)
            {
                Response.Write("<script>alert('输入不能为空!')</script>");
            }
            else
            {
                //判断是否要添加到相册/日志
                int flag, stateflag;

                string locks = "上传";

                if (dt.Rows[0][3].ToString().Length != 0)
                {
                    //发表说说不需要同步评论
                    stateflag = 1;
                    sql       = "insert into StateComment (_stateid,_stater,_stateowner,_statetime,_statement,_statername,_staterownername) values('" + stateid + "','" + id + "','" + staterid + "','" + now + "','" + txt + "','" + name + "','" + statername + "')";
                    flag      = myclass.DataSQL(sql);
                }
                else if (dt.Rows[0][8].ToString().Contains(locks))
                {
                    //上传相册同步评论到相册
                    int photoid = Convert.ToInt32(dt.Rows[0][11].ToString());

                    string sculpture = myclass.RerdSculpture(id);

                    sql = "insert into StateComment (_stateid,_stater,_stateowner,_statetime,_statement,_photoid,_statername,_staterownername) values('" + stateid + "','" + id + "','" + staterid + "','" + now + "','" + txt + "','" + photoid + "','" + name + "','" + statername + "')";

                    flag = myclass.DataSQL(sql);

                    string replyclass = "photo";

                    sql = "insert into Reply (replytime,replyer,replyowner,replytext,replyername,replyownername,replyownerscu,replyerscu,replyclass,classid) values('" + now + "','" + id + "','" + id + "','" + txt + "','" + name + "','" + name + "','" + sculpture + "','" + sculpture + "','" + replyclass + "','" + photoid + "')";

                    stateflag = myclass.DataSQL(sql);
                }
                else
                {
                    //上传相册同步评论到日志
                    int logid = Convert.ToInt32(dt.Rows[0][10].ToString());

                    string sculpture = myclass.RerdSculpture(id);

                    sql = "insert into StateComment (_stateid,_stater,_stateowner,_statetime,_statement,_logid,_statername,_staterownername) values('" + stateid + "','" + id + "','" + staterid + "','" + now + "','" + txt + "','" + logid + "','" + name + "','" + statername + "')";

                    flag = myclass.DataSQL(sql);

                    string replyclass = "log";

                    sql = "insert into Reply (replytime,replyer,replyowner,replytext,replyername,replyownername,replyownerscu,replyerscu,replyclass,classid) values('" + now + "','" + id + "','" + id + "','" + txt + "','" + name + "','" + name + "','" + sculpture + "','" + sculpture + "','" + replyclass + "','" + logid + "')";

                    stateflag = myclass.DataSQL(sql);
                }


                if (flag == 1)
                {
                    Response.Write("<script>alert('回复成功!');location='Home.aspx'</script>");
                }
            }
        }



        if (e.CommandName == "Like")
        {
            int id = Convert.ToInt32(Session["id"].ToString());

            int stateid = Convert.ToInt32(e.CommandArgument.ToString());

            string locks = ',' + Convert.ToString(id) + ',';

            string sql = "select * from State where stateid = '" + stateid + "'";

            DataTable dt = new DataTable();

            dt = myclass.JudgeIor(sql);

            string like = dt.Rows[0][6].ToString();

            if (like.Contains(locks))
            {
                Response.Write("<script>alert('已经点过赞了哟!');location='Home.aspx'</script>");
            }
            else
            {
                like = dt.Rows[0][6].ToString() + Convert.ToString(id) + ',';

                int count = Convert.ToInt32(dt.Rows[0][7].ToString()) + 1;

                sql = "update State set statelike ='" + like + "',statelikecount = '" + count + "' where stateid = '" + stateid + "'";

                int flag = myclass.DataSQL(sql);
                Server.Transfer("Home.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>");
        }

        /* if (e.CommandName == "DetailLog")
         * {
         *   int friendid = Convert.ToInt32(e.CommandArgument.ToString());
         *   Session["Friendid"] = friendid.ToString();
         * }
         *
         * if (e.CommandName == "DetailPhoto")
         * {
         *   int friendid = Convert.ToInt32(e.CommandArgument.ToString());
         *   Session["Friendid"] = friendid.ToString();
         * }*/
    }
Ejemplo n.º 30
0
    protected void btnRegister_Click1(object sender, EventArgs e)
    {
        myClass myclass = new myClass();

        string pwd       = NewPwd.Text;
        string repwd     = reNewPwd.Text;
        string email     = Email.Text;
        string phone     = Phone.Text;
        string name      = Name.Text;
        string sculpture = "Album/picture/timg.jpg";
        string sex       = rdlSex.SelectedValue;

        //string province =
        if (pwd.Length == 0 || repwd.Length == 0 || email.Length == 0 || phone.Length == 0 || name.Length == 0 || sex.Length == 0)
        {
            Response.Write("<script>alert('输入不能为空!')</script>");
        }
        else
        {
            string sql1   = "select * from UserList where phone='" + phone + "'";
            string sql2   = "select * from UserList where email='" + email + "'";
            string sql4   = "select * from UserList where phone='" + phone + "'";
            int    count1 = (myclass.JudgeIor(sql1)).Rows.Count;
            int    count2 = (myclass.JudgeIor(sql2)).Rows.Count;


            if (Session["CheckCode"] != null)
            {
                string checkcode = Session["CheckCode"].ToString();
                if (TextBox1.Text != checkcode)
                {
                    Response.Write("<script>alert('验证码错误!')</script>");
                }
                else if (String.Compare(pwd, repwd) != 0)
                {
                    Response.Write("<script>alert('前面密码两次错误!')</script>");
                }
                else if (count1 > 0)
                {
                    Response.Write("<script>alert('手机号码已被绑定!')</script>");
                }
                else if (count2 > 0)
                {
                    Response.Write("<script>alert('邮箱已被验证!')</script>");
                }
                else
                {
                    pwd = MD5(pwd);

                    int count = 1, rad = 0;

                    while (count > 0)
                    {
                        Int32  x      = 1000000;
                        Random Random = new System.Random();
                        rad = Random.Next(x, x * 10);

                        string sql = "select * from UserList where id = '" + rad + "'";

                        count = myclass.JudgeAcc(sql);
                    }


                    string sql3 = "insert into UserList (id,name,pwd,email,phone,sculpture,sex) values('" + rad + "','" + name + "','" + pwd + "','" + email + "','" + phone + "','" + sculpture + "','" + sex + "')";

                    int flag = myclass.DataSQL(sql3);
                    if (flag != 1)
                    {
                        Response.Write("<script>alert('注册失败!')</script>");
                    }
                    else
                    {
                        DataTable dt = new DataTable();

                        dt = myclass.JudgeIor(sql4);

                        string id  = dt.Rows[0][0].ToString();
                        string sql = "insert into LogClass (classfyname,logowner) values('默认分类','" + id + "')";
                        myclass.DataSQL(sql);
                        Session["id"]   = id;
                        Session["name"] = name;

                        Response.Write("<script>alert('注册成功!');location='Register/RegisterSuccess.aspx'</script>");
                    }
                }
            }
        }
    }