Esempio n. 1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            // stop the flow of events
            this.rolesBindingSource.RaiseListChangedEvents = false;

            // commit edits in memory and unbind
            UnbindBindingSource(this.rolesBindingSource, true, true);

            try
            {
                _roles = _roles.Save();
                RoleList.InvalidateCache();
                RoleList.CacheList();
                this.Close();
            }
            catch (Csla.DataPortalException ex)
            {
                MessageBox.Show(ex.BusinessException.ToString(),
                                "Error saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(),
                                "Error saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                this.rolesBindingSource.DataSource = _roles;

                this.rolesBindingSource.RaiseListChangedEvents = true;
                this.rolesBindingSource.ResetBindings(false);
            }
        }
Esempio n. 2
0
 protected override void DataPortal_OnDataPortalInvokeComplete(Csla.DataPortalEventArgs e)
 {
     if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Server &&
         e.Operation == DataPortalOperations.Update)
     {
         // this runs on the server and invalidates
         // the RoleList cache
         RoleList.InvalidateCache();
     }
 }
Esempio n. 3
0
 private void RefreshButton_Click(object sender, EventArgs e)
 {
     if (CanRefresh())
     {
         using (StatusBusy busy = new StatusBusy("Refreshing..."))
         {
             if (RebindUI(false, false))
             {
                 Project = ProjectTracker.Library.ProjectEdit.GetProject(Project.Id);
                 RoleList.InvalidateCache();
                 RoleList.CacheList();
                 Setup();
             }
         }
     }
 }
Esempio n. 4
0
        public override Roles Save()
        {
            // see if save is allowed
            if (!CanEditObject())
            {
                throw new SecurityException(
                          "User not authorized to save roles");
            }

            // do the save
            Roles result;

            result = base.Save();
            // this runs on the client and invalidates
            // the RoleList cache
            RoleList.InvalidateCache();
            return(result);
        }
Esempio n. 5
0
 private void Roles_Saved(object sender, Csla.Core.SavedEventArgs e)
 {
     // this runs on the client and invalidates
     // the RoleList cache
     RoleList.InvalidateCache();
 }