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();
         }
     }
 }
 private FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal getCurrentStatusToGoalData()
 {
     FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal currStatusToGoal =
         new FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal();
     currStatusToGoal.PlannerId         = _planeId;
     currStatusToGoal.OptionId          = int.Parse(cmbPlanOption.Tag.ToString());
     currStatusToGoal.GoalId            = int.Parse(cmbCurrentStsatusToGoal.Tag.ToString());
     currStatusToGoal.FundAllocation    = double.Parse(txtFundAllocation.Text);
     currStatusToGoal.CreatedOn         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
     currStatusToGoal.CreatedBy         = Program.CurrentUser.Id;
     currStatusToGoal.UpdatedOn         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
     currStatusToGoal.UpdatedBy         = Program.CurrentUser.Id;
     currStatusToGoal.UpdatedByUserName = Program.CurrentUser.UserName;
     currStatusToGoal.MachineName       = System.Environment.MachineName;
     return(currStatusToGoal);
 }