Exemplo n.º 1
0
        protected void dropDownListFormType_SelectedIndexChanged(object sender, EventArgs e)
        {
            //change the ccf/pam type for the type dropdown
            int      _formType = Convert.ToInt32(((DropDownList)sender).SelectedValue);
            FormType formType  = (FormType)_formType;

            ReportSubStateReportType = Logic.GetSubStateReportType(formType);

            DynamicSubStateRegions = null;

            States = AgencyLogic.GetStates();

            BindFormView();
        }
Exemplo n.º 2
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;
                }
            }
        }
Exemplo n.º 3
0
        private void StateBindCall()
        {
            DropDownList ctrlFormtype = (DropDownList)formViewSubStateRegionForReport.FindControl("dropDownListFormType");

            if (DefaultState.Code == null)
            {
                ReportFromeType = null;
            }
            else
            {
                ReportFromeType = Logic.GetFromeType();
            }

            ctrlFormtype.Focus();

            //bind group type with null
            ReportSubStateReportType = null;

            DynamicSubStateRegions = null;

            States = AgencyLogic.GetStates();

            BindFormView();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Binds the dependent data for the form.
        /// </summary>
        protected void BindDependentData()
        {
            #region drop down population logic.
            //switch (Scope)
            //{
            //    case Scope.CMS:
            //        {
            //            Counselors = Logic.GetClientContactCounselors();
            //            Submitters = Logic.GetClientContactSubmitters();

            //            break;
            //        }
            //    case Scope.State:
            //        {

            //            Counselors = Logic.GetClientContactCounselors(DefaultState);
            //            Submitters = Logic.GetClientContactSubmitters(DefaultState);

            //            break;
            //        }
            //    default :
            //        {
            //            //Determine if the current user is a super data editor.
            //            if (AgencyLogic.IsSuperDataEditor(UserId))
            //            {
            //                Counselors = Logic.GetCounselorsForSuperDataEditor(UserId);
            //                Submitters = Logic.GetSubmittersForSuperDataEditor(UserId);
            //            }
            //            else
            //            {
            //                //Set the Descriptors needed to determine form population and options.
            //                var isCounselor = IsDescriptor(Descriptor.Counselor);
            //                var isSubmitter = IsDescriptor(Descriptor.DataSubmitter);
            //                var isReviewer = IsDescriptor(Descriptor.DataEditor_Reviewer);

            //                if (isCounselor && isSubmitter)
            //                {
            //                    IsCounselorOnly = false;
            //                    IsSubmitterOnly = false;

            //                    //Get the Counselors for where the current user is a DataSubmitter.
            //                    Counselors = Logic.GetCounselors(Scope, (from id in GetAgencies(Descriptor.DataSubmitter) select id).ToList());

            //                    //Check if the current user is in the counselors list; otherwise add them manually.
            //                    if (
            //                        (from counselor in Counselors where counselor.Key == UserId select counselor.Key).Count() == 0)
            //                    {
            //                        var profile = UserBLL.GetUserProfile(UserId);
            //                        Counselors = new List<KeyValuePair<int, string>>
            //                                         {
            //                                             (new KeyValuePair<int, string>(UserId,
            //                                                 string.Format("{0} {1}", profile.FirstName, profile.LastName)))
            //                                         };
            //                    }

            //                    //Get the Submitters for where the current user is a Counselor.
            //                    Submitters = Logic.GetSubmitters(Scope, (from id in GetAgencies(Descriptor.Counselor) select id).ToList());

            //                    //Check if the current user is in the submitter list; otherwise add them manually.
            //                    if ((from submitter in Submitters where submitter.Key == UserId select submitter.Key).Count() == 0)
            //                    {
            //                        var profile = UserBLL.GetUserProfile(UserId);
            //                        Submitters = new List<KeyValuePair<int, string>>
            //                                         {
            //                                             (new KeyValuePair<int, string>(UserId,
            //                                                 string.Format("{0} {1}", profile.FirstName, profile.LastName)))
            //                                         };
            //                    }
            //                }
            //                else if (isCounselor)
            //                {
            //                    //check if the current user is a reviewer too.
            //                    if (isReviewer)
            //                    {
            //                        //Get submitters from agencies in which the current user is a counselor.
            //                        //No Counselors are to be retrieved.
            //                        Counselors = null;
            //                        //Get the submitters for whom the current user is a counselor.
            //                        Submitters = Logic.GetSubmitters(Scope, (from id in GetAgencies(Descriptor.Counselor) select id).ToList());
            //                    }
            //                    else
            //                    {
            //                        IsCounselorOnly = true;
            //                        //Get the Counselors for where the current user is a DataSubmitter.
            //                        Counselors = Logic.GetCounselors(Scope, (from id in GetAgencies(Descriptor.DataSubmitter) select id).ToList());

            //                        //Check if the current user is in the counselors list; otherwise add them manually.
            //                        if (
            //                            (from counselor in Counselors where counselor.Key == UserId select counselor.Key).Count() == 0)
            //                        {
            //                            var profile = UserBLL.GetUserProfile(UserId);
            //                            Counselors = new List<KeyValuePair<int, string>>
            //                                             {
            //                                                 (new KeyValuePair<int, string>(UserId,
            //                                                     string.Format("{0} {1}", profile.FirstName, profile.LastName)))
            //                                             };
            //                        }

            //                        //Get the Submitters for the current user's agencies.
            //                        Submitters = Logic.GetSubmitters(Scope, (from id in ActiveAgencyDescriptors.Keys select id).ToList());
            //                    }
            //                }
            //                else if (isSubmitter)
            //                {
            //                    //check if the current user is a reviewer too.
            //                    if (isReviewer)
            //                    {
            //                        //Get the counselors for whom the curent user is a submitter
            //                        Counselors = Logic.GetCounselors(Scope, (from id in GetAgencies(Descriptor.DataSubmitter) select id).ToList());
            //                        //Get the submitters for whom the current user is a supervisor.
            //                        Submitters = Logic.GetReviewerSubmitters(Scope, (from id in GetAgencies(Descriptor.DataEditor_Reviewer) select id).ToList(), UserId);
            //                    }
            //                    else
            //                    {
            //                        IsSubmitterOnly = true;
            //                        //Get the Counselors for the current user's agencies.
            //                        Counselors = Logic.GetCounselors(Scope, (from id in ActiveAgencyDescriptors.Keys select id).ToList());
            //                        //Get the Submitters for where the current user is a Counselor.
            //                        Submitters = Logic.GetSubmitters(Scope, (from id in GetAgencies(Descriptor.Counselor) select id).ToList());

            //                        //Check if the current user is in the submitter list; otherwise add them manually.
            //                        if (
            //                            (from submitter in Submitters where submitter.Key == UserId select submitter.Key).Count() == 0)
            //                        {
            //                            var profile = UserBLL.GetUserProfile(UserId);
            //                            Submitters = new List<KeyValuePair<int, string>>
            //                                             {
            //                                                 (new KeyValuePair<int, string>(UserId, string.Format("{0} {1}", profile.FirstName, profile.LastName)))
            //                                             };
            //                        }
            //                    }
            //                }
            //                else if (isReviewer) //not a counselor or submitter.
            //                {
            //                    IsReviewerOnly = true;
            //                    //No Counselors are to be retrieved.
            //                    Counselors = null;
            //                    //Get the submitters for whom the current user is a supervisor.
            //                    Submitters = Logic.GetReviewerSubmitters(Scope, (from id in GetAgencies(Descriptor.DataEditor_Reviewer) select id).ToList(), UserId);
            //                }
            //            }

            //            break;
            //        }
            //}

            #endregion

            //PopulateCounselorDropDown();
            //PopulateSubmitterDropDown();


            //if user is Cms Regional user populate only his states
            if (AccountInfo.Scope == Scope.CMSRegional)
            {
                IEnumerable <KeyValuePair <string, string> > StatesData = AgencyLogic.GetStates();

                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
                        );
                }
                States = StatesForUser;
            }
            else
            {
                States = AgencyLogic.GetStates();
            }


            aAddCCF.DataBind();


            //check the correct authorization
            if (AccountInfo.IsStateAdmin ||
                (AccountInfo.IsCMSScope && AccountInfo.IsAdmin) ||
                AccountInfo.IsShipDirector)
            {
                aAddSpecialField.Visible = true;
                aAddSpecialField.DataBind();
            }

            //9/11/2013- commented the below line-  Bimal noticed that the NPR code is searching for all a user’s recent records the moment that the CC tab is clicked.
            //Since many users may not actually need a prior client search (i.e. they may click the “Add a new client never seen here before “link), Bimal will move the search from a default to a specific request if the user makes any of the three search selections (by agency counselor submitter).
            //It appears that the database has reached a size that even with indexing the default background search is consuming too many system resources and risks not only the spinning and slow load but also a timeout and error page as well.


            panelSearchCriteria.DataBind();
            if (Scope.IsLowerOrEqualTo(Scope.State))
            {
                BindStateDependentData(new State(dropDownListState.SelectedValue));
            }
        }
        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();
        }