コード例 #1
0
 public static List <AccountValueViewModel> GetAccountValues(long chartId, long sobId, string segment, int segmentNo, bool fetchSaved)
 {
     return(service.GetAccountValuesBySegment(chartId, sobId, segment, segmentNo, fetchSaved).Select(x => new AccountValueViewModel(x)).ToList());
 }
コード例 #2
0
        private List <Segment> getSegmentList(long sobId)
        {
            List <Segment> segmentList = new List <Segment>();
            Account        account     = accountService.GetAccountBySOBId(sobId.ToString(), AuthenticationHelper.User.CompanyId);

            if (account != null)
            {
                if (account.SegmentEnabled1 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 1,
                        SegmentName      = account.SegmentName1,
                        SegmentValueList = accountValueService.GetAccountValuesBySegment(account.SegmentName1, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled2 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 2,
                        SegmentName      = account.SegmentName2,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName2, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled3 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 3,
                        SegmentName      = account.SegmentName3,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName3, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled4 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 4,
                        SegmentName      = account.SegmentName4,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName4, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled5 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 5,
                        SegmentName      = account.SegmentName5,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName5, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled6 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 6,
                        SegmentName      = account.SegmentName6,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName6, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled7 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 7,
                        SegmentName      = account.SegmentName7,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName7, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }

                if (account.SegmentEnabled8 == true)
                {
                    segmentList.Add(new Segment
                    {
                        SegmentCount     = 8,
                        SegmentName      = account.SegmentName8,
                        SegmentValueList = accountValueService
                                           .GetAccountValuesBySegment(account.SegmentName8, account.Id)
                                           .Select(x => new SelectListItem
                        {
                            Value = x.Value,
                            Text  = x.Value
                        }).ToList()
                    });
                }
            }

            return(segmentList);
        }