Exemple #1
0
        public ProjectEdit(ProjectTracker.Library.ProjectEdit project)
        {
            InitializeComponent();

            // store object reference
            Project = project;
        }
Exemple #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);
                }
            }
        }
Exemple #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();
             }
         }
     }
 }
 private void Child_Update(ProjectEdit project)
 {
     Child_Update(project.Id);
 }
Exemple #5
0
 public void SetName(ProjectEdit item)
 {
     Name = item.Name;
     OnPropertyChanged(NameProperty);
 }
 private void Child_Insert(ProjectEdit project)
 {
     Child_Insert(project.Id);
 }
Exemple #7
0
 private void Child_DeleteSelf(ProjectEdit project)
 {
     Child_DeleteSelf(project.Id);
 }
Exemple #8
0
 private void DeleteSelf(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     DeleteSelf(project.Id, dal);
 }
Exemple #9
0
 private void Update(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     Update(project.Id, dal);
 }
Exemple #10
0
 private void Insert(ProjectEdit project, [Inject] IAssignmentDal dal)
 {
     Insert(project.Id, dal);
 }