コード例 #1
0
        private void DisplayIndividualDetails(Person person)
        {
            _pnlContactDetails.Style.Add("width", "800px");
            _pnlContactDetails.Style.Add("height", "500px");
            _pnlOrganisation.Visible = false;
            _pnlIndividual.Visible   = true;

            //Get the data for the dropdown lists only if we havent fetched it earlier
            if (!(bool)ViewState["IndividualsDropdownsPopulated"])
            {
                BindIndividualsDropdownLists();
                ViewState["IndividualsDropdownsPopulated"] = true;
            }
            if (person.Title != string.Empty)
            {
                _ddlTitle.SelectedValue = person.Title;
            }

            _txtForenames.Text = person.ForeName;
            _txtSurname.Text   = person.Surname;
            _ddlMaritalStatus.SelectedValue = person.MaritalStatusId.ToString();
            _txtPreviousName.Text           = person.PreviousName;
            _txtOccupation.Text             = person.Occupation;
            _ddlSex.SelectedValue           = person.Sex.ToString();
            if (person.DOB != DataConstants.BlankDate)
            {
                _ccDOBDate.DateText = person.DOB.ToString("dd/MM/yyyy");
                //Contact blank date in the database was being stored as 01/01/1900 which is not the system blankdate
                //Therefore added a test to make sure that the date of death is later than the date of birth.
                //If it isn't, restore date of death to system blankdate as it is invalid.
                if ((person.DOD != DataConstants.BlankDate) && (person.DOD < person.DOB))
                {
                    _ccDODDate.DateText = DataConstants.BlankDate.ToString("dd/MM/yyyy");
                }
            }

            _txtAge.Text = AppFunctions.CalculateAge(person.DOB, person.DOD);
            if (person.DOD != DataConstants.BlankDate)
            {
                _ccDODDate.DateText = person.DOD.ToString("dd/MM/yyyy");
            }
            _txtPlaceOfBirth.Text        = person.PlaceOfBirth;
            _txtBirthName.Text           = person.BirthName;
            _txtFormalSalutation.Text    = person.SalutationLettterFormal;
            _txtInformalSalutation.Text  = person.SalutationLettterInformal;
            _txtFriendlySalutation.Text  = person.SalutationLettterFriendly;
            _txtEnvelopeSalutation.Text  = person.SalutationEnvelope;
            _ddlEthnicity.SelectedValue  = person.EthnicityId.ToString();
            _ddlDisability.SelectedValue = person.DisabilityId.ToString();
            _chkArmedForces.Checked      = person.IsInArmedForces;
            _txtArmedForcesNo.Text       = person.ArmedForcesNo;
            _txtNINo.Text = person.NINo;
        }