/// <summary>
        ///
        /// </summary>
        /// <param name="mf"></param>
        /// <param name="accountId"></param>
        /// <param name="Close"></param>
        public frmPlanDistribution(frmMain mf, Plan plan, 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.pnlSummaryTabHeader);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.label1);
            controlsToMove.Add(this.label23);

            FormClosed += Close;

            CurrentPlanDistribution        = new PlanDistribution();
            CurrentPlanDistribution.PlanId = plan.PlanId;

            txtPlan.Text = plan.Name;

            ss.Close();
            this.Show();
        }
        private void dgvDistributions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int                 index = dgvDistributions.CurrentRow.Index;
            Guid                id    = new Guid(dgvDistributions.Rows[index].Cells["PlanDistributionId"].Value.ToString());
            PlanDistribution    obj   = new PlanDistribution(id);
            frmPlanDistribution frmPlanDistribution = new frmPlanDistribution(frmMain_Parent, obj);

            frmPlanDistribution.FormClosed += frmPlanDistribution_FormClosed;
        }
Example #3
0
    public void LoadPlanDistributions(Guid planId)
    {
        DataTable dataTable = PlanDistribution.GetAssociated(planId);

        foreach (DataRow dr in dataTable.Rows)
        {
            var planDistributionId = new Guid(dr["PlanDistributionId"].ToString());
            var planDistribution   = new PlanDistribution(planDistributionId);
            var dateDiffMonths     = ((DateTime.Now.Year - planDistribution.AsOfDate.Year) * 12) + DateTime.Now.Month - planDistribution.AsOfDate.Month;
            if (dateDiffMonths <= 12 * 3 && dateDiffMonths >= 0)
            {
                PlanDistributions.Add(planDistribution);
            }
        }
    }
        private void btnDeleteDistribution_Click(object sender, EventArgs e)
        {
            if (dgvDistributions.CurrentRow == null)
            {
                return;
            }

            int              index = dgvDistributions.CurrentRow.Index;
            Guid             id    = new Guid(dgvDistributions.Rows[index].Cells["PlanDistributionId"].Value.ToString());
            PlanDistribution obj   = new PlanDistribution(id);

            DialogResult result = MessageBox.Show("Are you sure you wish to delete distribution on " + obj.AsOfDate.ToString("MM/dd/yyyy") + "?", "Attention", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                obj.DeleteRecordFromDatabase();
                LoadDgvDistributions();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mf"></param>
        /// <param name="accountId"></param>
        /// <param name="Close"></param>
        public frmPlanDistribution(frmMain mf, PlanDistribution planDistribution, 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.pnlSummaryTabHeader);
            controlsToMove.Add(this.panel16);
            controlsToMove.Add(this.label1);
            controlsToMove.Add(this.label23);

            FormClosed += Close;

            Plan plan = new Plan(planDistribution.PlanId);

            CurrentPlanDistribution = planDistribution;
            txtPlan.Text            = plan.Name;

            if (CurrentPlanDistribution.Distribution != null)
            {
                txtDistribution.Text = ((decimal)CurrentPlanDistribution.Distribution).ToString("#,##");
            }

            if (CurrentPlanDistribution.AsOfDate != null)
            {
                txtAsOfDate.Text = ((DateTime)CurrentPlanDistribution.AsOfDate).ToString("MM/dd/yyyy");
            }

            CurrentTabLabel = label46; // Summary tab label
            highlightSelectedTabLabel(CurrentTabLabel);

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