using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class controls_Members : System.Web.UI.UserControl
{
    public string csEncryptionKey, csEncryptionVector, csURLEncryptionKey;

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadDBSettings();
        GridMembers.DataSource = MembersManagement.GetMembersList();
        if (!IsPostBack)
        {
            GridMembers.DataBind();
        }
    }

    public string ShowProfileLink(string psUsername, string psImageName, bool psImageInsert)
    {
        string lsProfileLink;

        if (psImageInsert == false)
        {
            lsProfileLink = "<a href=\"?page=" + Server.UrlEncode(digioz.Encryption64.Encrypt("Profile", csURLEncryptionKey))
                                             + "&username=" + Server.UrlEncode(digioz.Encryption64.Encrypt(psUsername, csURLEncryptionKey))
                                             + "\">" + psUsername + "</a>";
        }
        else
        {
            lsProfileLink = "<a href=\"?page=" + Server.UrlEncode(digioz.Encryption64.Encrypt("Profile", csURLEncryptionKey))
                                             + "&username=" + Server.UrlEncode(digioz.Encryption64.Encrypt(psUsername, csURLEncryptionKey))
                                             + "\"><img src=\"" + psImageName + "\" alt=\"\" /></a>";
        }

        return lsProfileLink;
    }

    private void LoadDBSettings()
    {
        csURLEncryptionKey = ConfigurationManager.AppSettings["URLEncryptKey"];
     }


    protected void GridMembers_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
    {
        this.GridMembers.PageIndex = e.NewPageIndex;
        this.GridMembers.DataBind();
    }

    protected void GridMembers_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
