Ejemplo n.º 1
0
 private async void VcssTaskExecuteTrigger(string key, object value, CacheItemRemovedReason reason)
 {
     try
     {
         using (WebClient client = new WebClient())
         {
             CookieExpirationValue cookieExpirationValue = value as CookieExpirationValue;
             var reqparm = new System.Collections.Specialized.NameValueCollection();
             reqparm.Add("vcssTaskInfoId", cookieExpirationValue.TaskId.ToString());
             await client.UploadValuesTaskAsync(WebConfigurationManager.AppSettings["VcssExecuteTaskURL"], reqparm);
         }
     }
     catch (Exception ex) { }
 }
Ejemplo n.º 2
0
        private void SetupVcssTaskManagerTrigger(DateTime keyExpirationTime, Action <string, object, CacheItemRemovedReason> keyExpirationFunc, VcssTaskInfoEnum taskId, string action, string batch)
        {
            string cacheKey         = Enum.GetName(typeof(VcssTaskInfoEnum), taskId) + action + batch;
            string blockingCacheKey = Enum.GetName(typeof(VcssTaskInfoEnum), taskId) + ((action == "EXEC") ? "SCHE" : "EXEC") + batch;

            if (HttpContext.Current.Cache[blockingCacheKey] == null && HttpContext.Current.Cache[cacheKey] == null)
            {
                CookieExpirationValue cookieExpirationValue = new CookieExpirationValue()
                {
                    TaskId = taskId, Action = action, Batch = batch
                };
                HttpContext.Current.Cache.Add(cacheKey, cookieExpirationValue, null, keyExpirationTime, Cache.NoSlidingExpiration, CacheItemPriority.Normal, new CacheItemRemovedCallback(keyExpirationFunc));
            }
        }
Ejemplo n.º 3
0
 private async void VcssTaskScheduleTrigger(string key, object value, CacheItemRemovedReason reason)
 {
     try
     {
         using (WebClient client = new WebClient())
         {
             CookieExpirationValue cookieExpirationValue = value as CookieExpirationValue;
             var reqparm = new System.Collections.Specialized.NameValueCollection();
             if (cookieExpirationValue.TaskId == VcssTaskInfoEnum.DailyTechnicalReportARG)
             {
                 reqparm.Add("batch", cookieExpirationValue.Batch);
                 await client.UploadValuesTaskAsync(WebConfigurationManager.AppSettings["VcssScheduleDailyTechnicalReport"], reqparm);
             }
             else
             {
                 reqparm.Add("vcssTaskInfoId", cookieExpirationValue.TaskId.ToString());
                 await client.UploadValuesTaskAsync(WebConfigurationManager.AppSettings["VcssScheduleTaskURL"], reqparm);
             }
         }
     }
     catch (Exception ex) { }
 }