Exemplo n.º 1
0
        public ProjectEdit(ProjectTracker.Library.ProjectEdit project)
        {
            InitializeComponent();

            // store object reference
            Project = project;
        }
Exemplo n.º 2
0
        private bool RebindUI(bool saveObject, bool rebind)
        {
            // disable events
            this.ProjectBindingSource.RaiseListChangedEvents   = false;
            this.ResourcesBindingSource.RaiseListChangedEvents = false;
            try
            {
                // unbind the UI
                UnbindBindingSource(this.ResourcesBindingSource, saveObject, false);
                UnbindBindingSource(this.ProjectBindingSource, saveObject, true);
                this.ResourcesBindingSource.DataSource = this.ProjectBindingSource;

                // save or cancel changes
                if (saveObject)
                {
                    Project.ApplyEdit();
                    try
                    {
                        Project = Project.Save();
                    }
                    catch (Csla.DataPortalException ex)
                    {
                        MessageBox.Show(ex.BusinessException.ToString(),
                                        "Error saving", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(),
                                        "Error Saving", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                }
                else
                {
                    Project.CancelEdit();
                }

                return(true);
            }
            finally
            {
                // rebind UI if requested
                if (rebind)
                {
                    BindUI();
                }

                // restore events
                this.ProjectBindingSource.RaiseListChangedEvents   = true;
                this.ResourcesBindingSource.RaiseListChangedEvents = true;

                if (rebind)
                {
                    // refresh the UI if rebinding
                    this.ProjectBindingSource.ResetBindings(false);
                    this.ResourcesBindingSource.ResetBindings(false);
                }
            }
        }
Exemplo 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();
             }
         }
     }
 }
Exemplo n.º 4
0
 private void Child_Update(ProjectEdit project)
 {
     Child_Update(project.Id);
 }
Exemplo n.º 5
0
 public void SetName(ProjectEdit item)
 {
     Name = item.Name;
     OnPropertyChanged(NameProperty);
 }
Exemplo n.º 6
0
 private void Child_Insert(ProjectEdit project)
 {
     Child_Insert(project.Id);
 }
Exemplo n.º 7
0
 private void Child_DeleteSelf(ProjectEdit project)
 {
     Child_DeleteSelf(project.Id);
 }
Exemplo n.º 8
0
 private void DeleteSelf(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     DeleteSelf(project.Id, dal);
 }
Exemplo n.º 9
0
 private void Update(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     Update(project.Id, dal);
 }
Exemplo n.º 10
0
 private void Insert(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     Insert(project.Id, dal);
 }