/// <summary>
        /// Binds the dependent data for the form.
        /// </summary>
        protected void BindDependentDataCHANGE()
        {
            DynamicSubStateRegions = null;

            DropDownList ctrlForm  = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListFormType");
            int          _formType = Convert.ToInt32(ctrlForm.SelectedValue);


            DropDownList ctrlGroup  = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListGroupype");
            int          _groupType = Convert.ToInt32(ctrlGroup.SelectedValue);

            if (_groupType > 0 && _formType > 0)
            {
                FormType           formType     = (FormType)_formType;
                SubStateReportType subStateType = (SubStateReportType)_groupType;


                GetSelectionArea(formType, subStateType);
            }

            ListBox ctrlCounties = (ListBox)formViewSubStateRegionForReport.FindControl("listBoxCounties");
            ListBox ctrlSvc      = (ListBox)formViewSubStateRegionForReport.FindControl("listBoxServiceAreas");

            ctrlCounties.DataSource = DynamicSubStateRegions;
            ctrlSvc.DataSource      = DynamicSubStateRegions;
            ctrlCounties.DataBind();
            ctrlSvc.DataBind();
        }
        private void GetSelectionArea(FormType formType, SubStateReportType subStateType)
        {
            if ((subStateType == SubStateReportType.Agency || subStateType == SubStateReportType.AgencyPam) &&
                (formType == FormType.ClientContact || formType == FormType.PublicMediaActivity))
            {
                Agencies = AgencyLogic.GetAgencies(DefaultState.Code);
                var _agencies = new List <KeyValuePair <string, string> >();
                _agencies.AddRange(Agencies.Select((pair => (new KeyValuePair <string, string>(pair.Key.ToString(), pair.Value)))));
                DynamicSubStateRegions = _agencies;
            }

            else if ((subStateType == SubStateReportType.CountycodeOfClientRes || subStateType == SubStateReportType.CountyOfCounselorLocation || subStateType == SubStateReportType.CountycodeOfEvent) &&
                     (formType == FormType.ClientContact || formType == FormType.PublicMediaActivity))
            {
                DynamicSubStateRegions = AgencyLogic.GetCounties(DefaultState.Code);
            }


            else if ((subStateType == SubStateReportType.ZIPCodeOfClientRes || subStateType == SubStateReportType.ZIPCodeOfCounselorLocation) &&
                     (formType == FormType.ClientContact))
            {
                IEnumerable <ZipCountyView> zipCode = LookupBLL.GetZipCodesAndCountyFIPSForState(DefaultState.Code);
                var _zips = new List <KeyValuePair <string, string> >();
                _zips.AddRange(zipCode.Select((pair => (new KeyValuePair <string, string>(pair.Zipcode.ToString(), pair.Zipcode)))));
                DynamicSubStateRegions = _zips;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Binds the dependent data for the form.
        /// </summary>
        protected void BindDependentData()
        {
            DynamicSubStateRegions = null;
            States = AgencyLogic.GetStates();

            DropDownList ctrlForm  = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListFormType");
            int          _formType = Convert.ToInt32(ctrlForm.SelectedValue);


            DropDownList ctrlGroup  = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListGroupype");
            int          _groupType = Convert.ToInt32(ctrlGroup.SelectedValue);

            if (_groupType > 0 && _formType > 0)
            {
                FormType           formType     = (FormType)_formType;
                SubStateReportType subStateType = (SubStateReportType)_groupType;


                if ((subStateType == SubStateReportType.Agency || subStateType == SubStateReportType.AgencyPam) &&
                    (formType == FormType.ClientContact || formType == FormType.PublicMediaActivity))
                {
                    Agencies = AgencyLogic.GetAgencies(DefaultState.Code);
                    var _agencies = new List <KeyValuePair <string, string> >();
                    _agencies.AddRange(Agencies.Select((pair => (new KeyValuePair <string, string>(pair.Key.ToString(), pair.Value)))));
                    DynamicSubStateRegions = _agencies;
                }

                else if ((subStateType == SubStateReportType.CountycodeOfClientRes || subStateType == SubStateReportType.CountyOfCounselorLocation || subStateType == SubStateReportType.CountycodeOfEvent) &&
                         (formType == FormType.ClientContact || formType == FormType.PublicMediaActivity))
                {
                    DynamicSubStateRegions = AgencyLogic.GetCounties(DefaultState.Code);
                }


                else if ((subStateType == SubStateReportType.ZIPCodeOfClientRes || subStateType == SubStateReportType.ZIPCodeOfCounselorLocation) &&
                         (formType == FormType.ClientContact))
                {
                    IEnumerable <ZipCountyView> zipCode = LookupBLL.GetZipCodesAndCountyFIPSForState(DefaultState.Code);
                    var _zips = new List <KeyValuePair <string, string> >();
                    _zips.AddRange(zipCode.Select((pair => (new KeyValuePair <string, string>(pair.Zipcode.ToString(), pair.Zipcode)))));
                    DynamicSubStateRegions = _zips;
                }
            }
        }
        protected void BindFormData()
        {
            States = AgencyLogic.GetStates();

            DefaultState = ViewData.State;
            DropDownList ctrlState = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListState");
            var          state     = ctrlState.Items.FindByValue(DefaultState.StateAbbr);

            if (state != null)
            {
                state.Selected = true;
            }


            ReportFromeType = Logic.GetFromeType();

            DropDownList ctrlForm = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListFormType");

            ctrlForm.DataSource = ReportFromeType;
            ctrlForm.DataBind();
            ctrlForm.Items.Insert(0, "-- Select Form Type --");

            var reportType = ctrlForm.Items.FindByValue(((int)ViewData.ReprotFormType).ToString());

            if (reportType != null)
            {
                reportType.Selected = true;
            }


            FormType _formType = (FormType)ViewData.ReprotFormType;

            ReportSubStateReportType = Logic.GetSubStateReportType(_formType);


            DropDownList ctrlGroup = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListGroupype");

            ctrlGroup.DataSource = ReportSubStateReportType;
            ctrlGroup.DataBind();
            ctrlGroup.Items.Insert(0, "-- Select Report Group Type --");

            var groupType = ctrlGroup.Items.FindByValue(((int)ViewData.Type).ToString());

            if (groupType != null)
            {
                groupType.Selected = true;
            }



            SubStateReportType _type = (SubStateReportType)ViewData.Type;

            GetSelectionArea(_formType, _type);


            ListBox ctrlCounties = (ListBox)formViewSubStateRegionForReport.FindControl("listBoxCounties");
            ListBox ctrlSvc      = (ListBox)formViewSubStateRegionForReport.FindControl("listBoxServiceAreas");

            ctrlCounties.DataSource = DynamicSubStateRegions;
            ctrlSvc.DataSource      = DynamicSubStateRegions;
            ctrlCounties.DataBind();
            ctrlSvc.DataBind();
        }