private DataSet GetData() { Facade.IOrganisation facOrganisation = new Facade.Organisation(); Func <DateTime, string> dateFormatter; DataSet dataSet; int clientId = (string.IsNullOrEmpty(cboClient.SelectedValue)) ? -1 : int.Parse(cboClient.SelectedValue); switch (DateRange) { case ClientRevenueDateRange.Year: dateFormatter = (dateTime) => string.Format("{0} {1}", dateTime.ToString("MMM"), dateTime.Year); dataSet = facOrganisation.GetClientWorkPerMonthReport(this.StartDate, this.EndDate, true, true, dateFormatter, clientId); break; case ClientRevenueDateRange.Month: dateFormatter = (dateTime) => dateTime.ToString("M"); dataSet = facOrganisation.GetClientWorkPerDayReport(this.StartDate, this.EndDate, true, true, dateFormatter, clientId); break; case ClientRevenueDateRange.Week: dateFormatter = (dateTime) => dateTime.DayOfWeek.ToString(); dataSet = facOrganisation.GetClientWorkPerDayReport(this.StartDate, this.EndDate, true, true, dateFormatter, clientId); break; case ClientRevenueDateRange.Day: dateFormatter = (dateTime) => "Yesterday"; dataSet = facOrganisation.GetClientWorkPerDayReport(this.StartDate, this.EndDate, true, true, dateFormatter, clientId); var columnToRemove = dataSet.Tables[0].Columns.Cast <DataColumn>().Single(c => c.ColumnName == "Yesterday"); dataSet.Tables[0].Columns.Remove(columnToRemove); break; default: dateFormatter = (dateTime) => string.Format("{0} {1}", dateTime.ToString("MMM"), dateTime.Year); dataSet = facOrganisation.GetClientWorkPerMonthReport(this.StartDate, this.EndDate, true, true, dateFormatter, clientId); break; } return(dataSet); }