Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string postalCode = Request.Params["tbZipCode"];

        if (!String.IsNullOrEmpty(postalCode))
        {
            Session["postalCode"] = postalCode;
            ZipCodeInformation.RegisteredUser zcUser = new ZipCodeInformation.RegisteredUser();
            zcUser.UserID   = userID;
            zcUser.Password = password;
            ZipCodeInformation.LicenseInfo zcLicenseIfo = new ZipCodeInformation.LicenseInfo();
            zcLicenseIfo.RegisteredUser = zcUser;

            ZipCodeInformation.SDPZipCodes zipCodeService = new ZipCodeInformation.SDPZipCodes();
            zipCodeService.LicenseInfoValue = new ZipCodeInformation.LicenseInfo();
            zipCodeService.LicenseInfoValue = zcLicenseIfo;
            ZipCodeInformation.ZipCodeOutput zipCodeInfo = zipCodeService.GetZipCode(postalCode);

            // Use the zipcode to retrieve city, state, and county.
            // These will be used with the other services.

            Session["city"]   = zipCodeInfo.ServiceResult.ZipCodes[0].PreferredCityName;
            Session["state"]  = zipCodeInfo.ServiceResult.ZipCodes[0].State;
            Session["county"] = zipCodeInfo.ServiceResult.ZipCodes[0].County;

            pnlStateInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderStateInfo));
            pnlCityInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderCountyAndCityInfo));
            pnlCensusInformation.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderCensusInfo));
            pnlSenatorInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderSenatorInfo));
            pnlHeader.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderHeader));
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region getClaimsFromInformationCard
        string xmlToken;
        xmlToken = Request.Params["xmlToken"];

        if (xmlToken == null || xmlToken == "")
        {
            //In case you didn't set up the certificates and want to try it w/o cardspace

            Session["givenName"]  = "Marc";
            Session["postalCode"] = "98052";
            //Default Page
        }
        else
        {
            TokenHelper tokenHelper = new TokenHelper(xmlToken);

            foreach (Claim claim in tokenHelper.IdentityClaims)
            {
                Console.WriteLine("------------------------------------\n");
                Console.WriteLine("Claim Type:" + claim.ClaimType + "\n");
                Console.WriteLine("Right:" + claim.Right + "\n");
                Console.WriteLine("Resource:" + claim.Resource.ToString() + "\n");
            }

            RetrieveTokenClaims(tokenHelper.IdentityClaims);
        }

        string postalCode = (string)Session["postalCode"];
        if (!String.IsNullOrEmpty(postalCode))
        {
            ZipCodeInformation.RegisteredUser zcUser = new ZipCodeInformation.RegisteredUser();
            zcUser.UserID   = userID;
            zcUser.Password = password;
            ZipCodeInformation.LicenseInfo zcLicenseIfo = new ZipCodeInformation.LicenseInfo();
            zcLicenseIfo.RegisteredUser = zcUser;

            ZipCodeInformation.SDPZipCodes zipCodeService = new ZipCodeInformation.SDPZipCodes();
            zipCodeService.LicenseInfoValue = new ZipCodeInformation.LicenseInfo();
            zipCodeService.LicenseInfoValue = zcLicenseIfo;
            ZipCodeInformation.ZipCodeOutput zipCodeInfo = zipCodeService.GetZipCode(postalCode);
            Session["city"]   = zipCodeInfo.ServiceResult.ZipCodes[0].PreferredCityName;
            Session["state"]  = zipCodeInfo.ServiceResult.ZipCodes[0].State;
            Session["county"] = zipCodeInfo.ServiceResult.ZipCodes[0].County;

            pnlStateInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderStateInfo));
            pnlCityInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderCityInfo));
            pnlCensusInformation.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderCensusInfo));
            pnlSenatorInfo.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderSenatorInfo));
            pnlHeader.SetRenderMethodDelegate(new System.Web.UI.RenderMethod(RenderHeader));
        }
    }