using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;

namespace RetrievePin
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {            
        }

        protected void btnRetrievePIN_Click(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(txtUserApiKey.Text))
                {
                    RegistrationAPI.API.SetNetworkSettings("127.0.0.1", 443);
                    string Pin = RegistrationAPI.API.RetrieveUserApiKeyPin(txtUserApiKey.Text.Trim());
                    if (String.IsNullOrEmpty(Pin))
                        textPin.Text = "Invalid User Api Key";
                    else
                        textPin.Text = Pin;
                }
            }
            catch (Exception ex)
            {
                textPin.Text = ex.Message;
            }
        }
    }
}