private void button1_Click(object sender, EventArgs e)
        {
            if (cboMasterRecord.SelectedIndex == -1)
            {
                MessageBox.Show("Error: You must select a master record. Please correct and try again.", "Error!", MessageBoxButtons.OK);
                return;
            }

            if (cboMonthlyData.SelectedIndex == -1)
            {
                MessageBox.Show("Error: You must select an option for monthly data. Please correct and try again.", "Error!", MessageBoxButtons.OK);
                return;
            }

            Guid masterFundId = ((Fund)((ListItem)cboMasterRecord.SelectedItem).HiddenObject).FundId;
            Guid minorFundId;

            if (masterFundId == fund1.FundId)
            {
                minorFundId = fund2.FundId;
            }
            else
            {
                minorFundId = fund1.FundId;
            }

            try
            {
                frmSplashScreen ss = new frmSplashScreen();
                ss.Show();

                Application.DoEvents();

                if (cboMonthlyData.SelectedIndex == 0)
                {
                    Business.Entities.Fund.Disable(minorFundId, frmMain_Parent.CurrentUser.UserId);
                }
                else if (cboMonthlyData.SelectedIndex == 1)
                {
                    Business.Entities.Fund.MergeRecordsWithOverwrite(masterFundId, minorFundId, frmMain_Parent.CurrentUser.UserId);
                }
                else if (cboMonthlyData.SelectedIndex == 2)
                {
                    Business.Entities.Fund.MergeRecordsWithCopy(masterFundId, minorFundId, frmMain_Parent.CurrentUser.UserId);
                }

                ss.Close();

                MessageBox.Show("Records successfully merged!", "Success!", MessageBoxButtons.OK);

                frmMain_Parent.LoadDuplicateRecordsDgv();

                this.Close();
            }
            catch (Exception ex)
            {
                frmError _frmError = new frmError(frmMain_Parent, ex);
            }
        }
        public frmTask(frmMain _frmMain)
        {
            frmSplashScreen _frmSplashScreen = new frmSplashScreen();

            _frmSplashScreen.Show();
            Application.DoEvents();

            InitializeComponent();

            #region IMessageFilter Methods

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.label26);
            controlsToMove.Add(this.label39);
            controlsToMove.Add(this.panel7);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.pictureBox1);

            #endregion

            frmMain_Parent = _frmMain;

            comboBoxRegarding.Items.Clear();

            foreach (DataRow dr in Account.GetActiveCustomers().Rows)
            {
                comboBox3.Items.Add(new ListItem(dr["Account"].ToString(), dr["AccountId"].ToString()));
            }

            foreach (DataRow dr in Fund.GetAllTickers().Rows)
            {
                comboBoxRegarding.Items.Add(new ListItem(dr["Ticker"].ToString() + " - " + dr["FundName"].ToString(), dr["FundId"].ToString()));
            }

            foreach (DataRow dr in Manager.GetActive().Rows)
            {
                comboBox2.Items.Add(new ListItem(dr["Full Name"].ToString() + ", " + dr["Credentials"].ToString(), dr["ManagerId"].ToString()));
            }

            foreach (DataRow dr in Task.GetTaskNames().Rows)
            {
                comboBox1.Items.Add(new ListItem(dr["TaskName"].ToString(), dr["TaskTypeId"].ToString()));
            }

            foreach (User _user in User.ActiveUsers())
            {
                comboBoxOwner.Items.Add(new ListItem(_user.FullName, _user.UserId.ToString()));
            }

            comboBox1.Select();

            this.Show();
            _frmSplashScreen.Close();
        }
        public frmFund(frmMain mf, Guid _fundId, string benchMark = null)
        {
            frmSplashScreen ss = new frmSplashScreen();
            ss.Show();
            Application.DoEvents();

            InitializeComponent();
            frmMain_Parent = mf;

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

            Application.AddMessageFilter(this);
            controlsToMove.Add(label26);
            controlsToMove.Add(lblFundName);
            controlsToMove.Add(panel8);
            controlsToMove.Add(panel16);

            CurrentFund = new Fund(_fundId, null);

            fundFormOpen();
            LoadPlansDgv();
            getAdvisors();

            lblFundName.Text = Fields.NullHandler(CurrentFund.FundName);
            lblInvestmentId.Text = Fields.NullHandler(CurrentFund.Ticker);

            if (benchMark != null)
            {
                cboBench.Text = benchMark;
            }

            Text = CurrentFund.FundName;
            label26.Text = "Investment Services Program - " + CurrentFund.FundName;


            if (CurrentFund.InceptionDate == null)
            {
                lblInceptionDate.Text = Fields.NullHandler(null);
            }
            else
            {
                lblInceptionDate.Text = ((DateTime)CurrentFund.InceptionDate).ToString("MMM yyyy");
            }

            lblFundAssets.Text = FormatMoneyWithAbbreviations(CurrentFund.FundAssets);

            if (CurrentFund.TimeTableId != null)
            {
                label12.Text = "| As of " + CurrentFund.AsOfDate;

                if (CurrentFund.YearValue != DateTime.Now.Year)
                    lblRetYTD.Text = CurrentFund.YearValue.ToString();
                else
                    lblRetYTD.Text = "YTD";

                lblRetY1.Text = (CurrentFund.YearValue - 1).ToString();
                lblRetY2.Text = (CurrentFund.YearValue - 2).ToString();
                lblRetY3.Text = (CurrentFund.YearValue - 3).ToString();
                lblRetY4.Text = (CurrentFund.YearValue - 4).ToString();
                lblRetY5.Text = (CurrentFund.YearValue - 5).ToString();
                lblRetY6.Text = (CurrentFund.YearValue - 6).ToString();
                lblRetY7.Text = (CurrentFund.YearValue - 7).ToString();
                lblRetY8.Text = (CurrentFund.YearValue - 8).ToString();
                lblRetY9.Text = (CurrentFund.YearValue - 9).ToString();
                lblRetY10.Text = (CurrentFund.YearValue - 10).ToString();
            }
            else
            {
                label12.Text = "| No monthly data exists for this fund";
            }

            lblTopTenHolding.Text = Fields.NullHandler(CurrentFund.Top10Holdings);
            lblExpenseRatio.Text = Fields.NullHandler(CurrentFund.GrossExpenseRatio);
            lblNumberHolding.Text = Fields.NullHandler(CurrentFund.TotNumOfHoldings);
            lblTurnoverRatio.Text = Fields.NullHandler(CurrentFund.TurnoverRatio);

            lblAvgEffDuration.Text = Fields.NullHandler(CurrentFund.AvgEffectiveDuration);
            lblPeYield.Text = Fields.NullHandler(CurrentFund.PeYield);
            lblPbYield.Text = Fields.NullHandler(CurrentFund.PbYield);

            lblTrailingReturnYTD.Text = Fields.NullHandler(CurrentFund.TrailingReturnYTD);
            lblTrailingReturnM1.Text = Fields.NullHandler(CurrentFund.TrailingReturnM1);
            lblFundRetYTD.Text = Fields.NullHandler(CurrentFund.TrailingReturnYTD);
            lblFundRetY1.Text = Fields.NullHandler(CurrentFund.AnnRetY1);
            lblFundRetY2.Text = Fields.NullHandler(CurrentFund.AnnRetY2);
            lblFundRetY3.Text = Fields.NullHandler(CurrentFund.AnnRetY3);
            lblFundRetY4.Text = Fields.NullHandler(CurrentFund.AnnRetY4);
            lblFundRetY5.Text = Fields.NullHandler(CurrentFund.AnnRetY5);
            lblFundRetY6.Text = Fields.NullHandler(CurrentFund.AnnRetY6);
            lblFundRetY7.Text = Fields.NullHandler(CurrentFund.AnnRetY7);
            lblFundRetY8.Text = Fields.NullHandler(CurrentFund.AnnRetY8);
            lblFundRetY9.Text = Fields.NullHandler(CurrentFund.AnnRetY9);
            lblFundRetY10.Text = Fields.NullHandler(CurrentFund.AnnRetY10);

            ss.Close();
            this.Show();
		}
        public frmAccount(frmMain mf, Guid accountId, FormClosedEventHandler Close = null)
        {
            frmSplashScreen ss = new frmSplashScreen();

            ss.Show();
            Application.DoEvents();

            InitializeComponent();

            frmMain_Parent = mf;

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.panel1);
            controlsToMove.Add(this.panel7);
            controlsToMove.Add(this.panel12);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.label1);
            controlsToMove.Add(this.label23);
            controlsToMove.Add(this.label30);
            controlsToMove.Add(this.label39);

            FormClosed += Close;

            loadObservationFields();

            CurrentAccount              = new Account(accountId);
            txtName.Text                = CurrentAccount.Name;
            this.Text                   = CurrentAccount.Name;
            label18.Text                = CurrentAccount.Name;
            label23.Text                = CurrentAccount.Name;
            label30.Text                = CurrentAccount.Name;
            txtEngagements.Text         = CurrentAccount.Engagements;
            txtPrimaryContactName.Text  = CurrentAccount.PrimaryContact.Name;
            txtPrimaryContactEmail.Text = CurrentAccount.PrimaryContact.Email;
            assetvalue.Text             = CurrentAccount.Revenue;
            txtPhone.Text               = CurrentAccount.Telephone;
            txtFax.Text                 = CurrentAccount.Fax;
            txtAddressLine1.Text        = CurrentAccount.PrimaryAddress.Line1;
            txtAddressLine2.Text        = CurrentAccount.PrimaryAddress.Line2;
            txtAddressCity.Text         = CurrentAccount.PrimaryAddress.City;
            txtAddressState.Text        = CurrentAccount.PrimaryAddress.State;
            txtAddressZip.Text          = CurrentAccount.PrimaryAddress.Zip;
            txtCommitteeMembers.Text    = CurrentAccount.CommitteeMembers;
            txtRecordKeepers.Text       = CurrentAccount.RecordKeepers;
            txtCustodians.Text          = CurrentAccount.Custodians;

            foreach (DataRow dr in ISP.Business.Entities.Plan.GetAssociatedFromAccount(accountId).Rows)
            {
                cboSelectedPlan.Items.Add(new Utilities.ListItem(dr["Name"].ToString(), dr["ID"].ToString()));
            }

            if (cboSelectedPlan.Items.Count > 0)
            {
                cboSelectedPlan.SelectedIndex = 0;
            }

            if (txtPrimaryContactName.Text == "" || txtPrimaryContactName.Text == null)
            {
                txtPrimaryContactName.Cursor = System.Windows.Forms.Cursors.Arrow;
            }

            comboBox5.Items.Clear();
            comboBox6.Items.Clear();

            comboBox5.Items.Add(new ListItem("No Instructions On File", null));
            comboBox6.Items.Add(new ListItem("No Instructions On File", null));

            foreach (DataRow dr in Benchmarks.Get().Rows)
            {
                comboBox5.Items.Add(new ListItem(dr["FundName"].ToString(), dr["FundID"].ToString()));
                comboBox6.Items.Add(new ListItem(dr["FundName"].ToString(), dr["FundID"].ToString()));
            }

            ss.Close();
            this.Show();
        }
        public frmManager(frmMain _frmMain, Guid managerId)
        {
            frmSplashScreen _frmSplashScreen = new frmSplashScreen();

            _frmSplashScreen.Show();
            Application.DoEvents();

            InitializeComponent();

            #region IMessageFilter Methods

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.pnlFormHeader);
            controlsToMove.Add(this.pnlHeader);
            controlsToMove.Add(this.lblHeader);

            #endregion

            frmMain_Parent = _frmMain;

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

            ManagerId = managerId;

            PopulateManagerCredentialsCbo();
            PopulateFundRoleCbo();
            PopulatePersonalAssetsCbo();

            tabMain.SelectedIndex = 0;

            try
            {
                Manager                  = new Manager(managerId);
                lblHeader.Text           = Manager.FullName;
                Text                     = Manager.FullName;
                txtFirstName.Text        = Manager.FirstName;
                txtMiddleName.Text       = Manager.MiddleName;
                txtLastName.Text         = Manager.LastName;
                txtBiography.Text        = Manager.Biography;
                txtResponsibilities.Text = Manager.PortfolioResponsibilities;
                txtBeganAsPm.Text        = Manager.BecamePortfolioManagerYear;
                txtBeganAsAnalyst.Text   = Manager.BecameAnalystYear;

                PopulateManagerCredentialsLst();
                PopulateManagerEducationList();

                paginationAdvisors             = new Pagination(dgvAdvisors, Advisors.GetAssociatedFromManager((Guid)managerId));
                dgvAdvisors.Columns[0].Visible = false;

                paginationFunds             = new Pagination(dgvFunds, Fund.GetAssociatedFromManager((Guid)managerId));
                dgvFunds.Columns[0].Visible = false;
                dgvFunds.Columns[1].Visible = false;
            }
            catch (Exception _exception)
            {
                frmError _frmError = new frmError(frmMain_Parent, _exception);
            }

            this.Show();
            _frmSplashScreen.Close();
        }
        public frmAdvisor(frmMain frmMain_Parent, Guid advisorId, FormClosedEventHandler Close = null)
        {
            frmSplashScreen ss = new frmSplashScreen();

            ss.Show();
            Application.DoEvents();

            InitializeComponent();
            mf_parent = frmMain_Parent;

            LoadManagementRolesCbo();

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
            this.MouseWheel += new MouseEventHandler(pnlSummary_MouseWheel);

            Application.AddMessageFilter(this);
            controlsToMove.Add(this.pnlFormHeader);
            controlsToMove.Add(this.pnlHeader);
            controlsToMove.Add(this.lblHeader);

            FormClosed           += Close;
            tabMain.SelectedIndex = 0;

            AdvisorId = advisorId;
            UserId    = frmMain_Parent.CurrentUser.UserId;

            try
            {
                UpdateResearchTypeCbo();
                LoadManagement();

                foreach (DataRow dr in ISP.Business.Entities.Advisors.GetAdvisorDetails(advisorId).Rows)
                {
                    decimal fixedIncome = -1;
                    decimal equity      = -1;
                    decimal other       = -1;

                    if (String.IsNullOrEmpty(dr["AssetsFixedIncome"].ToString()) == false)
                    {
                        Decimal.TryParse(dr["AssetsFixedIncome"].ToString(), out fixedIncome);
                    }

                    if (String.IsNullOrEmpty(dr["AssetsEquity"].ToString()) == false)
                    {
                        Decimal.TryParse(dr["AssetsEquity"].ToString(), out equity);
                    }

                    if (String.IsNullOrEmpty(dr["AssetsOther"].ToString()) == false)
                    {
                        Decimal.TryParse(dr["AssetsOther"].ToString(), out other);
                    }

                    lblHeader.Text       = dr["Name"].ToString();
                    txtName.Text         = dr["Name"].ToString();
                    Text                 = dr["Name"].ToString();
                    label1.Text          = "Investment Services Program - " + dr["Name"].ToString();
                    txtFounded.Text      = dr["CompanyFounded"].ToString();
                    txtPhilosophies.Text = dr["InvestmentPhilosophy"].ToString();
                    txtConflicts.Text    = dr["InterestConflicts"].ToString();
                    txtRights.Text       = dr["ShareHolderRights"].ToString();
                    txtCompensation.Text = dr["CompensationStructure"].ToString();
                    cboProfessional.Text = dr["IsCultureProfessional"].ToString();
                    cboTransparent.Text  = dr["IsCultureTransparent"].ToString();
                    cboMoral.Text        = dr["IsCultureMoralStandardsHigh"].ToString();
                    cboProprietary.Text  = dr["IsResearchProprietary"].ToString();
                    cboQuantitative.Text = dr["IsResearchQuantitative"].ToString();
                    cboFundamental.Text  = dr["IsResearchFundamental"].ToString();
                    cboResearchType.Text = dr["ResearchTypeIdName"].ToString();
                    txtSize.Text         = dr["StaffSize"].ToString();
                    txtCredential.Text   = dr["StaffCredentials"].ToString();
                    txtExperience.Text   = dr["StaffExperience"].ToString();
                    txtAnalystRatio.Text = dr["AnalystRatio"].ToString();

                    if (fixedIncome != -1)
                    {
                        txtFixed.Text = fixedIncome.ToString("C");
                    }

                    if (equity != -1)
                    {
                        txtEquity.Text = equity.ToString("C");
                    }

                    if (other != -1)
                    {
                        txtOther.Text = other.ToString("C");
                    }
                }
            }
            catch (Exception ex)
            {
                frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex);
            }

            dgvFunds.DataSource         = ISP.Business.Entities.Fund.GetAssociatedFromAdvisor(advisorId);
            dgvFunds.Columns[0].Visible = false;

            dgvMgrs.DataSource         = ISP.Business.Entities.Manager.GetAssociatedFromAdvisor(advisorId);
            dgvMgrs.Columns[0].Visible = false;

            this.Show();
            ss.Close();
        }