Ejemplo n.º 1
0
    protected void bttnShout_Click(object sender, EventArgs e)
    {
        if ((DateTime.Now - (DateTime)ViewState["last_send"]).TotalSeconds < 5)
            return;
        if (Session["user"] == null)
            return;

        if (this.txtShoutboxInput.Text.Trim().Equals(string.Empty))
        {
            return;
        }

        try
        {
            ViewState["last_send"] = DateTime.Now;
            ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign];
            
            Player player = session.Get<Player>(Session["user"]);
            ShoutboxData data = new ShoutboxData();
            data.Text = this.txtShoutboxInput.Text;
            data.Time = DateTime.Now;
            data.Group = this.Group;
            data.Player = player;
            session.Save(data);
            string strData = "<div><img src='images/chat_icon.gif'> [" + data.Time.ToString("hh:mm") + "] ";
            strData += "<span class='username'><a href='user_info.aspx?player=" + data.Player.ID.ToString() + "' title='" + data.Player.Username + "'>" + data.Player.Username + "</a></span>: ";
            strData += data.Text;
            strData += "</div>";
            this.lblShoutboxData.Text += strData;
            this.txtShoutboxInput.Text = "";
            
        }
        catch (Exception ex)
        {
            this.error.Text = ex.Message;
        }
        finally
        {
            
        }
    }
Ejemplo n.º 2
0
 public void DeleteShoutboxItem(ShoutboxData item, NHibernate.ISession session)
 {
     throw new System.NotImplementedException();
 }