protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ((HyperLink)CreditCardWebUserControl1.FindControl("HelpHyperLink")).NavigateUrl = "javascript: openHelp('../Help/CvvNumber.htm')"; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.CreditCardInfo creditCardInfo = registrationService.GetCreditCard(loginInfo.UserId); //((CustomValidator)CreditCardWebUserControl1.FindControl("CardNumberTextBoxCustomValidator")).Enabled = false; if (creditCardInfo != null) { ((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedValue = creditCardInfo.Type.LookupId.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("CardNumberTextBox")).Text = creditCardInfo.Number; ((DropDownList)CreditCardWebUserControl1.FindControl("CardMonthDropDownList")).SelectedValue = creditCardInfo.ExpirationMonth.ToString(); ((DropDownList)CreditCardWebUserControl1.FindControl("CardYearDropDownList")).SelectedValue = creditCardInfo.ExpirationYear.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("CVVNumberTextBox")).Text = creditCardInfo.CvvNumber; ((TextBox)CreditCardWebUserControl1.FindControl("CardHolderNameTextBox")).Text = creditCardInfo.HolderName; ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress1TextBox")).Text = creditCardInfo.Address.Address1; ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress2TextBox")).Text = creditCardInfo.Address.Address2; ((TextBox)CreditCardWebUserControl1.FindControl("BillingCityTextBox")).Text = creditCardInfo.Address.City; ((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedValue = creditCardInfo.Address.Country.CountryId.ToString(); ((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedValue = creditCardInfo.Address.State.StateId.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("BillingZipTextBox")).Text = creditCardInfo.Address.Zip; } } }
private void CaptureValuesIntoSession() { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; RegistrationService.CreditCardInfo creditCard = new RegistrationService.CreditCardInfo(); RegistrationService.StateInfo billingState = new RegistrationService.StateInfo(); billingState.StateId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("BillingStateDropDownList")).SelectedValue); billingState.Name = ((DropDownList)CreditCardDetails1.FindControl("BillingStateDropDownList")).SelectedItem.Text; RegistrationService.CountryInfo billingCountry = new RegistrationService.CountryInfo(); billingCountry.CountryId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("BillingCountryDropDownList")).SelectedValue); billingCountry.Name = ((DropDownList)CreditCardDetails1.FindControl("BillingCountryDropDownList")).SelectedItem.Text; RegistrationService.AddressInfo billingAddress = new RegistrationService.AddressInfo(); billingAddress.Address1 = ((TextBox)CreditCardDetails1.FindControl("BillingAddress1TextBox")).Text; billingAddress.Address2 = ((TextBox)CreditCardDetails1.FindControl("BillingAddress2TextBox")).Text; billingAddress.City = ((TextBox)CreditCardDetails1.FindControl("BillingCityTextBox")).Text; billingAddress.State = billingState; billingAddress.Zip = ((TextBox)CreditCardDetails1.FindControl("BillingZipTextBox")).Text; billingAddress.Country = billingCountry; RegistrationService.LookupInfo creditCardType = new RegistrationService.LookupInfo(); creditCardType.LookupId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardTypeDropDownList")).SelectedValue); creditCardType.Name = ((DropDownList)CreditCardDetails1.FindControl("CardTypeDropDownList")).SelectedItem.Text; creditCard.Type = creditCardType; creditCard.Number = ((TextBox)CreditCardDetails1.FindControl("CardNumberTextBox")).Text; creditCard.CvvNumber = ((TextBox)CreditCardDetails1.FindControl("CVVNumberTextBox")).Text; creditCard.HolderName = ((TextBox)CreditCardDetails1.FindControl("CardHolderNameTextBox")).Text; creditCard.ExpirationMonth = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardMonthDropDownList")).SelectedValue); creditCard.ExpirationYear = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardYearDropDownList")).SelectedValue); creditCard.Address = billingAddress; registration.CreditCard = creditCard; Session["registrationInfo"] = registration; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (IsPrinterRole) { DeleteFarmButton.Enabled = false; EditFarmButton.Enabled = false; FirmUpButton.Enabled = false; CreatePlotButton.Enabled = false; } int farmId = 0; if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null)) { int.TryParse(Request.QueryString["farmId"], out farmId); } if (farmId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } FarmIdHiddenField.Value = farmId.ToString(); try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int userId = farmService.GetUserIdForFarm(farmId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FarmNameLabel.Text = farm.FarmName; MailingPlanLabel.Text = farm.MailingPlan.Title; CreateDateLabel.Text = farm.CreateDate.ToShortDateString(); if (farm.Firmup) { FirmupStatusLabel.Text = "Firmed Up"; } else { FirmupStatusLabel.Text = "Not Firmed Up"; } FarmContactCountLabel.Text = farm.ContactCount.ToString(); PlotCountLabel.Text = farm.PlotCount.ToString(); FillPlotGrid(farm.Plots, 0); // ***************** Firm Up ***************** \\ if (IsAgentRole) { // Set the firm up button visible to agent. FirmUpButtonPanel.Visible = true; // Get the mailing plan of the farm. int mailingPlanId = farm.MailingPlan.MailingPlanId; // Get the design details of the agent. DesignService.DesignService designService = serviceLoader.GetDesign(); DesignService.DesignInfo design = new DesignService.DesignInfo(); DesignService.DesignInfo brochure = new DesignService.DesignInfo(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; IList <DesignService.DesignInfo> designs = designService.GetList(loginInfo.UserId); foreach (DesignService.DesignInfo designInfo in designs) { if (designInfo.Category.Name == "PowerKard") { design = designInfo; } else { brochure = designInfo; } } // Get the credit card details of the logged in agent. RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.CreditCardInfo creditCard = registrationService.GetCreditCard(loginInfo.UserId); bool isCreditCardValid = false; if (creditCard != null) { DateTime expirationDate = new DateTime(creditCard.ExpirationYear, creditCard.ExpirationMonth, 1); expirationDate = expirationDate.AddMonths(1); if (expirationDate > DateTime.Today) { isCreditCardValid = true; } } // Check whether the farm is ready for firm up. if (mailingPlanId == 0) { FirmUpStatusHiddenField.Value = "MP_REQ"; } else if (mailingPlanId == 100003) { // 8 x 8. if (design.Status.Name != "Approved") { FirmUpStatusHiddenField.Value = "DESIGN_REQ"; } } else { if (design.Status.Name != "Approved" || brochure.Status.Name != "Approved") { FirmUpStatusHiddenField.Value = "DESIGN_REQ"; } } if (!isCreditCardValid) { FirmUpStatusHiddenField.Value = "CC_INVALID"; } if (farm.Firmup) { FirmUpButton.Enabled = false; } } // ******************************************* \\ } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); ErrorLiteral.Text = "Unknown Error Please contact Administrator:"; } } }
protected void SaveButton_Click(object sender, EventArgs e) { try { bool isExpiryValid = false; bool isCardNumberValid = false; ((CustomValidator)CreditCardWebUserControl1.FindControl("CCExpiryCustomValidator")).Validate(); if (Page.IsValid) { isExpiryValid = true; } ((CustomValidator)CreditCardWebUserControl1.FindControl("CardNumberTextBoxCustomValidator")).Validate(); if (Page.IsValid) { isCardNumberValid = true; } if (isExpiryValid == true && isCardNumberValid == true) { ErrorLiteral.Text = ""; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.CreditCardInfo creditCardInfo = new RegistrationService.CreditCardInfo(); RegistrationService.StateInfo billingState = new RegistrationService.StateInfo(); billingState.StateId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedValue); billingState.Name = ((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedItem.Text; RegistrationService.CountryInfo billingCountry = new RegistrationService.CountryInfo(); billingCountry.CountryId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedValue); billingCountry.Name = ((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedItem.Text; RegistrationService.AddressInfo billingAddress = new RegistrationService.AddressInfo(); billingAddress.Address1 = ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress1TextBox")).Text; billingAddress.Address2 = ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress2TextBox")).Text; billingAddress.City = ((TextBox)CreditCardWebUserControl1.FindControl("BillingCityTextBox")).Text; billingAddress.State = billingState; billingAddress.Zip = ((TextBox)CreditCardWebUserControl1.FindControl("BillingZipTextBox")).Text; billingAddress.Country = billingCountry; RegistrationService.LookupInfo creditCardType = new RegistrationService.LookupInfo(); creditCardType.LookupId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedValue); creditCardType.Name = ((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedItem.Text; creditCardInfo.Type = creditCardType; creditCardInfo.Number = ((TextBox)CreditCardWebUserControl1.FindControl("CardNumberTextBox")).Text; creditCardInfo.CvvNumber = ((TextBox)CreditCardWebUserControl1.FindControl("CVVNumberTextBox")).Text; creditCardInfo.HolderName = ((TextBox)CreditCardWebUserControl1.FindControl("CardHolderNameTextBox")).Text; creditCardInfo.ExpirationMonth = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardMonthDropDownList")).SelectedValue); creditCardInfo.ExpirationYear = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardYearDropDownList")).SelectedValue); creditCardInfo.Address = billingAddress; registrationService.UpdateCreditCard(loginInfo.UserId, creditCardInfo); } else { ErrorLiteral.Text = " "; } } catch (Exception ex) { ErrorLiteral.Text = "Error in Update"; } if (ErrorLiteral.Text == "") { MessagesLabel.Text = "Credit Card Information Updated Successfully"; } }