private ContributionFundCollection GetSelectedFundCollection() { ContributionFundCollection contributionFundCollection = new ContributionFundCollection(); for (int i = 1; i <= 3; i++) { DropDownList curDrop = (DropDownList)FindControlRecursive(Page, "ddlSelectedFund" + i.ToString()); TextBox curAmount = (TextBox)FindControlRecursive(Page, "tbSelectedFund" + i.ToString() + "Amount"); if ((curDrop.SelectedValue.Length > 0) && (curAmount.Text.Length > 0)) { contributionFundCollection.Add(new ContributionFund { FundId = Convert.ToInt16(curDrop.SelectedValue), Amount = Convert.ToDecimal(curAmount.Text) }); } } return contributionFundCollection; }
protected void Page_Load(object Object, EventArgs e) { Page.Header.Controls.Add( new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("css/style.css") + "\" />")); if (!IsPostBack) { PopulateStaticControls(); this.imgCheckImage.ImageUrl = this.CheckImageURLSetting; this.tbComment.Attributes["placeholder"] = this.CommentCaptionSetting; if (Convert.ToBoolean(this.ShowPortalLoginSetting)) { this.hfTracker.Value = "0"; } else { this.hfTracker.Value = "1"; } this.btnChooseLogin.Value = this.ChooseLoginTextSetting; this.btnGiveNow.Value = this.GiveNowTextSetting; this.hfLoginLocation.Value = Page.ResolveUrl("default.aspx?page="+this.LoginPageSetting.ToString()).ToString(); this.forgotLogin.NavigateUrl = this.ForgotLoginSetting; this.forgotPassword.NavigateUrl = this.ForgotPasswordSetting; } else { switch(hfTracker.Value) { case "1": //assuming all data is correct int iPersonId = GetPersonIdFromInputData(); if (iPersonId != 0) { Person person = new Person(iPersonId); this._person = new Person(iPersonId); this.SelectedFunds = GetSelectedFundCollection(); /*this.SelectedFundsSerialized = this.SerializeToString(this.SelectedFunds,typeof(ContributionFundCollection)); this.hfSerializedFunds.Value = this.SelectedFundsSerialized;*/ this.LoadGateways(); if (this.SubmitPreAuthorization()) { this.buildConfirmationScreen(person); this.hfConfirmationID.Value = this.ConfirmationNumber.ToString(); this.hfPersonID.Value = this._person.PersonID.ToString(); this.hfTracker.Value = "2"; } else { return; } } else { return; } break; case "2": /*DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ContributionFundCollection)); using(MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(hfSerializedFunds.Value.Trim()))) { this.SelectedFunds = (ContributionFundCollection)serializer.ReadObject(ms); }*/ this._person = new Person(Convert.ToInt32(this.hfPersonID.Value)); this.LoadGateways(); if (this.SubmitTransaction()) { this.buildThankYou(); this.hfTracker.Value = "3"; } else { return; } break; } } }