public ActionResult Content(long id, long?deviceCode = null, int bannerKind = 2)
        {
            T_AD dataSel = new AdvertisingService().GetT_AD_List(id).FirstOrDefault();
            // Task.Run(() => { new AdvertisingService().AdContentClickSave(new LOGGAL_AD_COND { AD_CODE = id, DEVICE_CODE = deviceCode }); });
            //new AdvertisingService().AdContentClickSave(new LOGGAL_AD_COND { AD_CODE = id, DEVICE_CODE = deviceCode });

            /* T_AD_PLAY_LOG param = new T_AD_PLAY_LOG()
             * {
             *   DEVICE_CODE = deviceCode, AD_CODE = id
             *   , DEVICE_KIND = (deviceCode == null ? 1 : 2)
             *   , FRAME_TYPE = 1
             *   , PLAY_TYPE = 2
             *   , REMARK = ""
             *   , INSERT_CODE = 0
             *
             * };
             * RTN_SAVE_DATA data = new AdvertisingService().AdPlayLogSave(param);*/
            string deviceName = "";

            if (deviceCode != null)
            {
                var device = new LoggalBoxService().GetLoggalBoxList(new LOGGAL_BOX_COND {
                    DEVICE_CODE = deviceCode
                }).FirstOrDefault();
                deviceName = device == null? "" : device.DEVICE_NAME;
            }

            T_AD_PLAY_LOG_MONGO param = new T_AD_PLAY_LOG_MONGO()
            {
                DEVICE_CODE       = deviceCode,
                DEVICE_NAME       = deviceName,
                AD_CODE           = id,
                TITLE             = dataSel.TITLE,
                DEVICE_KIND       = (deviceCode == null ? 1 : 2),
                DEVICE_KIND_NAME  = (deviceCode == null ? "모바일" : "로컬박스"),
                FRAME_TYPE        = 1,
                FRAME_TYPE_NAME   = "1 Frame",
                BANNER_TYPE2      = 1,
                BANNER_TYPE2_NAME = "이미지",
                BANNER_KIND       = bannerKind,
                BANNER_KIND_NAME  = bannerKind == 1 ? "내배너" :"일반배너",
                PLAY_TYPE         = 2,
                PLAY_TYPE_NAME    = "클릭",
                PLAY_TIME         = 30,
                REMARK            = ""
            };

            Task.Run(async() =>
            {
                //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 });
                new MongoDBService().AdPlayLogSave(param);
                await Task.FromResult(false);
            });
            ViewBag.data       = dataSel;
            ViewBag.deviceCode = deviceCode;
            return(View());
        }
        public JsonResult adPlaylogSave(T_AD_PLAY_LOG_MONGO param, string AD_CODES, string AD_TITLES)
        {
            //logger.Debug("adPlaylogSave after =>" + base.GetParameter());


            //RTN_SAVE_DATA data = new AdvertisingService().AdPlayLogSave(param);
            RTN_SAVE_DATA data = new MongoDBService().AdPlayLogSave(param, AD_CODES, AD_TITLES);

            //logger.Debug("adPlaylogSave after =>" + base.GetParameter());
            return(new JsonResult {
                Data = data
            });
        }
        public RTN_SAVE_DATA AdPlayLogSave(T_AD_PLAY_LOG_MONGO Param, string AD_CODES = null, string AD_TITLES = null)
        {
            RTN_SAVE_DATA rtn = new RTN_SAVE_DATA();

            try
            {
                //logger.Debug("AdPlayLogSave >> ");
                var collection = database.GetCollection <BsonDocument>("adPlayLog");
                //logger.Debug("AdPlayLogSave >> 1");
                Param.REG_DATE = DateTime.Now;
                Param.REG_DAY  = Param.REG_DATE.ToString("yyyyMMdd");


                if (string.IsNullOrEmpty(AD_CODES))
                {
                    //  logger.Debug("AdPlayLogSave >> InsertOne");
                    collection.InsertOne(Param.ToBsonDocument());
                }
                else
                {
                    String[] arrAdCode  = AD_CODES.Split('|');
                    String[] arrAdTitle = AD_TITLES.Split('|');

                    List <BsonDocument> saveList = new List <BsonDocument>();
                    for (var i = 0; i < arrAdCode.Length; i++)
                    {
                        T_AD_PLAY_LOG_MONGO data = new T_AD_PLAY_LOG_MONGO();
                        data         = Param;
                        data.AD_CODE = Convert.ToInt64(arrAdCode[i]);
                        data.TITLE   = arrAdTitle[i];
                        saveList.Add(data.ToBsonDocument());
                    }
                    //logger.Debug("AdPlayLogSave >> InsertMany");
                    collection.InsertMany(saveList);
                }
            }
            catch (Exception ex) {
                rtn.ERROR_MESSAGE = ex.Message;
                logger.Debug("AdPlayLogSave >> " + ex.Message);
            }
            return(rtn);
        }