protected void Page_Load(object sender, EventArgs e) { //redirect to the main page if (clsSmallItemsHandler.SessionIdIsSet == false) { Response.Redirect("/"); } //end var session = HttpContext.Current.Session["user_id"]; clsPrivateChat privateChat = new clsPrivateChat(session); if (Request.Params["user_id"] != null) { var name = Request.Params["user_name"]; var user_id = Request.Params["user_id"]; var course_id = Request.Params["course_id"]; var time = Request.Params["time"].ToString().Replace("_", " "); var message = Request.Params["message"]; privateChat.InsertMessage(name, user_id, course_id, time, message); } course_list = privateChat.CURRENT_USER_All_COURSE_ID_AND_NAME(); user_id = HttpContext.Current.Session["user_id"]; user_name = HttpContext.Current.Session["user_name"]; }
protected void Page_Load(object sender, EventArgs e) { //redirect to the main page if (clsSmallItemsHandler.SessionIdIsSet == false) { Response.Redirect("/"); } //end var session = HttpContext.Current.Session["user_id"]; chat = new clsPrivateChat(session); }
protected void Page_Load(object sender, EventArgs e) { //redirect to the main page if (clsSmallItemsHandler.SessionIdIsSet == false) { Response.Redirect("/"); } //end var session = HttpContext.Current.Session["user_id"]; privateChat = new clsPrivateChat(session); var current_course_code = Request.QueryString["course_code"]; privateChat.param_course_code = current_course_code; //get the selected code if (current_course_code != null) { course_list = privateChat.CURRENT_STUDENT_LIST(current_course_code); user_id = HttpContext.Current.Session["user_id"]; user_name = HttpContext.Current.Session["user_name"]; } if (Request.Params["user_id"] != null) { var name = Request.Params["user_name"]; var user_id = Request.Params["user_id"]; var course_id = Request.Params["course_id"]; var time = Request.Params["time"].ToString().Replace("_", " "); var message = Request.Params["message"]; privateChat.InsertMessage(name, user_id, course_id, time, message); } }
protected void Page_Load(object sender, EventArgs e) { //redirect to the main page if (clsSmallItemsHandler.SessionIdIsSet == false) { Response.Redirect("/"); } //end var session = HttpContext.Current.Session["user_id"]; clsGroupChat groupChat = new clsGroupChat(session); ///group chat clsPrivateChat privateChat = new clsPrivateChat(session); //private var javaScriptSerializer = new JavaScriptSerializer(); var course_id = Request.Params["course_id"]; var messageLimit = Request.Params["limit"]; var current_chat_id = Request.Params["current_chat_id"]; var token = Request.Params["token"]; if (Request.Params["reset_group_notification"] != null) { groupChat.resetNotification(course_id); } else if (Request.Params["get_group_notification"] != null) { var notification = groupChat.current_user_Notification(course_id); //OBJECT -> JSON string myObjectJson = javaScriptSerializer.Serialize(notification); //return JSON Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(myObjectJson); Response.End(); } else if (token == "get_group_messages") { var messages = groupChat.FetchMesssges(course_id, messageLimit); //OBJECT -> JSON string myObjectJson = javaScriptSerializer.Serialize(messages); //return JSON Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(myObjectJson); Response.End(); } else if (Request.Params["reset_group_notification"] != null) { privateChat.resetNotification(course_id); } else if (Request.Params["get_private_notification"] != null) { var notification = privateChat.Current_user_Notification(course_id); //OBJECT -> JSON string myObjectJson = javaScriptSerializer.Serialize(notification); //return JSON Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(myObjectJson); Response.End(); } else if (token == "get_private_messages") { var messages = privateChat.FetchMesssges(course_id, messageLimit, current_chat_id); //OBJECT -> JSON string myObjectJson = javaScriptSerializer.Serialize(messages); //return JSON Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(myObjectJson); Response.End(); } }