예제 #1
0
        private void renameSelectedProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (getSelectedProfile() == null)
            {
                using (frmMessageBox messageBox = new frmMessageBox())
                {
                    common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                    common.getMainForm().loadedTheme.themeForm(messageBox);
                    messageBox.show("No Profile Selected.", "No Profile Selected", MessageBoxButtons.OK);
                }
            }
            else
            {
                using (frmInputBox inputBox = new frmInputBox())
                {
                    common.setFormFontSize(inputBox, common.getMainForm().loadedFontSize);
                    common.getMainForm().loadedTheme.themeForm(inputBox);
                    inputBox.Text            = "Rename Profile: [" + getSelectedProfile().name + "]";
                    inputBox.lblMessage.Text = "Enter new profile name:";
                    inputBox.txtInput.Text   = getSelectedProfile().name;

                    inputBox.ShowDialog();

                    /* i.e. only process if the user said OK */
                    if (inputBox.DialogResult == DialogResult.OK)
                    {
                        if (!string.IsNullOrEmpty(inputBox.result) &&
                            !isRenameProfileNameDuplicate(this.loadedAccount.profiles, inputBox.result))
                        {
                            //rename profile
                            fundingProfile renamedProfile = new fundingProfile(getSelectedProfile().id, inputBox.result, getSelectedProfile().cashFlows);

                            common.updateProfileOnAccount(common.getMainForm().loadedAccount, getSelectedProfile(), renamedProfile);
                            common.getMainForm().refreshDataForAllMdiChildren();
                        }
                        else
                        {
                            using (frmMessageBox messageBox = new frmMessageBox())
                            {
                                common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                                common.getMainForm().loadedTheme.themeForm(messageBox);
                                messageBox.show("You cannot have more than one profile with the same name",
                                                "Duplicate Profile Name", MessageBoxButtons.OK);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
파일: frmMain.cs 프로젝트: CPS5995/project1
 private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (frmMessageBox messageBox = new frmMessageBox())
     {
         common.setFormFontSize(messageBox, this.loadedFontSize);
         this.loadedTheme.themeForm(messageBox);
         if (messageBox.show("You will be logged out of the Application?\r\nAny unsaved work will be lost."
                             + "\r\n\r\n Are you sure you want to log out?",
                             "Log Out?", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             logOut();
             showLoginDialog();
         }
     }
 }
예제 #3
0
        private void importCashFlowsFromFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (getSelectedProfile() == null)
            {
                using (frmMessageBox messageBox = new frmMessageBox())
                {
                    common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                    common.getMainForm().loadedTheme.themeForm(messageBox);
                    messageBox.show("No Profile Selected.", "No Profile Selected", MessageBoxButtons.OK);
                }
            }
            else
            {
                string importFile = getFileToImport();

                if (!string.IsNullOrEmpty(importFile))
                {
                    try
                    {
                        importCashFlowsIntoProfile(parseCsvIntoDataTable(importFile), getSelectedProfile());
                        using (frmMessageBox messageBox = new frmMessageBox())
                        {
                            common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                            common.getMainForm().loadedTheme.themeForm(messageBox);
                            messageBox.show(parseCsvIntoDataTable(importFile).Rows.Count + " Cash Flows Imported.",
                                            "Import Successful", MessageBoxButtons.OK);
                        }
                    }
                    catch (Exception ex)
                    {
                        using (frmMessageBox messageBox = new frmMessageBox())
                        {
                            common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                            common.getMainForm().loadedTheme.themeForm(messageBox);
                            messageBox.show("Cash Flow Import Failed\r\n" +
                                            "Please Make sure the file is in the proper format.",
                                            "Import Failed", MessageBoxButtons.OK);
                        }
                    }
                    common.getMainForm().refreshDataForAllMdiChildren();
                }
            }
        }
예제 #4
0
 private void runReportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (validateReportBounds(tstbLowerBound.Text, tstbUpperBound.Text))
     {
         chrtReportChart.Series.Clear();
         runReport(getSelectedProfiles(),
                   DateTime.Parse(tstbLowerBound.Text),
                   DateTime.Parse(tstbUpperBound.Text),
                   getReportTypeByName(tscbReportType.Text));
     }
     else
     {
         using (frmMessageBox messageBox = new frmMessageBox())
         {
             common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
             common.getMainForm().loadedTheme.themeForm(messageBox);
             messageBox.show("Upper and Lower bounds MUST be dates and the\r\n" +
                             "Lower Bound must be EARLIER than the Upper Bound.",
                             "Invalid Report Bounds!", MessageBoxButtons.OK);
         }
     }
 }
예제 #5
0
        private void deleteSelectedProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmMessageBox messageBox = new frmMessageBox())
            {
                common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                common.getMainForm().loadedTheme.themeForm(messageBox);

                if (getSelectedProfile() == null)
                {
                    messageBox.show("No Profile Selected.", "No Profile Selected", MessageBoxButtons.OK);
                }
                else
                {
                    if (messageBox.show("You are about to delete the profile: [" + getSelectedProfile().name + "]"
                                        + "\r\nThe Profile and ALL of its Cash Flows will be deleted!"
                                        + "\r\n\r\nAre you sure you want to delete this Profile?",
                                        "Delete Profile?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        common.deleteProfileFromAccount(loadedAccount, getSelectedProfile());
                        common.getMainForm().refreshDataForAllMdiChildren();
                    }
                }
            }
        }