Example #1
0
    protected void btnSelect_Click(object sender, EventArgs e)
    {
        UsersOperator uo = new UsersOperator();
        uo.LoadUser(Convert.ToInt32(this.txtFriendId.Text));

        this.grvFriend.DataSource = uo.View;
        this.grvFriend.DataBind();
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!this.IsPostBack)
        {
            UsersOperator uo = new UsersOperator();
            uo.LoadFrendList();

            uo.View.RowFilter = string.Format("Id<>{0}",((UserItem)this.Session["User"]).Id.ToString());
            this.grvFriend.DataSource = uo.View;
            this.grvFriend.DataBind();
        }
    }
Example #3
0
    /// <summary>
    /// 组装显示在前台好友列表的HTML
    /// </summary>
    /// <param name="list">好友列表</param>
    /// <returns>HTML字符串</returns>
    private string MakeUnorderListString(FriendList list)
    {
        string htmlStr = "<table width=100% id='tblFriendList'>";

        foreach(FriendItem item in list)
        {
            UserItem friend=new UsersOperator().LoadUser(item.FriendId);
            string liStr = "<tr width=100% valign=top>";

            liStr += string.Format("<td><img src='{0}' id='{1}' onclick='friendFaceDbClick()' />", "faces/" + friend.FaceId.ToString() + ".bmp", friend.Id);
            liStr+=friend.NickName;
            liStr += "</td></tr>";
            htmlStr += liStr;
        }
        htmlStr += "</table>";

        return htmlStr;
    }
Example #4
0
    protected void btnRegister_Click(object sender, ImageClickEventArgs e)
    {
        UserItem item = new UserItem();
        item.LoginPwd = this.txtPwd.Text;
        item.NickName = this.txtNickName.Text;
        item.Sex=this.rdbMan.Checked ? "男" : "女";
        item.Name = this.txtName.Text;
        item.StarId = Convert.ToInt32(this.ddlConstellation.SelectedItem.Value);
        item.BloodTypeId = Convert.ToInt32(this.ddlBloodType.SelectedItem.Value);
        item.FaceId = Convert.ToInt32(this.hidFaceId.Value);

        UsersOperator uo = new UsersOperator();
        if (uo.InsertUser(item) == 1)
        {
            this.divLoginInfo.InnerText = "你的MyQQ ID为" + uo.LastUserId.ToString();
        }
        else
        {
            this.divLoginInfo.InnerText = "服务器错误";
        }
    }
Example #5
0
    /// <summary>
    /// 组装显示消息内容的HTML字符串 并更新未读消息为已读消息
    /// </summary>
    /// <param name="msgId">需要显示消息的ID</param>
    private void MakeMsgShow(int msgId)
    {
        MessageOperator mo = new MessageOperator();
        MessageItem item = mo.GetMessage(msgId);
        UsersOperator uo=new UsersOperator();
        UserItem fromUser = uo.LoadUser(item.FromUserId);
        UserItem toUser=uo.LoadUser(item.ToUserId);

        this.hidOtherId.Value = fromUser.Id.ToString();
        this.hidOtherName.Value = fromUser.NickName;

        string title = string.Format("时间:{2}— {0}对{1}说:",fromUser.NickName,
                                                    toUser.NickName,item.MessageTime.ToString());

        string msg ="<br/>"+ item.Message;
        this.txtChatPrivateList.InnerText += title;
        this.txtChatPrivateList.InnerHtml += msg;
        MessageList list = new MessageList();
        list.Add(item);
        mo.UpdateMsg2Readed(list);
    }