Beispiel #1
0
    public ResourceEdit(ProjectTracker.Library.ResourceEdit resource)
    {
      InitializeComponent();

      // store object reference
      _resource = resource;
    }
Beispiel #2
0
        public ResourceEdit(ProjectTracker.Library.ResourceEdit resource)
        {
            InitializeComponent();

            // store object reference
            _resource = resource;
        }
Beispiel #3
0
        private void RebindUI(bool saveObject, bool rebind)
        {
            // disable events
            this.ResourceBindingSource.RaiseListChangedEvents    = false;
            this.AssignmentsBindingSource.RaiseListChangedEvents = false;
            try
            {
                // unbind the UI
                UnbindBindingSource(this.AssignmentsBindingSource, saveObject, false);
                UnbindBindingSource(this.ResourceBindingSource, saveObject, true);
                this.AssignmentsBindingSource.DataSource = this.ResourceBindingSource;

                // save or cancel changes
                if (saveObject)
                {
                    _resource.ApplyEdit();
                    try
                    {
                        _resource = _resource.Save();
                    }
                    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);
                    }
                }
                else
                {
                    _resource.CancelEdit();
                }
            }
            finally
            {
                // rebind UI if requested
                if (rebind)
                {
                    BindUI();
                }

                // restore events
                this.ResourceBindingSource.RaiseListChangedEvents    = true;
                this.AssignmentsBindingSource.RaiseListChangedEvents = true;

                if (rebind)
                {
                    // refresh the UI if rebinding
                    this.ResourceBindingSource.ResetBindings(false);
                    this.AssignmentsBindingSource.ResetBindings(false);
                }
            }
        }
 public ResourceAssignmentEdit(ProjectTracker.Library.ResourceEdit parent)
 {
     ManageObjectLifetime = true;
     EditMode             = false;
     ParentResource       = parent;
     ProjectTracker.Library.ProjectList.GetProjectList((o, e) =>
     {
         if (e.Error != null)
         {
             Bxf.Shell.Instance.ShowError("Error retrieving project list", "Data Error");
         }
         else
         {
             Projects = e.Object;
         }
     });
 }
Beispiel #5
0
    private void RebindUI(bool saveObject, bool rebind)
    {
      // disable events
      this.ResourceBindingSource.RaiseListChangedEvents = false;
      this.AssignmentsBindingSource.RaiseListChangedEvents = false;
      try
      {
        // unbind the UI
        UnbindBindingSource(this.AssignmentsBindingSource, saveObject, false);
        UnbindBindingSource(this.ResourceBindingSource, saveObject, true);
        this.AssignmentsBindingSource.DataSource = this.ResourceBindingSource;

        // save or cancel changes
        if (saveObject)
        {
          _resource.ApplyEdit();
          try
          {
            _resource = _resource.Save();
          }
          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);
          }
        }
        else
          _resource.CancelEdit();
      }
      finally
      {
        // rebind UI if requested
        if (rebind)
          BindUI();

        // restore events
        this.ResourceBindingSource.RaiseListChangedEvents = true;
        this.AssignmentsBindingSource.RaiseListChangedEvents = true;

        if (rebind)
        {
          // refresh the UI if rebinding
          this.ResourceBindingSource.ResetBindings(false);
          this.AssignmentsBindingSource.ResetBindings(false);
        }
      }
    }
 internal void UpdateInfo(ProjectTracker.Library.ResourceEdit resourceEdit)
 {
     Model.SetName(resourceEdit);
 }