예제 #1
0
 private void NewResourceToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (StatusBusy busy = new StatusBusy("Creating resource..."))
     {
         AddWinPart(new ResourceEdit(ProjectTracker.Library.ResourceEdit.NewResourceEdit()));
     }
 }
예제 #2
0
파일: LoginForm.cs 프로젝트: mlivensp/csla
 private void OK_Click(object sender, EventArgs e)
 {
     using (StatusBusy busy =
                new StatusBusy("Verifying credentials..."))
     {
         ProjectTracker.Library.Security.PTPrincipal.Login(
             this.UsernameTextBox.Text, this.PasswordTextBox.Text);
     }
     this.Close();
 }
예제 #3
0
 private void ApplyButton_Click(object sender, EventArgs e)
 {
     if (IsSavable())
     {
         using (StatusBusy busy = new StatusBusy("Saving..."))
         {
             RebindUI(true, true);
         }
     }
 }
예제 #4
0
 private void OKButton_Click(object sender, EventArgs e)
 {
     if (IsSavable())
     {
         using (StatusBusy busy = new StatusBusy("Saving..."))
         {
             if (RebindUI(true, false))
             {
                 this.Close();
             }
         }
     }
 }
예제 #5
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();
             }
         }
     }
 }
예제 #6
0
        public void ShowEditProject(int projectId)
        {
            // see if this project is already loaded
            foreach (Control ctl in Panel1.Controls)
            {
                if (ctl is ProjectEdit)
                {
                    ProjectEdit part = (ProjectEdit)ctl;
                    if (part.Project.Id.Equals(projectId))
                    {
                        // project already loaded so just
                        // display the existing winpart
                        ShowWinPart(part);
                        return;
                    }
                }
            }

            // the project wasn't already loaded
            // so load it and display the new winpart
            using (StatusBusy busy = new StatusBusy("Loading project..."))
            {
                try
                {
                    AddWinPart(new ProjectEdit(ProjectTracker.Library.ProjectEdit.GetProject(projectId)));
                }
                catch (Csla.DataPortalException ex)
                {
                    MessageBox.Show(ex.BusinessException.ToString(),
                                    "Error loading", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(),
                                    "Error loading", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
예제 #7
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);
                        }
                    }
                }
            }
        }