예제 #1
0
        private void LoadGroups()
        {
            long memberId = Convert.ToInt64(Request.QueryString["memberId"]);

            // Retrieve all the Groups for this member and load them into the Dropdownlist
            EZDiscuss.Classes.Group grp = new Classes.Group();
            DataSet dsGroups            = grp.RetrieveAllGroups(memberId);
        }
예제 #2
0
        private void LoadGroups(int selectedGroup)
        {
            try
            {
                EZDiscuss.Classes.Group grp = new Classes.Group();
                string paddedMemberId       = Request.QueryString["memberId"].ToString();
                long   memberId             = EZDiscuss.Classes.Helper.UnPadMemberId(paddedMemberId);
                if (memberId > 0)
                {
                    Session["memberId"] = memberId;
                    DataSet ds = grp.RetrieveAllGroups(memberId);
                    if (ds.Tables.Count > 0)
                    {
                        DataTable dtGroups = null;
                        // Bind the Groups that the User Created
                        switch (selectedGroup)
                        {
                        case 1:
                            dtGroups             = ds.Tables[0];
                            ddlGroups.DataSource = dtGroups;
                            break;

                        case 2:
                            dtGroups             = ds.Tables[1];
                            ddlGroups.DataSource = dtGroups;
                            break;

                        case 3:
                            // Merge the 2 datatables
                            dtGroups = ds.Tables[0];
                            DataTable dtJoined = ds.Tables[1];
                            dtGroups.Merge(dtJoined);
                            ddlGroups.DataSource = dtGroups;
                            break;
                        }

                        ddlGroups.DataTextField  = "GroupName";
                        ddlGroups.DataValueField = "GroupId";
                        ddlGroups.DataBind();

                        ListItem selectItem = new ListItem("Select Group...", "0");
                        ddlGroups.Items.Insert(0, selectItem);
                    }
                    else
                    {
                        ddlGroups.DataSource = null;
                        ddlGroups.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                if (Session["memberId"] != null)
                {
                    EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadGroups", ex.Message, (long)Session["memberId"]);
                }
                else
                {
                    EZDiscuss.Classes.Helper.LogError("DiscussionBoard.aspx", "LoadGroups", ex.Message, 0);
                }
            }
        }