Beispiel #1
0
        private void ProcessLogin()
        {
            long memberId = 0;

            try
            {
                string email = tE.Text.Trim();
                string pwd   = tP.Text.Trim();

                if (email == "" || pwd == "")
                {
                    lM.Text = "Invalid credentials.";
                    return;
                }

                EZDiscuss.Classes.Member member = new Classes.Member();
                member = member.MemberLogin(email, pwd);
                if (member != null)
                {
                    lM.Text           = "";
                    Session["member"] = member;
                    memberId          = Convert.ToInt64(member.memberId);
                    string paddedMemberId = EZDiscuss.Classes.Helper.PadMemberId(memberId);

                    EZDiscuss.Classes.Group grp = new Classes.Group();
                    DataSet   ds = grp.RetrieveAllGroups(memberId);
                    DataTable dtCreatedGroups = ds.Tables[0];
                    DataTable dtjoinedGroups  = ds.Tables[1];

                    // Check if the login user has already a Group or Joined a Group. If so, redirect to discussionboard right away
                    if (dtCreatedGroups.Rows.Count > 0 || dtjoinedGroups.Rows.Count > 0)
                    {
                        Response.Redirect("DiscussionBoard.aspx?memberId=" + paddedMemberId.ToString(), false);
                    }
                    else
                    {
                        // If none yet, redirect to the page to create a Group and invite friends
                        Response.Redirect("MemberHome.aspx?memberId=" + paddedMemberId.ToString(), false);
                    }
                }
                else
                {
                    lM.Text = "Invalid credentials.";
                }
            }
            catch (Exception ex)
            {
                EZDiscuss.Classes.Helper.LogError("ucLogin.ascx.cs", "ProcessLogin", ex.Message, memberId);
            }
        }
        private void LoadGroups()
        {
            long memberId = 0;

            try
            {
                string paddedMemberId = Request.QueryString["memberId"].ToString();
                memberId = EZDiscuss.Classes.Helper.UnPadMemberId(paddedMemberId);

                // 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);
                dGroup.DataSource     = dsGroups;
                dGroup.DataTextField  = "GroupName";
                dGroup.DataValueField = "GroupId";
                dGroup.DataBind();
            }
            catch (Exception ex)
            {
                EZDiscuss.Classes.Helper.LogError("ucSendEmailInvite.ascx.cs", "LoadGroups", ex.Message, memberId);
            }
        }