protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AgencyBLL aBLL = new AgencyBLL(); Agency agency = aBLL.GetAgency(); if (agency != null) { this.LitAgencyName.Text = agency.AgencyName; this.LitAddressLine1.Text = agency.AddressLine1; this.LitProvinceState.Text = string.Format("{0}, {1}, {2}", agency.City, agency.StateProvince, agency.PostalCode); this.LitPhone1.Text = (!string.IsNullOrEmpty(agency.Phone1))? String.Format("{0:(###) ###-####}", Double.Parse(agency.Phone1)):string.Empty; this.LitFax.Text = (!string.IsNullOrEmpty(agency.Fax))? String.Format("{0:(###) ###-####}", Double.Parse(agency.Fax)):string.Empty; this.rdContact1.Checked = true; this.lblResultMail.Text = String.Empty; } AgentBLL objAgent = new AgentBLL(); Agent agent = objAgent.GetAgentInfo(); if (agent != null) { this.LitAgentName.Text = String.Format("{0} {1}", agent.FirstName, agent.LastName); this.LitPhoneCel.Text = String.Format("{0:(###) ###-####}", Double.Parse(agent.CellPhone)); } } this.txtMailName.Focus(); }
/// <summary> /// Called when page is loaded. /// </summary> protected void OnViewLoaded() { TextBox ctrlName = (TextBox)formViewResourceReport.FindControl("txtPersonCompletingReport"); ctrlName.Text = prof.FirstName + " " + prof.LastName; TextBox ctrlPhone = (TextBox)formViewResourceReport.FindControl("txtTelephone"); ctrlPhone.Text = prof.PrimaryPhone; TextBox ctrlStateCode = (TextBox)formViewResourceReport.FindControl("txtStateCode"); AgencyBLL StatesInfo = new AgencyBLL(); IEnumerable StateValues = StatesInfo.GetStates(); foreach (System.Collections.Generic.KeyValuePair <string, string> StateValueFound in StateValues) { if (StateValueFound.Value == Session["RR_SELECTED_STATE"].ToString()) { ctrlStateCode.Text = StateValueFound.Key; break; } } ctrlStateCode.Text = LookupBLL.GetStateFipsCodeByShortName(ctrlStateCode.Text); ctrlStateCode.Enabled = false; ctrlPhone.Enabled = false; }
private void BindZipCodeofCounselorLocation(bool IsSubStateRegionAdmin) { ddlZipCodeOfActivityEvent.Items.Clear(); IEnumerable <KeyValuePair <string, string> > ZipCodeForActivityEvent = null; AgencyBLL zipcode = new AgencyBLL(); if (IsSubStateRegionAdmin) { //find the counties by agency ZipCodeForActivityEvent = zipcode.GetZipByAgencyIdForReport(Convert.ToInt32(ddlAgency.SelectedValue), FormType.PublicMediaActivity); } else { //find the counties by state ZipCodeForActivityEvent = zipcode.GetZipCodeForCounselorLocationByState(ddlStates.SelectedValue, FormType.PublicMediaActivity); } if (ZipCodeForActivityEvent != null) { ddlZipCodeOfActivityEvent.DataSource = ZipCodeForActivityEvent; ddlZipCodeOfActivityEvent.DataTextField = "value"; ddlZipCodeOfActivityEvent.DataValueField = "key"; ddlZipCodeOfActivityEvent.DataBind(); } if (ZipCodeForActivityEvent == null || ZipCodeForActivityEvent.Count() == 0) { ddlZipCodeOfActivityEvent.Width = Unit.Pixel(370); ddlZipCodeOfActivityEvent.Items.Add(new ListItem("No zipcode of activity event available", "0")); } else if (ddlZipCodeOfActivityEvent.Items.Count > 0) { ddlZipCodeOfActivityEvent.Width = Unit.Pixel(370); ddlZipCodeOfActivityEvent.Items.Insert(0, new ListItem("<-- Select zipcode of activity event -->", "0")); } }
/// <summary> /// <summary> /// Called when page is initialized for the first time. /// </summary> protected void OnViewInitialized() { //Determine what kind of data is being requested from calling web page. FORM_REQUEST SpecialFieldDataType = FORM_REQUEST.NONE; if (int.Parse(RequestedSpecialData) == (int)FORM_REQUEST.PAM) { SpecialFieldDataType = FORM_REQUEST.PAM; } if (int.Parse(RequestedSpecialData) == (int)FORM_REQUEST.CLIENTCONTACT) { SpecialFieldDataType = FORM_REQUEST.CLIENTCONTACT; } //Load the States data in the drop down list. AgencyBLL StatesInfo = new AgencyBLL(); IEnumerable SuppotedStates = StatesInfo.GetStates(); foreach (System.Collections.Generic.KeyValuePair <string, string> StateValueFound in SuppotedStates) { ddlStates.Items.Add(new ListItem(StateValueFound.Value, State.GetCode(StateValueFound.Key))); } if (AccountInfo.IsStateAdmin) { ddlStates.SelectedIndex = -1; KeyValuePair <string, string> StateValue = State.GetState(AccountInfo.StateFIPS); ListItem FoundState = ddlStates.Items.FindByText(StateValue.Value); ddlStates.Items[0].Selected = false; FoundState.Selected = true; ddlStates.Enabled = false; ddlStates.Visible = false; string UserState = State.GetStateName(AccountInfo.StateFIPS); lblState.Text = UserState; cStates.Visible = false; return; } if (AccountInfo.IsAdmin && AccountInfo.ScopeId == (short)Scope.CMS) { ddlStates.Items.Add(new ListItem("CMS", "99")); ddlStates.SelectedIndex = -1; ddlStates.Items.Insert(0, "--Select A State--"); ddlStates.Items[0].Selected = true; ddlStates.Visible = true; cStates.Visible = true; return; } }
private void BindCountyofCounselorLocation(bool IsSubStateRegionAdmin) { ddlCountyOfActivityEvent.Items.Clear(); AgencyBLL counties = new AgencyBLL(); IEnumerable <KeyValuePair <string, string> > CountiesForActivityEvent = null; if (IsSubStateRegionAdmin) { //find the counties by agency CountiesForActivityEvent = counties.GetCountyByAgencyIdForReport(Convert.ToInt32(ddlAgency.SelectedValue), FormType.PublicMediaActivity); } else { //find the counties by state CountiesForActivityEvent = counties.GetCountyForCounselorLocationByState(ddlStates.SelectedValue, FormType.PublicMediaActivity); } if (CountiesForActivityEvent.Count() > 0) { ddlCountyOfActivityEvent.DataSource = CountiesForActivityEvent; ddlCountyOfActivityEvent.DataTextField = "value"; ddlCountyOfActivityEvent.DataValueField = "key"; ddlCountyOfActivityEvent.DataBind(); } if (CountiesForActivityEvent == null || CountiesForActivityEvent.Count() == 0) { btnSubmit.Enabled = false; ddlCountyOfActivityEvent.Width = Unit.Pixel(470); ddlCountyOfActivityEvent.Items.Add(new ListItem("No county of activity event available", "0")); } else if (ddlCountyOfActivityEvent.Items.Count > 0) { btnSubmit.Enabled = true; ddlCountyOfActivityEvent.Width = Unit.Pixel(470); ddlCountyOfActivityEvent.Items.Insert(0, new ListItem("<-- Select county of activity event -->", "0")); } }
/// <summary> /// Called when page is initialized for the first time. /// </summary> protected void OnViewInitialized() { btnNew.Visible = false; AgencyBLL StatesInfo = new AgencyBLL(); IEnumerable <KeyValuePair <string, string> > StatesData = StatesInfo.GetStates(); //if user is Cms Regional user populate only his states if (AccountInfo.Scope == Scope.CMSRegional) { IEnumerable <KeyValuePair <string, string> > StatesForUser = null; List <string> StateFIPSForCMSRegions = new List <string>(); IEnumerable <UserRegionalAccessProfile> profiles = UserCMSBLL.GetUserCMSRegionalProfiles(AccountInfo.UserId, false); foreach (UserRegionalAccessProfile profile in profiles) { IEnumerable <string> CMSStateFIPS = LookupBLL.GetStatesForCMSRegion(profile.RegionId); if (CMSStateFIPS != null) { StateFIPSForCMSRegions.AddRange(CMSStateFIPS); } } if (StateFIPSForCMSRegions.Count > 0) { StatesForUser = ( from stFIPS in StatesData from cmsStFIPS in StateFIPSForCMSRegions where stFIPS.Key == State.GetState(cmsStFIPS).Key select stFIPS ); } //ddlStates.DataSource = StatesForUser; foreach (System.Collections.Generic.KeyValuePair <string, string> StateValueFound in StatesForUser) { ddlStates.Items.Add(new ListItem(StateValueFound.Value, StateValueFound.Key)); } } else { // ddlStates.DataSource = StatesData; foreach (System.Collections.Generic.KeyValuePair <string, string> StateValueFound in StatesData) { ddlStates.Items.Add(new ListItem(StateValueFound.Value, StateValueFound.Key)); } } ddlStates.Items.Insert(0, "--Select A State--"); ddlStates.Items[0].Selected = true; InitializeDropDownList(); IsAdmin = AccountInfo.IsAdmin; Scope = (Scope)AccountInfo.ScopeId; if (AccountInfo.Scope == Scope.State) { //LookupBLL.GetStateFipsCodeByShortName( //April 15, TODO - Have states loaded from db so statename and id can be bound to dropdownlist - This may help if text changes. KeyValuePair <string, string> StateValue = State.GetState(AccountInfo.StateFIPS); lblDefaultState.Text = " <strong>:</strong> " + StateValue.Value; lblDefaultState.Visible = true; ListItem FoundState = ddlStates.Items.FindByText(StateValue.Value); ddlStates.Items[0].Selected = false; FoundState.Selected = true; ddlStates.Enabled = false; ddlStates.Visible = false; StateContentCell.Align = "Left"; if (AccountInfo.IsAdmin) { btnNew.Visible = true; } return; } if (AccountInfo.IsAdmin) { ddlStates.Visible = true; btnNew.Visible = true; return; } }