private List <ToplineViewModel> BindToplinesViewModel(List <BPSR_Topline> toplines, DateTime dueDate, string approverName, bool isAdmin, bool isApprover) { var results = new List <ToplineViewModel>(); foreach (var t in toplines) { var item = new ToplineViewModel() { ToplineId = t.BPSR_ToplineID, StoreId = t.LocalStoreID, Status = FormatHelpers.FormatStatus(t.BPSR_StatusID), PeriodEndDate = FormatHelpers.FormatPeriodDate(t.PeriodEndDate), NetSales = FormatHelpers.FormatMoney(t.NetSales), FranCalcRoyalty = FormatHelpers.FormatMoney(t.FranCalcRoyalty), FranCalcAdvertising = FormatHelpers.FormatMoney(t.FranCalcAdvertising), TotalTickets = FormatHelpers.FormatNumber(t.TotalTickets), SalesTypeCode = FormatHelpers.FormatSalesType(t.SalesTypeID), //t.SalesType.SalesTypeCode, //FormatSalesType IsPastDue = this.IsPastDue(dueDate, t.PeriodEndDate), //CanEdit = this.CanEditTopline(t.BPSR_StatusID, isAdmin, isApprover), //CanApprove = this.CanApproveTopline(t.BPSR_StatusID, isAdmin, isApprover), //CanSubmit = this.CanSubmitTopline(t.BPSR_StatusID, isAdmin, isApprover) CanEdit = this.CanEditTopline(t.BPSR_StatusID, isAdmin, isApprover), CanApprove = this.CanApproveTopline(t.BPSR_StatusID, isAdmin, isApprover), CanSubmit = this.CanSubmitTopline(t.BPSR_StatusID, t.SubmitterName, approverName, isAdmin, isApprover) }; results.Add(item); } return(results); }