コード例 #1
0
        internal bool SchedulerToDeactivateSponsor(SponsorshipRequestEntity sponsorshipReqObj)
        {
            using (_httpClient = new HttpClient())
            {
                string        WebAPIURL   = System.Configuration.ConfigurationManager.AppSettings["WebAPIURL"].ToString();
                string        apiMethod   = "SchedulerToDeactivateSponsor";
                string        completeURL = WebAPIURL + apiMethod;
                StringContent httpContent = new StringContent(JsonConvert.SerializeObject(sponsorshipReqObj), Encoding.UTF8, "application/json");

                var  response      = _httpClient.PostAsync(completeURL, httpContent).Result;
                bool isDeactivated = JsonConvert.DeserializeObject <bool>(response.Content.ReadAsStringAsync().Result);
                return(isDeactivated);
            }
        }
コード例 #2
0
        public ActionResult SchedulerToDeactivateSponsor()
        {
            dynamic jsonData = default(dynamic);

            try
            {
                SponsorshipRequestEntity sponsorshipReqObj = new SponsorshipRequestEntity();
                sponsorshipReqObj.CreatedBy = Convert.ToInt32(Session["UserID"]);
                List <SponsorshipExpiredListEntity> ExpiredListObj = new SponsorshipService().GetExpiredSponsorshipList(sponsorshipReqObj);
                bool isDeactivated = new SponsorshipService().SchedulerToDeactivateSponsor(sponsorshipReqObj);
                if (isDeactivated)
                {
                    foreach (var item in ExpiredListObj)
                    {
                        if (Utility.CacheHandler.Exists(item.Name.ToLower().Replace(" ", "-")))
                        {
                            UpVotes.Utility.CacheHandler.Clear(item.Name.ToLower().Replace(" ", "-"));
                        }
                    }

                    jsonData = new
                    {
                        IsSuccess = true,
                    };
                }
                else
                {
                    jsonData = new
                    {
                        IsSuccess = false,
                    };
                }
            }
            catch (Exception)
            {
                jsonData = new
                {
                    IsSuccess = false
                };
            }
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        internal List <SponsorshipExpiredListEntity> GetExpiredSponsorshipList(SponsorshipRequestEntity sponsorshipReqObj)
        {
            using (_httpClient = new HttpClient())
            {
                string        WebAPIURL   = System.Configuration.ConfigurationManager.AppSettings["WebAPIURL"].ToString();
                string        apiMethod   = "GetAllExpiredSponsorshipList";
                string        completeURL = WebAPIURL + apiMethod;
                StringContent httpContent = new StringContent(JsonConvert.SerializeObject(sponsorshipReqObj), Encoding.UTF8, "application/json");

                HttpResponseMessage response = _httpClient.PostAsync(completeURL, httpContent).Result;
                List <SponsorshipExpiredListEntity> expiredListObj = new List <SponsorshipExpiredListEntity>();
                if (response.IsSuccessStatusCode)
                {
                    expiredListObj = JsonConvert.DeserializeObject <List <SponsorshipExpiredListEntity> >(response.Content.ReadAsStringAsync().Result);
                    return(expiredListObj);
                }
                else
                {
                    return(expiredListObj);
                }
            }
        }
コード例 #4
0
        public ActionResult ApplySponsorship(SponsorshipRequestEntity sponsorshipReqObj)
        {
            dynamic jsonData = default(dynamic);

            try
            {
                sponsorshipReqObj.CreatedBy = Convert.ToInt32(Session["UserID"]);
                bool isApplied = new SponsorshipService().ApplySponsorship(sponsorshipReqObj);

                if (isApplied)
                {
                    if (Utility.CacheHandler.Exists(sponsorshipReqObj.CompanyOrSoftwareName.ToLower().Replace(" ", "-")))
                    {
                        UpVotes.Utility.CacheHandler.Clear(sponsorshipReqObj.CompanyOrSoftwareName.ToLower().Replace(" ", "-"));
                    }

                    jsonData = new
                    {
                        IsSuccess = true,
                    };
                }
                else
                {
                    jsonData = new
                    {
                        IsSuccess = false,
                    };
                }
            }
            catch (Exception)
            {
                jsonData = new
                {
                    IsSuccess = false
                };
            }
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
 public ActionResult GetSchedulerForm()
 {
     if (Session["UserDashboardInfo"] != null)
     {
         DashboardViewModel dashboardObj = new DashboardViewModel();
         dashboardObj = (Session["UserDashboardInfo"] as DashboardViewModel);
         if (dashboardObj.IsAdmin && ((UserEntity)Session["UserObj"]).UserType == 4)
         {
             SponsorshipRequestEntity sponsorshipReqObj = new SponsorshipRequestEntity();
             sponsorshipReqObj.CreatedBy = Convert.ToInt32(Session["UserID"]);
             List <SponsorshipExpiredListEntity> ExpiredListObj = new SponsorshipService().GetExpiredSponsorshipList(sponsorshipReqObj);
             return(PartialView("~/Views/Authenticated/Center/SchedulerForm.cshtml", ExpiredListObj));
         }
         else
         {
             return(PartialView("~/Views/Error/PageNotFound.cshtml"));
         }
     }
     else
     {
         return(PartialView("~/Views/Error/PageNotFound.cshtml"));
     }
 }