コード例 #1
0
        public ActionResult localboxView(long id)
        {
            var list = new LoggalBoxService().GetLoggalBoxList(new LOGGAL_BOX_COND {
                DEVICE_CODE = id, bWorkingTime = true
            });

            List <LOGGAL_BOX_INFO> groupList = list.Where(w => w.GROUP_SEQ != null).GroupBy(g => new { g.GROUP_SEQ, g.GROUP_NAME, g.CONTENT_TYPE, g.FRAME_TYPE, g.PLAY_TIME }).Select(s => new LOGGAL_BOX_INFO {
                GROUP_SEQ = s.Key.GROUP_SEQ, CATEGORY_NAME = s.Key.GROUP_NAME, CONTENT_TYPE = s.Key.CONTENT_TYPE, FRAME_TYPE = s.Key.FRAME_TYPE, PLAY_TIME = s.Key.PLAY_TIME
            }).ToList();


            for (int i = 0; i < groupList.Count(); i++)
            {
                groupList[i].list = list.Where(w => groupList[i].GROUP_SEQ != null && w.GROUP_SEQ == groupList[i].GROUP_SEQ).Select(s => new LOGGAL_BOX_INFO_DETAIL {
                    AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, CONTENT_URL = s.CONTENT_URL, BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, COMPANY_NAME = s.COMPANY_NAME, BOOKMARK_CNT = s.BOOKMARK_CNT, CLICK_CNT = s.CLICK_CNT
                }).ToList();
            }


            IList <LOGGAL_BOX_DATA> mobileBannerlist = list.Where(w => w.GROUP_SEQ == null).ToList();

            List <LOGGAL_BOX_INFO> BannerGroupList = new List <LOGGAL_BOX_INFO>();

            ViewBag.commonlist = new CommonService().GetCommon(new T_COMMON_COND()
            {
                ADD_COND = "AND MAIN_CODE IN ('A010','B008','H002','L003','P004')"
            }).Select(s => new { s.MAIN_CODE, s.SUB_CODE, s.NAME });

            if (mobileBannerlist.Count() > 0)
            {
                int nFrameCnt = (int)(mobileBannerlist.First().FRAME_TYPE ?? 12);
                nFrameCnt = nFrameCnt > 2 ? nFrameCnt + 2 : nFrameCnt;

                var bannergroupList = mobileBannerlist.Select(s => new {
                    s.CATEGORY_CODE
                    , s.CATEGORY_NAME
                    , s.CONTENT_TYPE, s.FRAME_TYPE, s.PLAY_TIME
                }).Distinct().ToList();
                int nGroupSeq = 1;
                foreach (var data in bannergroupList)
                {
                    int nCnt = 0;


                    var rowList = mobileBannerlist.Where(w => w.CATEGORY_NAME == data.CATEGORY_NAME && w.CONTENT_TYPE == data.CONTENT_TYPE).ToList();
                    int nTot    = rowList.Count();

                    while (true)
                    {
                        LOGGAL_BOX_INFO rowData = new LOGGAL_BOX_INFO {
                            GROUP_SEQ       = nGroupSeq
                            , CATEGORY_NAME = data.CATEGORY_NAME
                            , CONTENT_TYPE  = data.CONTENT_TYPE
                            , FRAME_TYPE    = data.FRAME_TYPE
                            , PLAY_TIME     = data.PLAY_TIME
                        };

                        //rowData.list = rowList.Skip(nCnt * FRAME_TYPE).Take(FRAME_TYPE).Select(s => new LOGGAL_BOX_INFO_DETAIL { BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, COMPANY_NAME = s.COMPANY_NAME + " " + (s.DISTANCE == 0 ? "" : Convert.ToDouble((double)s.DISTANCE / (double)1000.00).ToString("#,##0.00") + "km"), CONTENT_URL = s.CONTENT_URL }).ToList();
                        rowData.list = rowList.Skip(nCnt * nFrameCnt).Take(nFrameCnt).Select(s => new LOGGAL_BOX_INFO_DETAIL {
                            BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, COMPANY_NAME = s.COMPANY_NAME, CONTENT_URL = s.CONTENT_URL, CLICK_CNT = s.CLICK_CNT, BOOKMARK_CNT = s.BOOKMARK_CNT, FAVORITE_CNT = s.FAVORITE_CNT
                        }).ToList();

                        BannerGroupList.Add(rowData);
                        nCnt++;
                        rowData.SEQ = nCnt;
                        nGroupSeq++;
                        if (nTot <= nCnt * nFrameCnt)
                        {
                            break;
                        }
                    }
                }
            }

            T_DEVICE device = new DeviceService().GetDeviceList(new T_DEVICE_COND {
                DEVICE_CODE = id
            }).FirstOrDefault();

            ViewBag.device          = device;
            ViewBag.GroupList       = groupList;
            ViewBag.BannerGroupList = BannerGroupList;

            string viewName = "/Views/device/partial/localboxleftMenu.cshtml";

            ViewBag.leftMenu = GlobalMvc.Common.RenderPartialViewToString(this, viewName, new { });

            SessionHelper.PAGE_WAITING_TIME = device.PAGE_WAITING_TIME.ToString("60");

            return(View());
        }
コード例 #2
0
        public ActionResult localboxView(long id)
        {
            var list = new LoggalBoxService().GetLoggalBoxList2(new LOGGAL_BOX_COND2 {
                GUBUN = 1, DEVICE_CODE = id, bWorkingTime = true, HOST = GlobalMvc.Host, STATUS = 9
            });

            List <LOGGAL_BOX_INFO> groupList = list.Where(w => w.CATEGORY_CODE == 6336).GroupBy(g => new { g.GROUP_SEQ, g.CATEGORY_CODE, g.CATEGORY_NAME, g.BANNER_TYPE2, g.AD_FRAME_TYPE, g.AD_CYCLE_TIME }).Select(s => new LOGGAL_BOX_INFO {
                GROUP_SEQ = s.Key.GROUP_SEQ, CATEGORY_CODE = s.Key.CATEGORY_CODE, CATEGORY_NAME = (s.Key.AD_FRAME_TYPE == 1 ? s.Max(s1 => s1.TITLE) : s.Key.CATEGORY_NAME), BANNER_TYPE2 = s.Key.BANNER_TYPE2, FRAME_TYPE = s.Key.AD_FRAME_TYPE, PLAY_TIME = s.Key.AD_CYCLE_TIME
            }).ToList();

            if (groupList.Count() > 0)
            {
                int nMyBannerGroup = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(groupList.Count()) / Convert.ToDecimal(groupList.First().FRAME_TYPE)));

                for (int i = 0; i < groupList.Count(); i++)
                {
                    groupList[i].list = list.Where(w => groupList[i].GROUP_SEQ == w.GROUP_SEQ && w.CATEGORY_CODE == groupList[i].CATEGORY_CODE).Select(s => new LOGGAL_BOX_INFO_DETAIL {
                        AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, BANNER_IMAGE = s.BANNER_IMAGE, CONTENT_URL = s.CONTENT_URL, BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, COMPANY_NAME = s.STORE_NAME, BOOKMARK_CNT = s.BOOKMARK_CNT, CLICK_CNT = s.CLICK_CNT
                    }).ToList();
                }
            }


            IList <LOGGAL_BOX_DATA2> mobileBannerlist = list.Where(w => w.CATEGORY_CODE != 6336).ToList();

            List <LOGGAL_BOX_INFO> BannerGroupList = new List <LOGGAL_BOX_INFO>();

            ViewBag.commonlist = new CommonService().GetCommon(new T_COMMON_COND()
            {
                ADD_COND = "AND MAIN_CODE IN ('A010','B008','H002','L003','P004')"
            }).Select(s => new { s.MAIN_CODE, s.SUB_CODE, s.NAME });

            if (mobileBannerlist.Count() > 0)
            {
                int nFrameCnt = mobileBannerlist.First().AD_FRAME_TYPE;
                nFrameCnt = nFrameCnt > 2 ? nFrameCnt + 2 : nFrameCnt;

                var bannergroupList = mobileBannerlist.Select(s => new {
                    CATEGORY_CODE   = s.CATEGORY_CODE
                    , CATEGORY_NAME = s.CATEGORY_NAME
                    , BANNER_TYPE2  = s.BANNER_TYPE2
                    , AD_FRAME_TYPE = s.AD_FRAME_TYPE
                    , PLAY_TIME     = s.AD_CYCLE_TIME
                }).Distinct().ToList();
                int nGroupSeq = 1;
                foreach (var data in bannergroupList)
                {
                    int nCnt = 0;


                    var rowList = mobileBannerlist.Where(w => w.CATEGORY_NAME == data.CATEGORY_NAME && w.BANNER_TYPE2 == data.BANNER_TYPE2).ToList();
                    int nTot    = rowList.Count();

                    while (true)
                    {
                        LOGGAL_BOX_INFO rowData = new LOGGAL_BOX_INFO
                        {
                            GROUP_SEQ     = nGroupSeq,
                            CATEGORY_NAME = data.CATEGORY_NAME,
                            BANNER_TYPE2  = data.BANNER_TYPE2,
                            FRAME_TYPE    = data.AD_FRAME_TYPE,
                            PLAY_TIME     = data.PLAY_TIME
                        };

                        //rowData.list = rowList.Skip(nCnt * FRAME_TYPE).Take(FRAME_TYPE).Select(s => new LOGGAL_BOX_INFO_DETAIL { BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, COMPANY_NAME = s.COMPANY_NAME + " " + (s.DISTANCE == 0 ? "" : Convert.ToDouble((double)s.DISTANCE / (double)1000.00).ToString("#,##0.00") + "km"), CONTENT_URL = s.CONTENT_URL }).ToList();
                        rowData.list = rowList.Skip(nCnt * nFrameCnt).Take(nFrameCnt).Select(s => new LOGGAL_BOX_INFO_DETAIL {
                            BANNER_TYPE = s.BANNER_TYPE, TITLE = s.TITLE, SUB_TITLE = s.SUB_TITLE, AD_CODE = s.AD_CODE, LOGO_URL = s.LOGO_URL, BANNER_IMAGE = s.BANNER_IMAGE, COMPANY_NAME = s.STORE_NAME, CONTENT_URL = s.CONTENT_URL, CLICK_CNT = s.CLICK_CNT, BOOKMARK_CNT = s.BOOKMARK_CNT, FAVORITE_CNT = s.FAVORITE_CNT
                        }).ToList();

                        BannerGroupList.Add(rowData);
                        nCnt++;
                        rowData.SEQ = nCnt;
                        nGroupSeq++;
                        if (nTot <= nCnt * nFrameCnt)
                        {
                            break;
                        }
                    }
                }
            }


            var devicedata = list.First();

            ViewBag.device = list.Count() > 0 ? new T_DEVICE()
            {
                DEVICE_CODE       = devicedata.DEVICE_CODE
                , DEVICE_NAME     = devicedata.DEVICE_NAME
                , AD_CYCLE_TIME   = devicedata.AD_CYCLE_TIME
                , DATA_CYCLE_TIME = devicedata.DATA_CYCLE_TIME
                , AD_FRAME_TYPE   = devicedata.AD_FRAME_TYPE
            } : new T_DEVICE();
            ViewBag.GroupList       = groupList;
            ViewBag.BannerGroupList = BannerGroupList;

            string viewName = "/Views/device/partial/localboxleftMenu.cshtml";

            ViewBag.leftMenu = GlobalMvc.Common.RenderPartialViewToString(this, viewName, new { });

            SessionHelper.PAGE_WAITING_TIME = devicedata.PAGE_WAITING_TIME.ToString("60");

            return(View());
        }