private void btnSaveCurrentStatusToGoal_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbCurrentStsatusToGoal.Text) || string.IsNullOrEmpty(txtFundAllocation.Text)) { MessageBox.Show("Please enter goal and fund allocation value.", "Validate Data", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal currStatusToGoal = getCurrentStatusToGoalData(); var goal = _currentStatusToGoal.FirstOrDefault(i => i.GoalId == int.Parse(cmbCurrentStsatusToGoal.Tag.ToString())); bool isSaved = false; if (goal == null) { isSaved = new CurrentStatusInfo().AddCurrentStatuToGoal(currStatusToGoal); } else { isSaved = new CurrentStatusInfo().UpdateCurrentStatuToGoal(currStatusToGoal); } if (isSaved) { MessageBox.Show("Record save successfully.", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); _currentStatusToGoal.Add(currStatusToGoal); fillCurrentStatusToGoalData(); cmbCurrentStsatusToGoal.Enabled = false; txtFundAllocation.Enabled = false; } else { MessageBox.Show("Unable to save record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDeleteCurrentStatusToGoal_Click(object sender, EventArgs e) { if (dtGridCurrentStatusToGoal.SelectedRows.Count > 0) { if (MessageBox.Show("Are you sure, you want to delete this record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal currStatusToGoal = getCurrentStatusToGoalData(); bool isResult = new CurrentStatusInfo().DeleteCurrentStatusToGoal(currStatusToGoal); fillCurrentStatusToGoalData(); } } }
internal double GetProfileValue() { IList <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal> currentStatusToGoals = new CurrentStatusInfo().GetCurrentStatusToGoal(_optionId); _dtcurrentStatusToGoal = ListtoDataTable.ToDataTable(currentStatusToGoals.ToList()); DataRow[] dr = _dtcurrentStatusToGoal.Select(string.Format("GoalName = '{0}'", _goal.Name)); if (dr != null && dr.Count() > 0) { return((string.IsNullOrEmpty(dr[0]["FundAllocation"].ToString())) ? 0 : double.Parse(dr[0]["FundAllocation"].ToString())); } return(0); }