Beispiel #1
0
        public string returnUrl()
        {
            CacheData cached_data = new CacheData(_context, true);

            //too soon
            DataTable tab_link = (DataTable)_context.Cache[GlobalConst.LISTADS];

            DataRow[] rows = tab_link.Select("IDContent=" + _ContentID+" AND IDSubPage="+getIDSubPage());

            if (rows.Length == 1)
            {
                IDSubSchedule = rows[0]["ID"].ToString();
                IDSubPage = rows[0]["IDSubPage"].ToString();
                WriteMQ(IDSubSchedule, IDSubPage);
                return rows[0]["HyperLink"].ToString();
            }
            else
                return "http://tuoitre.vn";
        }
Beispiel #2
0
        public string Export()
        {
            List<string[]> ListSchedules = new List<string[]>();
            List<string[]> ListJS = new List<string[]>();

            CacheData cached_data = new CacheData(_Context, true);
            if (!cached_data.Status)
            {
                return "/* " + cached_data.CacheStatus + " */";
            }
            else
            {
                PreData pre_data = new PreData(_Context);
                pre_data.Key = _Key;
                pre_data.ExtKey = _Ext;
                pre_data.Url = _Url;
                pre_data.ListPosition = _ListPosition;

                if (pre_data.RunExcute())
                {
                    ListSchedules = pre_data.ListAdsScheduleIDs;
                    ListJS = pre_data.ListJS;

                    //packing code ads inclue create js_first_load and js_next_load
                    PackingCode packing = new PackingCode(_Context, _Ext, _Url, ListSchedules, ListJS);

                    packing.RunPacking();

                    List<string> _scriptJS = packing.scriptJS;
                    List<string> _scriptBanner = packing.scriptBanner;
                    if (packing.isBarronet)
                    {
                        if (!string.IsNullOrEmpty(lib_baronet_path))
                        {
                            _scriptBanner.Add("document.writeln('<scri'+'pt type=\"text/javascript\" src=\"" + lib_baronet_path + "\"></scri'+'pt>');");
                            _scriptBanner.Add("document.writeln('<scri'+'pt type=\"text/javascript\">document.body.onresize = fixAdFloating;fixAdFloating();</scri'+'pt>');");
                        }
                    }

                    string firstLoad = ListToString(_scriptJS);
                    string buffer = ListToString(_scriptBanner);

                    // cache next script
                    string cachename = Guid.NewGuid().ToString();
                    string wf = IO.WriteJsTemp(cachename, buffer);

                    string next_link_script = create_link_next_script(cachename);

                    string output = "";
                    if (!string.IsNullOrEmpty(js_support_path))
                    {
                        output = "document.writeln('<scri'+'pt type=\"text/javascript\" src=\"" + js_support_path + "\"></scri'+'pt>');";
                        output += firstLoad + "\t\n";
                        output += next_link_script;
                        if (!string.IsNullOrEmpty(wf))
                        {
                            output += "//" + wf;
                        }
                    }
                    else
                    {
                        output = firstLoad + "\t\n" + next_link_script + "\t\n";
                    }
                    if (ConfigurationManager.AppSettings["ViewJS"] == "True")
                        output += "/* " + buffer + " */";
                    return output + "/* " + cached_data.CacheStatus + " */";
                }
                else
                    return "";
            }
        }
Beispiel #3
0
        public string Single()
        {
            CacheData cached_data = new CacheData(_Context, true);
            List<string[]> ListSchedules = new List<string[]>();
            if (!cached_data.Status)
            {
                return "/* " + cached_data.CacheStatus + " */";
            }
            else
            {
                SingleData singledata = new SingleData(_Context);
                singledata.Key = _Key;
                singledata.ExtKey = _Ext;
                singledata.Url = _Url;
                singledata.RunExcute();

                ListSchedules = singledata.ListAdsScheduleIDs;

                PackingSingleCode psc = new PackingSingleCode(_Context, _Ext, _Url, ListSchedules, null);
                psc.RunPacking();

                if (psc.result.Count == 0)
                    return "";

                List<string> _result = psc.result;

                string adscript = div(ListToString(_result));

                if (psc.isBarronet)
                    if (!string.IsNullOrEmpty(lib_baronet_path))
                    {
                       adscript += "document.writeln('<scri'+'pt type=\"text/javascript\" src=\"" + lib_baronet_path + "\"></scri'+'pt>');\t\n";
                       adscript +="document.writeln('<scri'+'pt type=\"text/javascript\">document.body.onresize = fixAdFloating;fixAdFloating();</scri'+'pt>');\t\n";
                    }
                return adscript;
            }
        }