private void LoadTopicsForSelectedGroup(long groupId) { try { EZDiscuss.Classes.Topic topic = new Classes.Topic(); DataTable dt = topic.TopicsRetrieveByGroupId(groupId); if (dt.Rows.Count > 0) { rTopics.DataSource = dt; rTopics.DataBind(); lTopics.Text = "List of Topics for selected Group:"; ActivateControls(true); } else { rTopics.DataSource = null; rTopics.DataBind(); lTopics.Text = "There is no Topic for this Group yet."; ActivateCreateTopicControls(true); } } catch (Exception ex) { if (Session["memberId"] != null) { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadTopicsForSelectedGroup", ex.Message, (long)Session["memberId"]); } else { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadTopicsForSelectedGroup", ex.Message, 0); } } }
private void CheckTopics(long groupId) { try { if (groupId > 0) { EZDiscuss.Classes.Topic topics = new Classes.Topic(); DataTable dt = new DataTable(); dt = topics.TopicsRetrieveByGroupId(groupId); if (dt.Rows.Count > 0) { rTopics.DataSource = dt; rTopics.DataBind(); } } } catch (Exception ex) { if (Session["memberId"] != null) { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "CheckTopics", ex.Message, (long)Session["memberId"]); } else { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "CheckTopics", ex.Message, 0); } } }
//private void LoadNamesInPrivateMessageDropDownList() //{ // if (Session["Participants"] != null) // { // DataTable dt = (DataTable)Session["Participants"]; // ddlPM.DataSource = dt; // ddlPM.DataTextField = "Name"; // ddlPM.DataValueField = "MemberId"; // ddlPM.DataBind(); // if (Session["member"] != null) // { // EZDiscuss.Classes.Member member = (EZDiscuss.Classes.Member) Session["member"]; // long memberId = Convert.ToInt64(member.memberId); // DataRow dr = dt.AsEnumerable().Where(m =>m.Field<Int64>(0) == memberId).FirstOrDefault(); // if (dr != null) // { // ListItem item = new ListItem(dr["name"].ToString()); // ddlPM.Items.Remove(item); // } // } // } //} private void LoadMessagesForTopic(long topicId) { try { // Display all the messages for this topic in each of the participating members Classes.Topic topic = new Classes.Topic(); DataTable dt = topic.TopicsRetrieveMessagesByTopicId(topicId); int mCount = dt.Rows.Count; if (mCount > 0) { rMessages.DataSource = dt; rMessages.DataBind(); // Play a sound if there is a new Message sent/received if (mCount > MessageCount) { System.Media.SystemSounds.Asterisk.Play(); //System.Threading.Thread.Sleep(5000); //System.Media.SystemSounds.Beep.Play(); //System.Threading.Thread.Sleep(5000); //System.Media.SystemSounds.Exclamation.Play(); //System.Threading.Thread.Sleep(5000); //System.Media.SystemSounds.Hand.Play(); //System.Threading.Thread.Sleep(5000); //System.Media.SystemSounds.Question.Play(); MessageCount = mCount; } // Display the Topic Name string topicName = ViewState["TopicName"].ToString(); lTopicTitle.Text = topicName; } else { // No Message found so clear the grid and display the topicname if (ViewState["TopicName"] != null) { string topicName = ViewState["TopicName"].ToString(); lTopicTitle.Text = topicName; } rMessages.DataSource = null; rMessages.DataBind(); }; } catch (Exception ex) { if (Session["memberId"] != null) { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadMessagesForTopic", ex.Message, (long)Session["memberId"]); } else { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadMessagesForTopic", ex.Message, 0); } } }
private void CreateTopic() { try { string topicTitle = tTopic.Text.Trim(); if (topicTitle == string.Empty) { lM.Text = "Topic Title is required."; return; } long groupId = Convert.ToInt64(ddlGroups.SelectedValue); if (groupId == 0) { lM.Text = "Select a Group for the Topic."; return; } string topicDesc = tD.Text.Trim(); string paddedMemberId = Request.QueryString["memberId"].ToString(); long memberId = EZDiscuss.Classes.Helper.UnPadMemberId(paddedMemberId); if (memberId > 0) { long topicId = 0; EZDiscuss.Classes.Topic t = new Classes.Topic(); t.groupId = groupId; t.memberId = memberId; t.topicTitle = topicTitle; t.topicDescription = topicDesc; topicId = t.TopicCreate(); if (topicId > 0) { lM.ForeColor = System.Drawing.Color.Blue; lM.Text = "Topic created successfully."; // Clear the Textboxes tTopic.Text = tD.Text = ""; // Rebind the Topics for the selected Group CheckTopics(groupId); // Activate Controls ActivateControls(true); } else { lM.ForeColor = System.Drawing.Color.Red; lM.Text = "Topic was not created successfully."; } } else { lM.Text = "Invalid Member."; } } catch (Exception ex) { if (Session["memberId"] != null) { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "CreateTopic", ex.Message, (long)Session["memberId"]); } else { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "CreateTopic", ex.Message, 0); } } }
private void LoadParticipants(long topicId) { try { // Display all the Participants for the specified Topic Classes.Topic topic = new Classes.Topic(); DataTable dt = topic.TopicMembersRetrieve(topicId); if (dt.Rows.Count > 0) { Session["Participants"] = dt; int i = 1; EZDiscuss.UserControls.ucMemberProfile ucMP = new UserControls.ucMemberProfile(); ResetParticipants(); foreach (DataRow dr in dt.Rows) { if (i <= 20) { Classes.Member member = new Classes.Member(); member.firstName = dr["FirstName"].ToString(); member.memberId = Convert.ToInt64(dr["MemberId"]); member.gender = Convert.ToInt32(dr["Gender"]); member.photo = dr["Photo"].ToString(); switch (i) { case 1: ucMP = ucMP1; break; case 2: ucMP = ucMP2; break; case 3: ucMP = ucMP3; break; case 4: ucMP = ucMP4; break; case 5: ucMP = ucMP5; break; case 6: ucMP = ucMP6; break; case 7: ucMP = ucMP7; break; case 8: ucMP = ucMP8; break; case 9: ucMP = ucMP9; break; case 10: ucMP = ucMP10; break; case 11: ucMP = ucMP11; break; case 12: ucMP = ucMP12; break; case 13: ucMP = ucMP13; break; case 14: ucMP = ucMP14; break; case 15: ucMP = ucMP15; break; case 16: ucMP = ucMP16; break; case 17: ucMP = ucMP17; break; case 18: ucMP = ucMP18; break; case 19: ucMP = ucMP19; break; case 20: ucMP = ucMP20; break; default: break; } ucMP.Photo = member.photo; ucMP.FirstName = member.firstName; ucMP.MemberId = member.memberId; ucMP.Gender = member.gender; ucMP.TopicId = topicId; ucMP.ActivateControl(true); i++; } } } else { // Reset Member Profile Controls ResetParticipants(); }; } catch (Exception ex) { if (Session["memberId"] != null) { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadParticipants", ex.Message, (long)Session["memberId"]); } else { EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadParticipants", ex.Message, 0); } } }