protected void institutions_SelectedIndexChanged(object sender, EventArgs e) { try { if (institutions.SelectedValue == "PleaseSelect") { InstitutionDetails.Visible = false; } else { InstitutionDetails.Visible = true; AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail insutitutionDetail = svc.GetInstitutionDetails(institutions.SelectedIndex); InstitutionId.Text = insutitutionDetail.institutionId.ToString(); InsitutionName.Text = insutitutionDetail.institutionName; Website.Text = insutitutionDetail.homeUrl; PhoneNumer.Text = insutitutionDetail.phoneNumber; Address.Text = AggCatService.AggCatInstitutions.GetFormattedInstitutionAddress(insutitutionDetail); Email.Text = insutitutionDetail.emailAddress; } } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling GetInsitutions: " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ try { if (Request.QueryString["InstitutionID"] == null) { Response.Redirect("SelectInstitution.aspx"); } AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail institutionDetail = svc.GetInstitutionDetails(long.Parse(Request.QueryString["InstitutionID"])); Control[][] institutionLoginControls = new Control[institutionDetail.keys.Length][]; foreach (InstitutionDetailKey institutionKey in institutionDetail.keys) { TextBox value = new TextBox(); if (institutionKey.mask) { value.TextMode = TextBoxMode.Password; } value.Attributes.Add("KeyName", institutionKey.name); value.Width = 200; Label name = new Label { Text = institutionKey.name + ": ", AssociatedControlID = value.ID }; Literal lineBreak = new Literal { Text = "<br/><br/>" }; institutionLoginControls[institutionKey.displayOrder - 1] = new Control[] { name, value, lineBreak }; } for (int i = 0; i < institutionLoginControls.Length; i++) { LoginControls.Controls.Add(institutionLoginControls[i][0]); LoginControls.Controls.Add(institutionLoginControls[i][1]); LoginControls.Controls.Add(institutionLoginControls[i][2]); } } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling GetInsitutionDetails: " + ex.Message; } //} }
public static string GetFormattedInstitutionAddress(InstitutionDetail institutionDetail) { try { string formattedAddress = "<br />"; if (institutionDetail.address.address1.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address1 + "<br />"; } if (institutionDetail.address.address2.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address2 + "<br />"; } if (institutionDetail.address.address3.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address3 + "<br />"; } if (institutionDetail.address.city.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.city + ", "; } if (institutionDetail.address.state.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.state + " "; } formattedAddress += institutionDetail.address.postalCode; if (institutionDetail.address.country.IsNotNullOrEmpty()) { if (formattedAddress != "<br />") { formattedAddress += "<br />"; } formattedAddress += institutionDetail.address.country; } return(formattedAddress); } catch (Exception) { return("<br />Unable to format address"); } }
protected void Login_Click(object sender, EventArgs e) { try { if (Request.QueryString["InstitutionID"] == null) { Response.Redirect("SelectInstitution.aspx"); } AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail insutitutionDetail = svc.GetInstitutionDetails(long.Parse(Request.QueryString["InstitutionID"])); InstitutionLogin instLogin = new InstitutionLogin(); Credentials creds = new Credentials(); List <Credential> credentials = new List <Credential>(); foreach (Control control in LoginControls.Controls) { if (control as TextBox != null) { Credential cred = new Credential(); TextBox loginValue = (TextBox)control; cred.name = loginValue.Attributes["KeyName"]; cred.value = loginValue.Text; credentials.Add(cred); } } creds.credential = credentials.ToArray(); instLogin.AnyIntuitObject = creds; Challenges challenges = null; ChallengeSession challengeSession = null; AccountList accountList = svc.DiscoverAndAddAccounts(long.Parse(Request.QueryString["InstitutionID"].ToString()), instLogin, out challenges, out challengeSession); Response.Redirect("MyAccounts.aspx?Success"); } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling logging into the instituion: " + ex.Message; } }
public static string GetFormattedInstitutionAddress(InstitutionDetail institutionDetail) { try { string formattedAddress = "<br />"; if (institutionDetail.address.address1.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address1 + "<br />"; } if (institutionDetail.address.address2.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address2 + "<br />"; } if (institutionDetail.address.address3.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.address3 + "<br />"; } if (institutionDetail.address.city.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.city + ", "; } if (institutionDetail.address.state.IsNotNullOrEmpty()) { formattedAddress += institutionDetail.address.state + " "; } formattedAddress += institutionDetail.address.postalCode; if (institutionDetail.address.country.IsNotNullOrEmpty()) { if (formattedAddress != "<br />") { formattedAddress += "<br />"; } formattedAddress += institutionDetail.address.country; } return formattedAddress; } catch (Exception) { return "<br />Unable to format address"; } }