예제 #1
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>
        /// <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;
            }
        }
        /// <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;
            }
        }