Esempio n. 1
0
        private void HandleSubStateDisplayLogic(string StateFIPS)
        {
            plhSubStateRegion.Visible = true;
            if (this.AccountInfo.Scope != Scope.SubStateRegion)
            {
                var SubStates = LookupBLL.GetSubStateRegionsForState(StateFIPS);
                if (SubStates != null)
                {
                    IEnumerable <KeyValuePair <int, string> > OrderedSubStates = SubStates.OrderBy(p => p.Value);
                    ddlSubStateRegion.DataSource = OrderedSubStates;
                }
                else
                {
                    ddlSubStateRegion.DataSource = SubStates;
                }

                ddlSubStateRegion.DataTextField  = "Value";
                ddlSubStateRegion.DataValueField = "Key";
                ddlSubStateRegion.DataBind();

                if (ddlSubStateRegion.Items.Count > 1)
                {
                    ddlSubStateRegion.Items.Insert(0, new ListItem("Select Sub State Region", "0"));
                }
                else
                {
                    ddlSubStateRegion.Items.Add(new ListItem("No Sub State Regions available", "0"));
                }
            }
            else
            {
                PopulateSubStateRegionsForUser();
            }
        }
        private void PopulateAgenciesForState(string StateFIPS)
        {
            var Agencies = LookupBLL.GetAgenciesForState(StateFIPS, true);

            if (Agencies != null)
            {
                IEnumerable <KeyValuePair <int, string> > OrderedAgencies = Agencies.OrderBy(p => p.Value);
                ddlAgency.DataSource = OrderedAgencies;
            }
            else
            {
                ddlAgency.DataSource = Agencies;
            }

            ddlAgency.DataTextField  = "Value";
            ddlAgency.DataValueField = "Key";
            ddlAgency.DataBind();

            if (ddlAgency.Items.Count > 0)
            {
                ddlAgency.Items.Insert(0, new ListItem("<-- Select agency -->", "0"));
                btnSubmit.Enabled = true;
            }
            else
            {
                ddlAgency.Items.Add(new ListItem("No agencies available", "0"));
                btnSubmit.Enabled = false;
            }
        }
Esempio n. 3
0
        private void HandleCMSRegionDisplayLogic()
        {
            plhCMSRegion.Visible = true;
            if (this.AccountInfo.Scope == Scope.CMSRegional)
            {
                PopulateCMSRegionsForUser();
            }
            else
            {
                var CMSRegions = LookupBLL.GetCMSRegions();
                if (CMSRegions != null)
                {
                    IEnumerable <KeyValuePair <int, string> > OrderedCMSRegions = CMSRegions.OrderBy(p => p.Value);
                    ddlCMSRegion.DataSource = OrderedCMSRegions;
                }
                else
                {
                    ddlCMSRegion.DataSource = CMSRegions;
                }

                ddlCMSRegion.DataTextField  = "Value";
                ddlCMSRegion.DataValueField = "Key";
                ddlCMSRegion.DataBind();
            }

            if (ddlCMSRegion.Items.Count > 1)
            {
                ddlCMSRegion.Items.Insert(0, new ListItem("Select CMS Region", "0"));
            }
            else
            {
                ddlCMSRegion.Items.Add(new ListItem("No CMS Regions available", "0"));
            }
        }
        /// <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;
        }
        /// <summary>
        /// Binds data to the grid.
        /// </summary>
        /// <returns></returns>
        private DataTable BindGridData()
        {
            DataTable FoundReports = null;
            string    StateFipCode = LookupBLL.GetStateFipsCodeByShortName(ddlStates.SelectedValue);

            if (cmbYear.SelectedIndex == 0)
            {
                FoundReports = Logic.GetResourceReportByStateFipCode(StateFipCode, -1);
            }
            else
            {
                FoundReports = Logic.GetResourceReportByStateFipCode(StateFipCode, int.Parse(cmbYear.SelectedItem.Text));
            }

            if (FoundReports.Rows.Count > 0)
            {
                lblRecordCount.Text    = "Most recent 100 RR Forms";
                lblRecordCount.Visible = true;
            }
            else
            {
                lblRecordCount.Text    = string.Empty;
                lblRecordCount.Visible = false;
            }
            dataSourceViewResourceReports.DataSource = FoundReports;
            dataSourceViewResourceReports.DataBind();
            grdReports.DataSource = FoundReports;
            grdReports.DataBind();
            return(FoundReports);
        }
        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;
            }
        }
Esempio n. 7
0
 private void HandleAgencyDisplayLogic(string StateFIPS)
 {
     plhAgencies.Visible      = true;
     ddlAgency.DataSource     = LookupBLL.GetAgenciesForState(StateFIPS);
     ddlAgency.DataTextField  = "Value";
     ddlAgency.DataValueField = "Key";
     ddlAgency.DataBind();
     ddlAgency.Items.Insert(0, new ListItem("Select an Agency", "0"));
 }
Esempio n. 8
0
 private void HandleSubStateDisplayLogic(string StateFIPS)
 {
     plhSubStateRegion.Visible        = true;
     ddlSubStateRegion.DataSource     = LookupBLL.GetSubStateRegionsForState(StateFIPS);
     ddlSubStateRegion.DataTextField  = "Value";
     ddlSubStateRegion.DataValueField = "Key";
     ddlSubStateRegion.DataBind();
     ddlSubStateRegion.Items.Insert(0, new ListItem("Select a Sub State Region", "0"));
 }
Esempio n. 9
0
        protected void dropDownListCounselorCounty_SelectedIndexChanged(object sender, EventArgs e)
        {
            var dropDownListCounselorZipCode = formViewEditClientContact.FindControl("dropDownListCounselorZipCode") as DropDownList;

            dropDownListCounselorZipCode.DataSource = LookupBLL.GetZipCodeForCountyFips(((DropDownList)sender).SelectedValue);
            dropDownListCounselorZipCode.DataBind();
            dropDownListCounselorZipCode.Items.Insert(0, new ListItem("-- Select a Zip Code --", ""));
            dropDownListCounselorZipCode.Focus();
        }
Esempio n. 10
0
 private void HandleCMSRegionDisplayLogic()
 {
     plhCMSRegion.Visible        = true;
     ddlCMSRegion.DataSource     = LookupBLL.GetCMSRegions();
     ddlCMSRegion.DataTextField  = "Value";
     ddlCMSRegion.DataValueField = "Key";
     ddlCMSRegion.DataBind();
     ddlCMSRegion.Items.Insert(0, new ListItem("Select a CMS Region", "0"));
 }
Esempio n. 11
0
        protected void PopulateSubStateList()
        {
            List <KeyValuePair <int, string> > SubStatesListObj = new List <KeyValuePair <int, string> >();

            //Get all Sub States where User is Admin.
            IEnumerable <UserRegionalAccessProfile> SubStatesWhereUserIsAdmin = null;
            IDictionary <int, string> AllSubStatesInState = LookupBLL.GetSubStateRegionsForState(UserData.StateFIPS);

            //If the Admin is a User of Sub State Scope, we need only those sub states
            if (IsCreatorSubStateScope)
            {
                SubStatesWhereUserIsAdmin = UserSubStateRegionBLL.GetUserSubStateRegionalProfiles(this.AccountInfo.UserId, true);

                KeyValuePair <int, string>?matchingSubState = null;
                foreach (UserRegionalAccessProfile SubStateAdminProfile in SubStatesWhereUserIsAdmin)
                {
                    matchingSubState = AllSubStatesInState.Where(p => p.Key == SubStateAdminProfile.RegionId).FirstOrDefault();
                    if (matchingSubState.HasValue)
                    {
                        SubStatesListObj.Add(matchingSubState.Value);
                        matchingSubState = null;
                    }
                }
            }
            //else, lets use all sub states in the User's state.
            //Since a sub state user can only be created by user of sub state or higher scope, current
            //user can add this new user to any sub state in the state.
            else
            {
                SubStatesListObj = AllSubStatesInState.ToList <KeyValuePair <int, string> >();
            }

            //Before we return the list of sub states we need to remove the substates that the User is already assigned to,
            //so that the user is not added to the same sub state again.
            if (SubStatesListObj != null && SubStatesListObj.Count > 0)
            {
                IEnumerable <UserRegionalAccessProfile> ExistingSubStates = null;
                ExistingSubStates = UserSubStateRegionBLL.GetUserSubStateRegionalProfiles(UserProfileUserId, false);

                if (ExistingSubStates != null && ExistingSubStates.Count() > 0)
                {
                    KeyValuePair <int, string>?existSubState = null;
                    foreach (UserRegionalAccessProfile ExistingSubState in ExistingSubStates)
                    {
                        existSubState = SubStatesListObj.Where(p => p.Key == ExistingSubState.RegionId).FirstOrDefault();
                        if (existSubState.HasValue)
                        {
                            SubStatesListObj.Remove(existSubState.Value);
                            existSubState = null;
                        }
                    }
                }
            }

            this.SubStateList = SubStatesListObj;
        }
Esempio n. 12
0
 protected string GetRoleText(Scope scope, bool IsAdmin, bool IsShipDirector)
 {
     if (IsShipDirector)
     {
         return("Ship Director");
     }
     else
     {
         return(LookupBLL.GetRoleNameUsingScope(scope, IsAdmin, (Descriptor?)null));
     }
 }
Esempio n. 13
0
        protected void BindDescriptors()
        {
            CheckBoxList DescriptorsObj = (CheckBoxList)formView.FindControl("Descriptors");
            IEnumerable <KeyValuePair <int, string> > DescriptorsForScope = LookupBLL.GetDescriptorsForScope(ViewData.Scope);

            if (ViewData.IsUserStateScope)
            {
                bool RemoveShipDirectorDescriptor = true;
                if (ViewData.IsAdmin)
                {
                    //If a Ship Director does not exist for the State, the Ship Director Descriptor can be shown
                    if (!LookupBLL.GetShipDirectorForState(ViewData.StateFIPS).HasValue)
                    {
                        RemoveShipDirectorDescriptor = false;
                    }
                }

                //Ship Director already exists for the State. Need not show it for State Level Admins
                if (RemoveShipDirectorDescriptor)
                {
                    DescriptorsObj.DataSource = (from scope in DescriptorsForScope where scope.Key != Descriptor.ShipDirector.EnumValue <int>() select scope);
                }
            }
            else
            {
                DescriptorsObj.DataSource = DescriptorsForScope;
            }

            DescriptorsObj.DataTextField  = "Value";
            DescriptorsObj.DataValueField = "Key";
            DescriptorsObj.DataBind();

            foreach (ListItem item in DescriptorsObj.Items)
            {
                if (item.Attributes["CustomValue"] == null)
                {
                    item.Attributes.Add("CustomValue", item.Value);
                }
                else
                {
                    item.Attributes["CustomValue"] = item.Value;
                }

                if (item.Attributes["onClick"] == null)
                {
                    item.Attributes.Add("onClick", string.Format("HandleDescriptorlist('{0}', {1})", DescriptorsObj.ClientID, item.Value));
                }
                else
                {
                    item.Attributes["onClick"] = string.Format("HandleDescriptorlist('{0}', {1})", DescriptorsObj.ClientID, item.Value);
                }
            }
        }
Esempio n. 14
0
 private IEnumerable <KeyValuePair <int, string> > GetDescriptors()
 {
     if (this.AccountInfo.IsCMSLevel && this.AccountInfo.IsAdmin)
     {
         return(LookupBLL.GetDescriptorsForScope(Scope.State));
     }
     else
     {
         var DescriptorsList = LookupBLL.GetDescriptorsForScope(Scope.State);
         return(DescriptorsList.Where(p => p.Key != Descriptor.ShipDirector.EnumValue <int>()));
     }
 }
Esempio n. 15
0
        protected void BindFormData()
        {
            //OLD logic
            //Counselors = AgencyLogic.GetAgencyUsers(ViewData.AgencyId, Descriptor.Counselor, true).OrderBy(p => p.Value);

            Counselors = GetCounselors(ViewData.AgencyId);

            CMSSpecialFields   = Logic.GetCMSSpecialFields();
            StateSpecialFields = Logic.GetStateSpecialFields(ViewData.AgencyState);
            CounselorCounties  = AgencyLogic.GetCounties(ViewData.AgencyState.Code);
            ClientCounties     = LookupBLL.GetCountiesForZipCode(ViewData.ClientZIPCode);
            CounselorCounties  = CounselorCounties;
            CounselorZipCodes  = LookupBLL.GetZipCodeForCountyFips2(ViewData.CounselorCountyCode);
        }
Esempio n. 16
0
        /// <summary>
        /// Populates states in the form
        /// </summary>
        protected void PopulateStates()
        {
            //Get all States but CMS State.
            if (IsCMSLevelUser)
            {
                string StateFIPSForCMS = State.GetStateFIPSForCMS();
                //List<KeyValuePair<string, string>> AllStatesOption = new List<KeyValuePair<string, string>>();
                //AllStatesOption.Add(new KeyValuePair<string,string>(StateFIPSForCMS, "All States"));


                IEnumerable <KeyValuePair <string, string> > StatesForUser = null;
                IEnumerable <KeyValuePair <string, string> > StatesData    = State.GetStatesWithFIPSKey().Where(p => p.Key != StateFIPSForCMS);

                if (AccountInfo.Scope.IsEqual(Scope.CMSRegional))
                {
                    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 == cmsStFIPS
                            select stFIPS
                            );
                    }
                }
                else
                {
                    StatesForUser = (from states in StatesData where (states.Key != State.GetStateFIPSForCMS()) select states);
                }

                //if (StatesForUser != null)
                //{
                //    StatesForUser = StatesForUser.Union(AllStatesOption);
                //}

                ddlStates.DataSource = StatesForUser;
            }
        }
Esempio n. 17
0
        protected void dropDownListCounselor_SelectedIndexChanged(object sender, EventArgs e)
        {
            var dropDownListCounselor = (DropDownList)sender;
            var counselorIdSelected   = (!string.IsNullOrEmpty(dropDownListCounselor.SelectedValue))
                                          ? Convert.ToInt32(dropDownListCounselor.SelectedValue)
                                          : 0;

            if (counselorIdSelected == 0)
            {
                return;
            }

            var counselor = UserBLL.GetUserAccount(counselorIdSelected);

            if (counselor == null)
            {
                return;
            }

            var dropDownListCounselorCounty = formViewEditClientContact.FindControl("dropDownListCounselorCounty") as DropDownList;

            dropDownListCounselorCounty.DataSource = AgencyLogic.GetCounties(ViewData.AgencyState.Code);
            dropDownListCounselorCounty.DataBind();
            dropDownListCounselorCounty.Items.Insert(0, new ListItem("-- Select a County --", ""));

            var county = dropDownListCounselorCounty.Items.FindByValue(counselor.CounselingCounty);

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

            var dropDownListCounselorZipCode = formViewEditClientContact.FindControl("dropDownListCounselorZipCode") as DropDownList;

            dropDownListCounselorZipCode.DataSource = LookupBLL.GetZipCodeForCountyFips(counselor.CounselingCounty);
            dropDownListCounselorZipCode.DataBind();
            dropDownListCounselorZipCode.Items.Insert(0, new ListItem("-- Select a Zip Code --", ""));

            var zip = dropDownListCounselorZipCode.Items.FindByText(counselor.CounselingLocation);

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

            dropDownListCounselorCounty.Focus();
        }
Esempio n. 18
0
 protected string GetRoleNameColumnValue(UserSearchViewData viewData)
 {
     if (viewData.UserRoleText == string.Empty)
     {
         if (viewData.IsShipDirector)
         {
             return("Ship Director");
         }
         else
         {
             return(LookupBLL.GetRoleNameUsingScope(viewData.Scope, viewData.IsAdmin, (Descriptor?)null));
         }
     }
     else
     {
         return(viewData.UserRoleText);
     }
 }
Esempio n. 19
0
        private void InferRoleSelection()
        {
            Role CMSRole = LookupBLL.GetRole(Scope.CMS, true);

            if (Int16.Parse(ddlRoles.SelectedValue) == CMSRole.Id)
            {
                _selectedRole = CMSRole;
            }
            else
            {
                _selectedRole = LookupBLL.Roles.Find(p => p.Id == Int16.Parse(ddlRoles.SelectedValue));
            }

            if (_selectedRole == null)
            {
                ShiptalkException.ThrowSecurityException("Possible role list manipulation. The selected role was not found.", "Sorry. We're unable to serve your request. Please contact support for assistance");
            }
        }
Esempio n. 20
0
        private void BindReviewers()
        {
            if (formView.FindControl("ddlReviewers") != null)
            {
                DropDownList ReviewersDDL  = (DropDownList)formView.FindControl("ddlReviewers");
                var          ReviewerItems = LookupBLL.GetReviewersByUserRegion(UserSubStateRegionId, Scope.SubStateRegion);
                if (ReviewerItems != null && ReviewerItems.Count() > 0)
                {
                    ReviewerItems = ReviewerItems.Where(item => item.Key != UserData.UserId);
                }

                ReviewersDDL.DataSource = ReviewerItems;

                ReviewersDDL.DataTextField  = "Value";
                ReviewersDDL.DataValueField = "Key";
                ReviewersDDL.DataBind();
            }
        }
Esempio n. 21
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 btnNew_Click(object sender, EventArgs e)
        {
            DataTable         FoundExistingReport = null;
            ResourceReportBLL rpt = new ResourceReportBLL();

            //If this is a state admin get the state they are admin for
            //and use it.
            if (AccountInfo.IsStateAdmin)
            {
                if (cmbYear.SelectedIndex == 0)
                {
                    msgFeedBack.Text    = "You must select a year to create a resource report";
                    msgFeedBack.Visible = true;
                    return;
                }
                FoundExistingReport = rpt.GetResourceReportByStateFipCode(AccountInfo.StateFIPS, int.Parse(cmbYear.SelectedItem.Text));
            }
            else
            {
                //Store the selected state in a session so the Add Resource Report Form knows
                //The state that should be pre-selected.
                if (ddlStates.SelectedIndex == 0 || cmbYear.SelectedIndex == 0)
                {
                    msgFeedBack.Text    = "You must select a state and year to create a resource report";
                    msgFeedBack.Visible = true;
                    return;
                }
                FoundExistingReport = rpt.GetResourceReportByStateFipCode(LookupBLL.GetStateFipsCodeByShortName(ddlStates.SelectedValue), int.Parse(cmbYear.SelectedItem.Text));
            }


            if (FoundExistingReport.Rows.Count > 0)
            {
                msgFeedBack.Text    = "Report already created for selected state and year.";
                msgFeedBack.Visible = true;
                return;
            }

            Session.Add("RR_SELECTED_STATE", ddlStates.SelectedItem.Text);
            Session.Add("RR_SELECTED_YEAR", cmbYear.SelectedItem.Text);

            RouteController.RouteTo(RouteController.ResourceReportAdd(0));
        }
Esempio n. 23
0
        /// <summary>
        /// Binds the dependent data for the form.
        /// </summary>
        protected void BindDependentData()
        {
            //if user is Cms Regional user populate only his states
            if (AccountInfo.Scope == Scope.CMSRegional)
            {
                string StateFIPSForCMS = State.GetStateFIPSForCMS();

                IEnumerable <KeyValuePair <string, string> > StatesData
                    = State.GetStatesWithFIPSKey().Where(p => p.Key != StateFIPSForCMS);

                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 == cmsStFIPS
                        select stFIPS
                        );
                }
                dropDownListState.DataSource = StatesForUser;
            }
            else
            {
                dropDownListState.DataSource = Logic.GetStates();
            }

            dropDownListState.DataBind();

            aAddAgency.DataBind();
            aAddSubStateRegion.DataBind();
        }
Esempio n. 24
0
        private void HandleCMSRegionDisplayLogic()
        {
            plhCMSRegion.Visible = true;
            if (this.AccountInfo.Scope == Scope.CMSRegional)
            {
                PopulateCMSRegionsForUser();
            }
            else
            {
                ddlCMSRegion.DataSource     = LookupBLL.GetCMSRegions();
                ddlCMSRegion.DataTextField  = "Value";
                ddlCMSRegion.DataValueField = "Key";
                ddlCMSRegion.DataBind();
            }

            if (ddlCMSRegion.Items.Count > 1)
            {
                ddlCMSRegion.Items.Insert(0, new ListItem("Select CMS Region", "0"));
            }
        }
Esempio n. 25
0
        private void HandleSubStateDisplayLogic(string StateFIPS)
        {
            plhSubStateRegion.Visible = true;
            if (this.AccountInfo.Scope != Scope.SubStateRegion)
            {
                ddlSubStateRegion.DataSource     = LookupBLL.GetSubStateRegionsForState(StateFIPS);
                ddlSubStateRegion.DataTextField  = "Value";
                ddlSubStateRegion.DataValueField = "Key";
                ddlSubStateRegion.DataBind();
            }
            else
            {
                PopulateSubStateRegionsForUser();
            }

            if (ddlSubStateRegion.Items.Count > 1)
            {
                ddlSubStateRegion.Items.Insert(0, new ListItem("Select Sub State Region", "0"));
            }
        }
Esempio n. 26
0
        private void HandleAgencyDisplayLogic(string StateFIPS)
        {
            plhAgencies.Visible = true;

            if (this.AccountInfo.Scope != Scope.Agency)
            {
                ddlAgency.DataSource     = LookupBLL.GetAgenciesForState(StateFIPS);
                ddlAgency.DataTextField  = "Value";
                ddlAgency.DataValueField = "Key";
                ddlAgency.DataBind();
            }
            else
            {
                PopulateAgenciesForUser();
            }

            if (ddlAgency.Items.Count > 1)
            {
                ddlAgency.Items.Insert(0, new ListItem("Select Agency", "0"));
            }
        }
Esempio n. 27
0
        private void HandleAgencyDisplayLogic(string StateFIPS)
        {
            plhAgencies.Visible = true;

            if (this.AccountInfo.Scope.IsHigherOrEqualTo(Scope.State))
            {
                var Agencies = LookupBLL.GetAgenciesForState(StateFIPS);
                if (Agencies != null)
                {
                    IEnumerable <KeyValuePair <int, string> > OrderedAgencies = Agencies.OrderBy(p => p.Value);
                    ddlAgency.DataSource = OrderedAgencies;
                }
                else
                {
                    ddlAgency.DataSource = Agencies;
                }

                ddlAgency.DataTextField  = "Value";
                ddlAgency.DataValueField = "Key";
                ddlAgency.DataBind();

                if (ddlAgency.Items.Count > 1)
                {
                    ddlAgency.Items.Insert(0, new ListItem("-- Select agency --", "0"));
                }
                else
                {
                    ddlAgency.Items.Add(new ListItem("No agencies available", "0"));
                }
            }
            else if (this.AccountInfo.Scope.IsEqual(Scope.SubStateRegion))
            {
                PopulateAgenciesForSubStateUser();
            }
            else
            {
                PopulateAgenciesForUser();
            }
        }
Esempio n. 28
0
        protected void textBoxClientZIPCode_TextChanged(object sender, EventArgs e)
        {
            var textBoxClientAIPCode        = (TextBox)sender;
            var proxyValidatorClientZIPCode = formViewEditClientContact.FindControl("proxyValidatorClientZIPCode") as PropertyProxyValidator;
            var dropDownClientCountyCode    = formViewEditClientContact.FindControl("dropDownClientCountyCode") as DropDownList;

            proxyValidatorClientZIPCode.Validate();
            if (!proxyValidatorClientZIPCode.IsValid)
            {
                return;
            }

            dropDownClientCountyCode.DataSource = LookupBLL.GetCountiesForZipCode(textBoxClientAIPCode.Text);
            dropDownClientCountyCode.DataBind();

            //if there are more than one value make the 1st item as selected item..
            //As the counties are orderd by zipCounty.displayorder
            if (dropDownClientCountyCode.Items.Count > 1)
            {
                dropDownClientCountyCode.SelectedIndex = 0;
            }

            dropDownClientCountyCode.Focus();
        }
        /// <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;
            }
        }
Esempio n. 30
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));
            }
        }