public ProjectEdit(ProjectTracker.Library.ProjectEdit project) { InitializeComponent(); // store object reference Project = project; }
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); } } }
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); }
public void SetName(ProjectEdit item) { Name = item.Name; OnPropertyChanged(NameProperty); }
private void Child_Insert(ProjectEdit project) { Child_Insert(project.Id); }
private void Child_DeleteSelf(ProjectEdit project) { Child_DeleteSelf(project.Id); }
private void DeleteSelf(ProjectEdit project, [Inject] IAssignmentDal dal) { DeleteSelf(project.Id, dal); }
private void Update(ProjectEdit project, [Inject] IAssignmentDal dal) { Update(project.Id, dal); }
private void Insert(ProjectEdit project, [Inject] IAssignmentDal dal) { Insert(project.Id, dal); }