Exemple #1
0
        } = 1;                                      //This is hardcoded for the purposes of testing

        public FormUserProfile()
        {
            InitializeComponent();

            try
            {
                PreLoadOperations();
                Repository = new UserProfileRepository();

                List <UserLevelCategory> categories = Repository.GetUserLevelCategories();
                UserProfile userProfile             = Repository.GetUserProfile(UserProfileId);
                AggregationBindingList <UserProfileSystemSetting> userSystemSettings = Repository.GetSystemSettings(UserProfileId);

                bindingSourceUserProfileSystemSetting.DataSource = userSystemSettings;
                bindingSourceUserLevelCategory.DataSource        = categories;
                bindingSourceUserProfile.DataSource = userProfile;

                if (userProfile.IsAdmin && userProfile.Status == Status.Active)
                {
                    EnableAdminMode();
                }
                else
                {
                    this.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error was encountered: {0}", ex.Message);
            }
        }
Exemple #2
0
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            try
            {
                bindingSourceUserProfile.Clear();
                bindingSourceUserProfileSystemSetting.Clear();
                UserProfile userProfile = Repository.GetUserProfile(UserProfileId);
                AggregationBindingList <UserProfileSystemSetting> userSystemSettings = Repository.GetSystemSettings(UserProfileId);

                bindingSourceUserProfileSystemSetting.DataSource = userSystemSettings;
                bindingSourceUserProfile.DataSource = userProfile;
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error was encountered: {0}", ex.Message);
            }
        }