/// <summary> /// Open Account menu command event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuOpenAcct_Activate(object sender, EventArgs e) { bool errorStatus = false; Cursor.Current = Cursors.WaitCursor; iCampaign.TACS.Data.AccountsDs.AccountsDataTable dataTable = null; ProjectService projService = new ProjectService(); try { dataTable = projService.GetAccounts(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to get accounts", MessageBoxButtons.OK, MessageBoxIcon.Error); errorStatus = true; } finally { Cursor.Current = Cursors.Default; } if (!errorStatus) { AccountsBox accountsDlog = new AccountsBox(dataTable); if (accountsDlog.ShowDialog() == DialogResult.OK) { _CurrentAccountId = accountsDlog.SelectedAccountId; _CurrentAccount = accountsDlog.SelectedAccount; LoadAccount(this.CurrentAccountId); } } }
/// <summary> /// Display the available TACS.NET applications registered in the database. /// </summary> public void ShowApplications() { bool errorStatus = false; this.SuspendLayout(); Cursor.Current = Cursors.WaitCursor; treeApps.Nodes.Clear(); // Get the applications from the database ProjectService projService = new ProjectService(); iCampaign.TACS.Data.ApplicationsDs.ApplicationsDataTable dataTable; try { dataTable = projService.GetApplications(); RefreshAppNodes(dataTable); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to display applications", MessageBoxButtons.OK, MessageBoxIcon.Error); errorStatus = true; } finally { Cursor.Current = Cursors.Default; this.ResumeLayout(); } // If there's no connection string, exit the application if (formLoading && errorStatus) Application.Exit(); }
/// <summary> /// Display the projects registered under the open account. /// </summary> public void ShowProjects() { this.SuspendLayout(); Cursor.Current = Cursors.WaitCursor; treeProj.Nodes.Clear(); // Get the applications from the database ProjectService projService = new ProjectService(); iCampaign.TACS.Data.ProjectsDs.ProjectsDataTable dataTable; try { dataTable = projService.GetProjects(this.CurrentAccountId); RefreshProjNodes(dataTable); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to display projects", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; this.ResumeLayout(); } }