コード例 #1
0
        public void LoadUserData()
        {
            // user data
            user = User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            Name.Text = string.IsNullOrEmpty(user.Name) ? string.Empty : user.Name;
            Email.Text = string.IsNullOrEmpty(Membership.GetUser().Email.ToString()) ? string.Empty : Membership.GetUser().Email.ToString();
            Address.Text = string.IsNullOrEmpty(user.StreetAddress) ? string.Empty : user.StreetAddress;
            City.Text = string.IsNullOrEmpty(user.City) ? string.Empty : user.City;
            Zip.Text = string.IsNullOrEmpty(user.Zip) ? string.Empty : user.Zip;
            Mobile.Text = string.IsNullOrEmpty(user.BestContactNumber) ? string.Empty : user.BestContactNumber;
            Question.Text = user.GetSeacretQuestion(Membership.GetUser().UserName.ToString());
            DriversLicense.Text = string.IsNullOrEmpty(user.DriversLicenseNumber) ? string.Empty : user.DriversLicenseNumber;

            if (!string.IsNullOrEmpty(user.Status))
            {
                for (int i = 0; i < Status.Items.Count; i++)
                {
                    if (Status.Items[i].Value.ToString().ToLower() == user.Status.ToLower())
                    {
                        Status.Items[i].Selected = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(user.State))
            {
                for (int i = 0; i < Drpstate.Items.Count; i++)
                {
                    if (Drpstate.Items[i].Value.ToString().ToLower() == user.State.ToLower())
                    {
                        Drpstate.Items[i].Selected = true;
                    }
                }
            }

            if (!string.IsNullOrEmpty(user.Gender))
            {
                for (int i = 0; i < DrpGender.Items.Count; i++)
                {
                    if (DrpGender.Items[i].Value.ToString().ToLower() == user.Gender.ToLower())
                    {
                        DrpGender.Items[i].Selected = true;
                    }
                }

            }

            // school data

            student = RHP.StudentManagement.Student.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            if (student != null)
            {
                if (!string.IsNullOrEmpty(student.School.SchoolId.ToString()))
                {
                    for (int i = 0; i < DrpSchoolName.Items.Count; i++)
                    {
                        if (DrpSchoolName.Items[i].Value.ToString().ToLower() == student.School.SchoolId.ToString())
                        {
                            DrpSchoolName.Items[i].Selected = true;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(student.Year.ToString()))
                {
                    for (int i = 0; i < DRPYear.Items.Count; i++)
                    {
                        if (DRPYear.Items[i].Value.ToString().ToLower() == student.Year.ToString())
                        {
                            DRPYear.Items[i].Selected = true;
                        }
                    }
                }
                LandLoadName.Text = string.IsNullOrEmpty(student.LandloadName) ? string.Empty : student.LandloadName;
                LandLoadPlace.Text = string.IsNullOrEmpty(student.LandloadPlace) ? string.Empty : student.LandloadPlace;
            }
        }