protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["NowUserId"] != null)
            {
                if (Request.QueryString["id"] == null)
                {
                    string id;
                    id = Session["NowUserId"].ToString();

                    SQLOperation sql = new SQLOperation();

                    RepeaterOperate rptOperate = new RepeaterOperate();

                    DataTable dtt = sql.select(" distinct users.NickName,A_Status.* ", " Friends,(users join A_Status on users.id = A_Status.UserId) ", " (users.id = " + id + ") or (Friends.UserId =" + id + " and Users.id = Friends.FriendId)");
                    //rptOperate.dataBound(ref rptAllStatus, ref dtt);
                    rptOperate.dataBound(ref rptAllStatus, ref dtt, 1, ref lblTotal, 5);
                    lblNow.Text = "1";
                }
                else
                {
                    helperSpecial.alertHelper(this, "您无权访问他人的个人中心!");
                }
            }
            else
            {
                Response.Write("<script> alert('请先登录!');location=  'MainPage.aspx'</script> ");
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["NowUserId"] != null)
        {
            /*权限设置的选项初始化*/
            dplstLimit.Items.Add("所有人可见");
            dplstLimit.Items.Add("仅好友可见");
            dplstLimit.Items.Add("仅自己可见");
            dplstLimit.Items.Add("部分好友不可见");
            if (Request.QueryString["id"] != null)//说明现在是在被访问状态
            {
                divStatusAdd.Visible = false;
            }
            else
            {
                string id;
                id = Session["NowUserId"].ToString();

                SQLOperation sql = new SQLOperation();

                RepeaterOperate rptOperate = new RepeaterOperate();

                DataTable dtt = sql.select(" users.NickName,A_Status.* ", " users,a_status ", " users.id = " + id);
                //rptOperate.dataBound(ref rptAllStatus, ref dtt);
//                rptOperate.dataBound(ref rptStatusShow, ref dtt, 1, ref lblTotal, 5);
                //            lblNow.Text = "1";
            }
        }
        else
        {
            helper.alertHelper(this, "请先登录!", "MainPage.aspx");
        }
    }
    /* protected void btnAddFriend_Click(object sender, EventArgs e)
     * {
     *   divAddSearch.Visible = true;
     * }
     */
    protected void btnSearch_Click(object sender, EventArgs e) //查找按钮
    {
        SQLOperation    sql       = new SQLOperation();
        RepeaterOperate rptHelper = new RepeaterOperate();

        string text = txtSearch.Text;

        if (txtSearch == null)
        {
            txtSearch.Text = "请填写内容!";
        }
        else
        {
            DataTable dt = sql.select(" nickname,loginstatus,id,number ", " users ", " number= '" + text + "' or nickname='" + text + "'"); //nickname or number to find
            if (dt == null)
            {
                txtSearch.Text = "没有相匹配的用户";
            }
            else
            {
                lblNowResult.Text = "1";
                rptHelper.dataBound(ref rptSearchResult, ref dt, 1, ref lblTotalResult, 5);
            }
        }

        divSearchResult.Visible  = true;
        divResearchPages.Visible = true;
        rptSearchResult.Visible  = true;
    }
Beispiel #4
0
    protected void rptAllAlbum_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        SQLOperation    sql       = new SQLOperation();
        RepeaterOperate rptHelper = new RepeaterOperate();
        DataTable       dt        = new DataTable();

        if (e.CommandName == "btnDelAlbum")
        {
            string albumId = e.CommandArgument.ToString();
            if (sql.delete(" a_album ", " id =" + albumId))
            {
                Response.Write("<script> alert('删除相册成功!');location=  'AlbumPage.aspx'</script> ");
            }
            else
            {
                Response.Write("<script> alert('删除相册失败!');</script> ");
            }
        }
        else if (e.CommandName == "imgBtnAlbum")
        {
            rptAllAlbum.Visible      = false;
            divShowPhotos.Visible    = true;
            divPagesForAll.Visible   = false;
            divPagesForPhoto.Visible = true;

            /*绑定数据是显示当前相册下的所有照片*/
            dt = sql.select(" * ", " a_photo ", " albumID=" + Request.QueryString["albumId"].ToString());
            rptHelper.dataBound(ref rptPhotos, ref dt, 1, ref lblTotalPhoto, 30);
            lblNowPhoto.Text = "1";
        }
    } //所有相册的显示--按钮判断
    protected void hylkAllFriends_Click(object sender, EventArgs e) //所有好友的显示
    {
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();

        if (divAllFriends.Visible)
        {
            hylkAllFriends.Text   = "查看好友";
            divAllFriends.Visible = false;
        }
        else
        {
            string id;

            id = Session["NowUserId"].ToString();
            DataTable dt = sql.select(" friends.friendId,users.nickname,users.loginstatus ", " friends,users ", " friends.userId= " + id + " and friends.friendId = users.id ");
            if (dt.Rows.Count == 0)
            {
                dt = sql.select(" friends.userId,users.nickname,users.loginstatus ", " friends,users ", " friends.friendId= " + id + " and friends.friendId = users.id ");
                dt.Columns["userId"].ColumnName = "friendId";
            }
            rptHelper.dataBound(ref rptFriends, ref dt, 1, ref lblTotal, 5);
            lblNow.Text         = "1";
            hylkAllFriends.Text = "收起";

            divAllFriends.Visible = true;
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["NowUserId"] != null)
            {
                string       id;
                SQLOperation sql = new SQLOperation();
                DataTable    dt  = new DataTable();
                divNewAlbum.Visible = false;
                /*权限设置的选项初始化*/
                dplstLimit.Items.Add("所有人可见");
                dplstLimit.Items.Add("仅好友可见");
                dplstLimit.Items.Add("仅自己可见");
                dplstLimit.Items.Add("部分好友不可见");

                if (Request.QueryString["id"] != null) //visiting
                {
                    id = Request.QueryString["id"].ToString();

                    rptAllAlbum.FindControl("btnDelAlbum").Visible = false; //访问者不可以删除相册
                    rptPhotos.FindControl("btnDelPhoto").Visible   = false; //访问者不可以删除照片
                    btnNewAlbum.Visible = false;                            //访问者不可以添加相册
                    divAddPhoto.Visible = false;                            //访问者不可以上传照片

                    /*绑定数据使显示所有相册*/
                    dt = sql.select(" id,AlbumName ", " a_album ", " userId = " + id);
                    rptAllAlbum.DataSource = dt;
                    rptAllAlbum.DataBind();
                }
                else //not visiting
                {
                    id = Session["NowUserId"].ToString();

                    /*给相册分类的下拉框绑定数据并且赋给默认值*/
                    dt = sql.select(" * ", " a_album ", " userId = " + id);
                    dplstAlbums.DataSource = dt;
                    dplstAlbums.DataBind();
                    if (Request.QueryString["albumId"] != null)
                    {
                        dplstAlbums.SelectedValue = Request.QueryString["albumId"].ToString();
                    }

                    /*绑定数据使显示所有相册*/
                    dt = sql.select(" id,AlbumName ", " a_album ", " userId = " + id);
                    RepeaterOperate rptHelper = new RepeaterOperate();
                    rptHelper.dataBound(ref rptAllAlbum, ref dt, 1, ref lblTotal, 5);
                    lblNow.Text = "1";
                }
            }
            else
            {
                Response.Write("<script> alert('请先登录!');location=  'MainPage.aspx'</script> ");
            }
        }
    }
Beispiel #7
0
    protected void btnFirst_Click(object sender, EventArgs e)
    {
        int toPage = 1;

        lblNow.Text = Convert.ToString(toPage);
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowUserId"].ToString();
        DataTable       dt        = sql.select(" * ", " a_diary ", " userId= " + id + " and classid=" + classID);

        rptHelper.dataBound(ref rptAllDiaries, ref dt, toPage, ref lblTotal, 5);
    }
Beispiel #8
0
    protected void btnFirstPhoto_Click(object sender, EventArgs e)
    {
        int toPage = 1;

        lblNowPhoto.Text = Convert.ToString(toPage);
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowAlbumId"].ToString();
        DataTable       dt        = sql.select(" * ", " a_photo ", " albumId= " + id);

        rptHelper.dataBound(ref rptPhotos, ref dt, toPage, ref lblTotalPhoto, 30);
    }
    protected void btnLastApp_Click(object sender, EventArgs e)
    {
        // string text = txtSearch.Text;
        lblNowApp.Text = lblTotalApp.Text;
        int             toPage    = Convert.ToInt32(lblTotalApp.Text);
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowUserId"].ToString();
        DataTable       dt        = sql.select(" friendApplication.id,users.nickname,users.number,friendApplication.note ", " friendApplication,users ", " friendApplication.toId = " + id + " and users.id = friendApplication.fromId");

        rptHelper.dataBound(ref rptApplications, ref dt, toPage, ref lblTotalApp, 5);
    }
    protected void btnFirstResult_Click(object sender, EventArgs e) //搜索结果的结果显示--首页按钮
    {
        string text = txtSearch.Text;

        lblNowResult.Text = "1";
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowUserId"].ToString();
        DataTable       dt        = sql.select(" nickname,loginstatus,id,number ", " users ", " number= '" + text + "' or nickname='" + text + "'"); //nickname or number to find

        rptHelper.dataBound(ref rptSearchResult, ref dt, 1, ref lblTotalResult, 5);
    }
    protected void btnFirst_Click(object sender, EventArgs e) //所有好友的结果显示--首页按钮
    {
        int toPage = 1;

        lblNow.Text = Convert.ToString(toPage);
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowUserId"].ToString();
        DataTable       dt        = sql.select(" friends.friendId,users.nickname,users.loginstatus ", " friends,users ", " friends.userId= " + id + " and friends.friendId = users.id ");

        rptHelper.dataBound(ref rptFriends, ref dt, toPage, ref lblTotal, 5);
    }
Beispiel #12
0
    protected void btnLast_Click(object sender, EventArgs e)
    {
        string nowPage = lblTotal.Text;
        int    toPage  = Convert.ToInt32(nowPage) + 1;

        lblNow.Text = Convert.ToString(toPage);
        RepeaterOperate rptHelper = new RepeaterOperate();
        SQLOperation    sql       = new SQLOperation();
        string          id        = Session["NowUserId"].ToString();
        DataTable       dt        = sql.select(" * ", " a_album ", " userId= " + id);

        rptHelper.dataBound(ref rptAllAlbum, ref dt, toPage, ref lblTotal, 5);
    }
    protected void btnJumpResult_Click(object sender, EventArgs e) //搜索结果的结果显示--跳转按钮
    {
        string text   = txtSearch.Text;
        int    toPage = Convert.ToInt32(txtJumpResult.Text);

        if (toPage <= Convert.ToInt32(lblTotalResult.Text) && toPage >= 1)
        {
            lblNowResult.Text = Convert.ToString(toPage);
            RepeaterOperate rptHelper = new RepeaterOperate();
            SQLOperation    sql       = new SQLOperation();
            string          id        = Session["NowUserId"].ToString();
            DataTable       dt        = sql.select(" nickname,loginstatus,id,number ", " users ", " number= '" + text + "' or nickname='" + text + "'"); //nickname or number to find

            rptHelper.dataBound(ref rptSearchResult, ref dt, toPage, ref lblTotalResult, 5);
        }
    }
    protected void btnAllApplication_Click(object sender, EventArgs e) //所有加好友申请显示按钮
    {
        if (divApplications.Visible)
        {
            btnAllApplication.Text  = "新朋友";
            divApplications.Visible = false;
        }
        else
        {
            divApplications.Visible = true;
            btnAllApplication.Text  = "收起";

            RepeaterOperate rptHelper = new RepeaterOperate();
            DataTable       dt        = new DataTable();
            SQLOperation    sql       = new SQLOperation();
            string          id        = Session["NowUserId"].ToString();
            dt = sql.select(" friendApplication.id,users.nickname,users.number,friendApplication.note ", " friendApplication,users ", " friendApplication.toId = " + id + " and users.id = friendApplication.fromId");
            rptHelper.dataBound(ref rptApplications, ref dt, 1, ref lblNowApp, 5);
            lblNowApp.Text = "1";
        }
    }
Beispiel #15
0
    protected void rptClasses_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "hyptClass") //查看该分类下的所有日志列表
        {
            classID = e.CommandArgument.ToString();
            SQLOperation    sql       = new SQLOperation();
            string          id        = Session["NowUserId"].ToString();
            DataTable       dt        = sql.select(" a_diary.title,a_diary.id ,a_diary.time ", " a_diary,classes ", " a_diary.classId = classes.id and classes.userId = " + id + " and classes.id =" + classID);
            RepeaterOperate rptHelper = new RepeaterOperate();
            rptHelper.dataBound(ref rptAllDiaries, ref dt, 1, ref lblTotal, 5);
        }
        if (e.CommandName == "btnDelClass") //删除分类
        {
            classID = e.CommandArgument.ToString();
            SQLOperation sql = new SQLOperation();

            if (sql.delete(" classes ", " id= " + classID) && sql.delete(" a_diary ", " classId= " + classID))
            {
                helper.alertHelper(this, "删除分类成功", "DiaryPage.aspx");
            }
        }
    }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id;
            classID = "0";
            SQLOperation    sql       = new SQLOperation();
            RepeaterOperate rptHelper = new RepeaterOperate();
            DataTable       dt        = new DataTable();
            divNewClass.Visible = false;
            if (Session["NowUserId"] != null)
            {
                if (Request.QueryString["id"] != null) //正在被他人访问
                {
                    divUsers.Visible = false;
                    /*-------------控件显示控制-------------*/
                    id = Request.QueryString["id"].ToString();
                    dt = sql.select(" a_diary.title,a_diary.id,a_diary.time ", " a_diary,classes ", " a_diary.classId = classes.id and classes.userId = " + id);
                    rptHelper.dataBound(ref rptAllDiaries, ref dt, 1, ref lblTotal, 5);
                    dt = sql.select(" * ", " classes ", " userid =" + id + " and classkind = '日志'");

                    rptHelper.dataBound(ref rptClasses, ref dt, 1, ref lblTotal, 5);
                }
                else
                {
                    id = Session["NowUserId"].ToString();
                    dt = sql.select(" a_diary.title,a_diary.id,a_diary.time  ", " a_diary,classes ", " a_diary.classId = classes.id and classes.userId = " + id);
                    rptHelper.dataBound(ref rptAllDiaries, ref dt, 1, ref lblTotal, 5);
                    dt = sql.select(" * ", " classes ", " userid =" + id + " and classkind = '日志'");
                    rptHelper.dataBound(ref rptClasses, ref dt, 1, ref lblTotal, 5);
                }
            }
            else
            {
                Response.Write("<script> alert('请先登录!');location=  'MainPage.aspx'</script> ");
            }
        }
    }
 protected void btnUp_Click(object sender, EventArgs e)
 {
     RepeaterOperate rptHelp = new RepeaterOperate();
 }