예제 #1
0
        private void EditResourceToolStripMenuItem_Click(
            object sender, EventArgs e)
        {
            ResourceSelect dlg = new ResourceSelect();

            dlg.Text = "Edit Resource";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                // get the resource id
                ShowEditResource(dlg.ResourceId);
            }
        }
예제 #2
0
        private void DeleteResourceToolStripMenuItem_Click(
            object sender, EventArgs e)
        {
            ResourceSelect dlg = new ResourceSelect();

            dlg.Text = "Delete Resource";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                // get the resource id
                int resourceId = dlg.ResourceId;

                if (MessageBox.Show("Are you sure?", "Delete resource",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    using (StatusBusy busy =
                               new StatusBusy("Deleting resource..."))
                    {
                        try
                        {
                            ProjectTracker.Library.ResourceEdit.DeleteResourceEdit(resourceId);
                        }
                        catch (Csla.DataPortalException ex)
                        {
                            MessageBox.Show(ex.BusinessException.ToString(),
                                            "Error deleting", MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(),
                                            "Error deleting", MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
예제 #3
0
 private void AssignButton_Click(object sender, EventArgs e)
 {
     using (ResourceSelect dlg = new ResourceSelect())
     {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 Project.Resources.Assign(dlg.ResourceId);
             }
             catch (InvalidOperationException ex)
             {
                 MessageBox.Show(ex.Message,
                                 "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString(),
                                 "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }