private void AddButton_Click(object sender, EventArgs e) { var statementForm = new NewStatement(); if (statementForm.ShowDialog() != DialogResult.OK) { return; } if (FundAllocation.MonthlyAllocations.Find(r => r.ViewName == statementForm.MonthlyAllocation.ViewName) == null) { foreach (Statement statement in statementForm.MonthlyAllocation.Statements) { statement.Month = statementForm.MonthlyAllocation.Month; statement.Year = statementForm.MonthlyAllocation.Year; } FundAllocation.MonthlyAllocations.Add(statementForm.MonthlyAllocation); //Log log = new Log //{ // Message = statementForm.MonthlyAllocation.ViewName + @" was added by" + @" Super User",//TODO change with valid user later // LogObject = Factory<MonthlyAllocation>.ToJson(statementForm.MonthlyAllocation) //}; //FundAllocation.AllocationLog.Push(log); UpdateView(); } else { MessageBox.Show(@"Already exists", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
public string Generate(NewStatement newStatement) { return(String.Format("new {0}", _statementGenerator.Generate(newStatement.Statement))); }