Ejemplo n.º 1
0
        // GET: api/cache/5
        public string Get(int id)
        {
            HttpContext oc = HttpContext.Current;

            if (id == 33197000)
            {
                IDictionaryEnumerator en = oc.Cache.GetEnumerator();

                //string strResult;
                while (en.MoveNext())
                {
                    cacheManager.RemoveFromCache(en.Key.ToString());
                }


                return("Cache removed");
            }
            else if (id == 791975)
            {
                var             x = SettingsCache.GetProvider(1003);
                int             y = SettingsCache.getGeoX(1005, "US", 1003);
                int             c = SettingsCache.getRealPageID(5010, 1003);
                int             d = SettingsCache.getPageByGEO(1000, 1005, "US");
                pixLandingPages f = SettingsCache.GetPage(5502);
                return("Cache populated ");
            }
            else
            {
                log.Fatal("Someone is trying to delete application cache with no proper key");
            }

            return("mmmmm");
        }
Ejemplo n.º 2
0
        protected void btnPopulate_Click(object sender, EventArgs e)
        {
            var x = SettingsCache.GetProvider(1003);
            int y = SettingsCache.getGeoX(1005, "US", 1003);
            int c = SettingsCache.getRealPageID(5010, 1003);
            // pixLandingPagesByGEO d = SettingsCache.GetPageByGEO(5011, "US");
            pixLandingPages f = SettingsCache.GetPage(5502);

            lblStatus.Text = "Done - " + System.DateTime.Today.ToLongTimeString();
        }
Ejemplo n.º 3
0
        protected void Button3_Click1(object sender, EventArgs e)
        {
            int i = SettingsCache.getGeoX(Convert.ToInt16(txtPageID.Text), txtCountryCode.Text, Convert.ToInt16(txtProviderID.Text));

            lblResponseX.Text = i.ToString();
        }
Ejemplo n.º 4
0
        //this prosudere will determine if we need to send pixel accoording to provider data from database
        private Boolean  blnSendPixel()
        {
            //building application counter name for each provider to count number of responses

            string appKey = string.Empty;
            int    responseCounterValue, SendResponseEvery;

            //int rFactor = 1;
            string _countryCode = tmpRequest.countryCode;
            int    _pageid      = tmpRequest.pageid;
            int    _providerid  = tmpRequest.providerid;
            bool   retVal       = false;

            //how often should we send responses to this provider
            SendResponseEvery = tmpProvider.sendResponseEvery;



            // try to get a specific X for this page, if it does not exist it will retur -1 and we will get back to the default
            int i = SettingsCache.getGeoX(_pageid, _countryCode, _providerid);

            if (i > -1)
            {
                appKey            = "provider_" + tmpRequest.providerid.ToString() + "_page_" + _pageid.ToString() + "_" + _countryCode + "_RC";
                SendResponseEvery = i;
            }
            else
            {
                appKey = "provider_" + tmpRequest.providerid.ToString() + "_RC";
            }

            responseCounterValue = 0;


            if (SendResponseEvery != 1) // if we need to send each time there is not use to check.
            {
                try
                {
                    //Get the current X from database and
                    var oVar_responseCounterValue = new SqlParameter("@retval", SqlDbType.Int);
                    oVar_responseCounterValue.Direction = ParameterDirection.Output;
                    oVar_responseCounterValue.Size      = 3;

                    var s = PetaPoco.Sql.Builder.Append(";EXEC SP_InstallX @0, @1 OUTPUT", appKey, oVar_responseCounterValue);
                    new PetaPoco.Database("myConnectionString").Execute(s);
                    responseCounterValue = Convert.ToInt32(oVar_responseCounterValue.Value);
                    log.Info("appKey: " + appKey + " = " + responseCounterValue.ToString());
                }
                catch (Exception e)
                {
                    log.Fatal("Erorr executing SP_InstallX for: " + appKey, e);
                    return(true);
                }

                //R_FACTOR: should add that SendResponseEvery = SendResponseEvery * rFactor
                retVal = !((responseCounterValue % SendResponseEvery) != 0);
                log.Info("Need to send pixel to provider: " + appKey + " = " + retVal.ToString());
                return(retVal);
            }
            return(true);
        }