using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
public partial class Conference : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtAll.Text = Application["all"].ToString();
        if (!IsPostBack)
        {
            //txtAll.Text = Application["all"].ToString();
            try
            {
                Session["back"] = Request.UrlReferrer.AbsolutePath;
                if (con.State == ConnectionState.Closed) con.Open();
                SqlCommand cmd = new SqlCommand("select ename from emp", con);
                SqlDataReader dr;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ListBox1.Items.Add(dr.GetValue(0).ToString());
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                lbltext.Text = ex.Message;
            }
        }
    }
    SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings.Get("con"));
    protected void Button2_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Session.RemoveAll();
        Response.Redirect("home.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (con.State == ConnectionState.Closed) con.Open();
        SqlCommand cmd = new SqlCommand("select ename from emp where empno=" + Session["eid"], con);
        SqlDataReader dr;
        dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            txtAll.Text = dr.GetValue(0).ToString() + ":" + txtSend.Text + "\n" + Application["all"];
            Application["all"] = txtAll.Text;
            txtSend.Text = "";
        }
        dr.Close();
    }
}
