Exemple #1
0
 protected void btnZoneSave_Click(object sender, EventArgs e)
 {
     try
     {
         SQLOperation sql    = new SQLOperation();
         string       userID = Session["NowUserId"].ToString();
         if (txtZoneTitle == null)
         {
             helper.alertHelper(this, "空间标题不可以为空!");
         }
         else
         {
             string limit = dplstLimit.SelectedValue.ToString();
             sql.update(" zoneInfo ", " title='" + txtZoneTitle.Text + "',WhoCanSee='" + limit + "' ", " userid= " + userID);
             btnZoneChange.Text   = "空间设置修改";
             txtZoneTitle.Visible = false;
             dplstLimit.Visible   = false;
             btnZoneSave.Visible  = false;
             helper.alertHelper(this, "空间修改成功!", "PersonalInfoPage.aspx");
         }
     }
     catch (Exception exception)
     {
         helper.alertHelper(this, "空间修改失败!");
     }
 }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SQLOperation sql = new SQLOperation();

        if (Session["NowUserId"] != null)
        {
            string id;
            /*权限设置的选项初始化*/
            dplstLimit.Items.Add("所有人可见");
            dplstLimit.Items.Add("仅双方可见");
            if (Request.QueryString["id"] != null) //正在被访问
            {
                id = Request.QueryString["id"].ToString();
            }
            else
            {
                divAddMessage.Visible = false;//自己不可以给自己留言
                id = Session["NowUserId"].ToString();
            }
            DataTable dt = sql.select(" a_message.*,users.nickname ", " a_message,users ", " a_message.userid= " + id + " and users.id=a_message.messagerId");
            /*然后是repeater的数据绑定*/
        }
        else
        {
            helper.alertHelper(this, "请先登录", "MainPage.aspx");
        }
    }
    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> ");
            }
        }
    }
Exemple #4
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");
        }
    }
Exemple #5
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");
            }
        }
    }
    protected void rptInReply_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "btnCommentDel") //删除评论按钮
        {
            try
            {
                SQLOperation sql       = new SQLOperation();
                string       commentID = e.CommandArgument.ToString();
                DataTable    dtReply   = sql.select(" id ", " a_comment ", " commentedID= " + commentID + " and kind='comment'");
                for (int j = 0; j < dtReply.Rows.Count; j++) //删除评论下面的回复
                {
                    sql.delete(" a_comment ", " id=" + dtReply.Rows[j][0].ToString());
                }
                sql.delete(" a_comment ", " id=" + commentID);
                helper.alertHelper(this, "删除评论成功!", "DiaryWritingPage.aspx?op=" + Request.QueryString["op"].ToString());
            }
            catch (Exception exception)
            {
                helper.alertHelper(this, "删除评论失败!");
            }
        }
        if (e.CommandName == "btnReply")
        {
            Button btn = (Button)e.Item.FindControl("btnReply");
            if (e.Item.FindControl("btnAddReply").Visible) //正在回复时点击
            {
                btn.Text = "回复";
                e.Item.FindControl("btnAddReply").Visible = false;
                e.Item.FindControl("txtReply").Visible    = false;
            }
            else
            {
                e.Item.FindControl("btnAddReply").Visible = true;
                e.Item.FindControl("txtReply").Visible    = true;
                btn.Text = "取消回复";
            }
        }
        else if (e.CommandName == "btnAddReply")
        {
            TextBox txt = (TextBox)e.Item.FindControl("txtReply");
            string  id;
            string  content = txt.Text;
            if (txt == null)
            {
                txt.ForeColor = System.Drawing.Color.Red;
                txt.Text      = "回复不可以为空!";
            }
            else
            {
                id = Session["NowUserId"].ToString();
                SQLOperation sql = new SQLOperation();
                // if(sql.add(" a_comment ","  "))
                string commentedId = e.CommandArgument.ToString();
                string time        = DateTime.Now.ToString();
                string kind        = "comment";

                if (sql.add(" a_comment ", commentedId + "," + id + ",'" + content + "','" + time + "','" + kind + "'," + commentedId))
                {
                    e.Item.FindControl("txtReply").Visible    = false;
                    e.Item.FindControl("btnReply").Visible    = false;
                    e.Item.FindControl("btnAddReply").Visible = false;
                    Response.Write("<script> alert('回复成功!');location=  'PersonalCenterPage.aspx'</script> ");
                }
                else
                {
                    txt.Text = "回复失败";
                }
            }
        }
    } //评论的按钮判断