/// <summary> /// /// </summary> /// <param name="mf"></param> /// <param name="accountId"></param> /// <param name="Close"></param> public frmPlanContribution(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; CurrentPlanContribution = new PlanContribution(); CurrentPlanContribution.PlanId = plan.PlanId; txtPlan.Text = plan.Name; CurrentTabLabel = label46; // Summary tab label highlightSelectedTabLabel(CurrentTabLabel); ss.Close(); this.Show(); }
private void dgvContributions_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int index = dgvContributions.CurrentRow.Index; Guid id = new Guid(dgvContributions.Rows[index].Cells["PlanContributionId"].Value.ToString()); PlanContribution obj = new PlanContribution(id); frmPlanContribution frmPlanContribution = new frmPlanContribution(frmMain_Parent, obj); frmPlanContribution.FormClosed += frmPlanContribution_FormClosed; }
public void LoadPlanContributions(Guid planId) { DataTable dataTable = PlanContribution.GetAssociated(planId); foreach (DataRow dr in dataTable.Rows) { var planContributionId = new Guid(dr["PlanContributionId"].ToString()); var planContribution = new PlanContribution(planContributionId); var dateDiffMonths = ((DateTime.Now.Year - planContribution.AsOfDate.Year) * 12) + DateTime.Now.Month - planContribution.AsOfDate.Month; if (dateDiffMonths <= 12 * 3 && dateDiffMonths >= 0) { PlanContributions.Add(planContribution); } } }
private void btnDeleteContribution_Click(object sender, EventArgs e) { if (dgvContributions.CurrentRow == null) { return; } int index = dgvContributions.CurrentRow.Index; Guid id = new Guid(dgvContributions.Rows[index].Cells["PlanContributionId"].Value.ToString()); PlanContribution obj = new PlanContribution(id); DialogResult result = MessageBox.Show("Are you sure you wish to delete contribution on " + obj.AsOfDate.ToString("MM/dd/yyyy") + "?", "Attention", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { obj.DeleteRecordFromDatabase(); LoadDgvContributions(); } }
/// <summary> /// /// </summary> /// <param name="mf"></param> /// <param name="accountId"></param> /// <param name="Close"></param> public frmPlanContribution(frmMain mf, PlanContribution planContribution, 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(planContribution.PlanId); CurrentPlanContribution = planContribution; txtPlan.Text = plan.Name; if (CurrentPlanContribution.Contribution != null) { txtContribution.Text = ((decimal)CurrentPlanContribution.Contribution).ToString("#,##"); } if (CurrentPlanContribution.AsOfDate != null) { txtAsOfDate.Text = ((DateTime)CurrentPlanContribution.AsOfDate).ToString("MM/dd/yyyy"); } CurrentTabLabel = label46; // Summary tab label highlightSelectedTabLabel(CurrentTabLabel); ss.Close(); this.Show(); }