示例#1
0
文件: MainForm.cs 项目: uzigula/csla
        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
文件: ProjectEdit.cs 项目: wyerp/csla
        private void AssignButton_Click(object sender, EventArgs e)
        {
            ResourceSelect dlg = new ResourceSelect();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    _project.Resources.Assign(dlg.ResourceId);
                }
                catch (InvalidOperationException ex)
                {
                    MessageBox.Show(ex.ToString(),
                                    "Error Assigning", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
 private void AssignButton_Click(object sender, EventArgs e)
 {
     ResourceSelect dlg = new ResourceSelect();
       if (dlg.ShowDialog() == DialogResult.OK)
     try
     {
       _project.Resources.Assign(dlg.ResourceId);
     }
     catch (InvalidOperationException ex)
     {
       MessageBox.Show(ex.ToString(),
     "Error Assigning", MessageBoxButtons.OK,
     MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
       MessageBox.Show(ex.ToString(),
     "Error Assigning", MessageBoxButtons.OK,
     MessageBoxIcon.Exclamation);
     }
 }
示例#4
0
文件: MainForm.cs 项目: uzigula/csla
        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.Exclamation);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(),
                                            "Error deleting", MessageBoxButtons.OK,
                                            MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
        }
 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);
       }
 }
        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
            {
              Resource.DeleteResource(resourceId);
            }
            catch (Csla.DataPortalException ex)
            {
              MessageBox.Show(ex.BusinessException.ToString(),
                "Error deleting", MessageBoxButtons.OK,
                MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
              MessageBox.Show(ex.ToString(),
                "Error deleting", MessageBoxButtons.OK,
                MessageBoxIcon.Exclamation);
            }
              }
            }
              }
        }