public DTO.SearchFormData GetAccPerformance(int saleId, out Library.DTO.Notification notification) { DTO.SearchFormData Data = new DTO.SearchFormData(); Data.AccManagerPerformanceDTOs = new List <DTO.AccManagerPerformanceDTO>(); Data.AccManagerPerformanceDeltaDTOs = new List <DTO.AccManagerPerformanceDeltaDTO>(); notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Success }; try { using (AccManagerPerformanceRptEntities context = CreateContext()) { Data.AccManagerPerformanceDTOs = converter.DB2DTO_AccManagerPerformance(context.AccManagerPerformanceRpt_function_GetReportData(saleId).ToList()); if (saleId == -1) { Data.AccManagerPerformanceDeltaDTOs = converter.DB2DTO_AccManagerPerformanceDelta(context.AccManagerPerformanceRpt_function_GetDeltaData().ToList()); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.HandleExceptionSingleLine(ex); } return(Data); }
// // CUSTOM FUNCTION HERE // public DTO.SupportFormData GetInitData(int userId, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Success }; DTO.SupportFormData data = new DTO.SupportFormData(); data.SaleDTOs = new List <DTO.SaleDTO>(); try { using (AccManagerPerformanceRptEntities context = CreateContext()) { if (fwFactory.HasSpecialPermission(userId, Module.Framework.ConstantIdentifier.SPECIAL_PERMISSION_VIEW_ALL_SALES_DATA)) { data.SaleDTOs.Add(new DTO.SaleDTO { UserID = -1, EmployeeNM = "All Account Manager" }); data.SaleDTOs.AddRange(converter.DB2DTO_Sale(context.SupportMng_ActiveSales_View.ToList())); } else { data.SaleDTOs = converter.DB2DTO_Sale(context.SupportMng_ActiveSales_View.Where(o => o.UserID == userId).ToList()); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.HandleExceptionSingleLine(ex); } return(data); }