示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     clsDBCalls objDb = new clsDBCalls();
     string sessionId = Session.SessionID.ToString();
     string toId = Request["toId"];
     objDb.resetAlert(sessionId, toId);
     Response.Redirect("\\ChatSite\\Chat.aspx?toId=" + toId);
 }
示例#2
0
 protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     string SelectedId = ListBox1.SelectedItem.ToString();
     string sessionId = Session.SessionID.ToString();
     //string UserId = null;
     clsDBCalls dbObj = new clsDBCalls();
     //UserId = dbObj.getUserName(sessionId);
     dbObj.setAlert(sessionId, SelectedId);
     Response.Write("<script>open('\\Chat.aspx?toId=" + SelectedId + "','List','scrollbars=no,resizable=no,width=600,height=400');</script>");
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsDBCalls dbObj = new clsDBCalls();

        if (dbObj.CheckSession(Session.SessionID.ToString()) == 1)
        {
            Response.Redirect("\\chatsite\\Home.aspx");
        }

        txtEmailID.Focus();
    }
示例#4
0
 protected void Timer1_Tick(object sender, EventArgs e)
 {
     //Check for alerts
     clsDBCalls objDBcall = new clsDBCalls();
     string sessionId = Session.SessionID.ToString();
     DataTable dtCheckAlert = new DataTable();
     dtCheckAlert = objDBcall.checkAlert(sessionId);
     foreach(DataRow dr in dtCheckAlert.Rows)
     {
         string InviterId = dr["UserId1"].ToString();
         lnkMessageButton.Text = "You have a new message from " + InviterId;
         lnkMessageButton.OnClientClick = "document.getElementById('lnkMessageButton').innerText=''; open('\\ResetAlert.aspx?toId=" + InviterId + "','List','scrollbars=no,resizable=no,width=600,height=400')";
     }
 }
示例#5
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     string Message = txtMessage.Text;
     txtMessage.Text = "";
     txtMessage.Focus();
     string sessionId = Session.SessionID.ToString();
     clsDBCalls objData = new clsDBCalls();
     string toId = Request["toId"];
     int retVal = objData.InsertMessage(sessionId, toId, Message);
     if (retVal == 1)
     {
         lblMessage.Text = "An error occurred while sending your message ";
     }
 }
示例#6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string md5Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5");
        clsDBCalls objLogin = new clsDBCalls();
        string userName = (txtEmailID.Text.Trim());
        string sessionId = Session.SessionID.ToString();
        int retval = objLogin.CheckLogin(userName, md5Password, sessionId);
        if (retval == 1)
        {
            Response.Redirect("\\chatsite\\Home.aspx");
        }

        else
        {
            lblMessage.Text = "Invalid mail id or password";
        }
    }
示例#7
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string sessionId = Session.SessionID.ToString();
        string FriendId = txtFreindID.Text;
        clsDBCalls dbObj = new clsDBCalls();
        int status = Convert.ToInt32(dbObj.AddFriend(sessionId, FriendId));

        if (status == 0)
        {
            lblMessage.Text = "You friend is not registered with us";
        }
        else
        {
            lblMessage.Text = "Friend Added";

        }
    }
示例#8
0
 protected void btnRegister_Click(object sender, EventArgs e)
 {
     string md5Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5");
     string userName = txtEmailId.Text.Trim();
     clsDBCalls dbObj = new clsDBCalls();
     int retVal = dbObj.RegisterUser(userName, md5Password);
     if (retVal == 1)
     {
         lblIdAvailable.Text = "User Id already taken";
     }
     else if(retVal == 2)
     {
         lblIdAvailable.Text = "DB Error";
     }
     else if (retVal == 0)
     {
         lblIdAvailable.Text = "User Registered. Please login";
     }
 }
示例#9
0
 protected void Timer1_Tick(object sender, EventArgs e)
 {
     string sessionId = Session.SessionID.ToString();
     clsDBCalls objData = new clsDBCalls();
     string toId = Request["toId"];
     DataTable dtChat = new DataTable();
     dtChat = objData.getMessages(sessionId, toId);
     if (dtChat.Rows.Count > 0)
     {
         string Chats = null;
         foreach (DataRow row in dtChat.Rows)
         {
             string msender = row["Userid1"].ToString();
             string mmessage = row["messages"].ToString();
             string times = (DateTime.Parse(row["timest"].ToString())).ToShortTimeString();
             Chats = Chats + msender + ": \t" + mmessage + "\t" + times + "\n";
         }
         txtChat.Text = Chats;
     }
 }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            string sessionId = Session.SessionID.ToString();
            clsDBCalls fetchFriends = new clsDBCalls();
            DataTable dtFriendList = new DataTable();
            dtFriendList = fetchFriends.fetchFriends(sessionId);
            if (dtFriendList.Rows.Count > 0)
            {
                ListBox1.DataSource = dtFriendList;
                ListBox1.DataTextField = "UserName";
                ListBox1.DataValueField = "UserId";
                ListBox1.DataBind();
            }
            else
            {
                lnkAddFriend.Text = "You do not have any friends, add some frnds and start chatting";
            }

        }
    }