/// <summary>
        /// Invoke DigiSphere API to retrieve a list of sectors
        /// </summary>
        /// <returns></returns>
        public List <BusinessKeywordInfo> GetBusinessKeyWords(int sectorID, int siteCatID, int[] businessTypeIDs)
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";

            List <BusinessKeywordInfo> lstTotalKeywords = new List <BusinessKeywordInfo>();

            for (int i = 0; i < businessTypeIDs.Length; i++)
            {
                string businessKeywordURL = string.Format(APIEndPoint.GetSpecificBusinessKeyWords, sectorID, siteCatID, businessTypeIDs[i]);
                string returnValue        = fetchRest.GetData(businessKeywordURL, string.Empty);

                if (returnValue != string.Empty)
                {
                    List <BusinessKeywordInfo> lstBusinessKeywords = JsonParser.Deserializer.DeserializeJSON <List <BusinessKeywordInfo> >(returnValue);

                    if (lstBusinessKeywords != null && lstBusinessKeywords.Count > 0)
                    {
                        for (int j = 0; j < lstBusinessKeywords.Count; j++)
                        {
                            if (!lstTotalKeywords.Exists(x => x.Keyword.ToLower() == lstBusinessKeywords[j].Keyword.ToLower()))
                            {
                                lstTotalKeywords.Add(lstBusinessKeywords[j]);
                            }
                        }
                    }
                }
            }

            return(lstTotalKeywords);
        }
Esempio n. 2
0
        /// <summary>
        /// This method get invoke contentder scheduler to fetch mail on schedule date and send mail.
        /// </summary>
        /// <param name="ScheduleOn"></param>
        /// <returns></returns>
        private async void SendMailFromContentder(DateTime ScheduleOn, string DomainName)
        {
            try
            {
                string        scheduleOn    = ScheduleOn.ToString("yyyy-MM-dd HH:mm:ss");
                FetchRest     fetchRest     = new FetchRest();
                SettingHelper settingHelper = new SettingHelper(_memoryCache);
                string        configurecode = settingHelper.GetCachedSettingValue(SettingKeys.Configurecode);

                ClientRequestInfo clientRequest = new ClientRequestInfo();
                clientRequest.Sender      = DomainName;
                clientRequest.RequestType = 1;
                clientRequest.ExecuteOn   = scheduleOn;
                string PostData           = JsonConvert.SerializeObject(clientRequest);
                string MassMailRequestURL = ContentderAPI.AutomatedTaskRequest;
                Uri    URI = new Uri(MassMailRequestURL);
                HttpResponseMessage responseMessage = await Task.Run(() => fetchRest.PostData(DomainName, configurecode, URI, PostData));

                if (responseMessage.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);

                    PostResponse postResponse = JsonConvert.DeserializeObject <PostResponse>(responseContent);
                    if (postResponse.Code == (int)ePostResponseCode.PackageLimitExceed)
                    {
                        MassMailProvider mailProvider = new MassMailProvider();
                        _ = mailProvider.UpdateStausOfMail(ScheduleOn, eEmailStatus.LimitExceeded);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
        public void TriggerSiteConfig(string domainName, string configcode)
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "POST";
            string data = JsonConvert.SerializeObject(new ConfigSuccess()
            {
                DomainName = domainName, Configcode = configcode
            });
            string returnValue = fetchRest.GetData(APIEndPoint.TriggerConfig, string.Empty);
        }
Esempio n. 4
0
        /// <summary>
        /// Invoke DigiSphere API to retrieve a list of sectors
        /// </summary>
        /// <returns></returns>
        public List <SectorTypeInfo> GetSectorTypes()
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";
            string returnValue = fetchRest.GetData(APIEndPoint.GetAllSectors, string.Empty);

            if (returnValue != string.Empty)
            {
                List <SectorTypeInfo> lstSectors = JsonParser.Deserializer.DeserializeJSON <List <SectorTypeInfo> >(returnValue);
                return(lstSectors);
            }
            return(null);
        }
        /// <summary>
        /// Invoke DigiSphere API to retrieve a list of Site Categories by Sector ID
        /// </summary>
        /// <param name="sectorID"></param>
        /// <returns></returns>
        public List<SiteTypeInfo> GetSiteCategoriesBySectorID(int sectorID)
        {
            FetchRest fetchRest = new FetchRest();
            fetchRest.Method = "Get";

            string siteCategoryURL = string.Format(APIEndPoint.GetSiteCategoriesBySectorID, sectorID);
            string returnValue = fetchRest.GetData(siteCategoryURL, string.Empty);

            if (returnValue != string.Empty)
            {
                List<SiteTypeInfo> lstSectors = JsonParser.Deserializer.DeserializeJSON<List<SiteTypeInfo>>(returnValue);
                return lstSectors;
            }
            return null;
        }
        /// <summary>
        /// Invoke DigiSphere API to retrieve a list of all the available sectors
        /// </summary>
        /// <returns></returns>
        public List <BusinessKeywordInfo> GetAvailableKeywords()
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";
            string returnValue = fetchRest.GetData(APIEndPoint.GetAvailalbeBusinessKeyWords, string.Empty);

            if (returnValue != string.Empty)
            {
                List <BusinessKeywordInfo> lstBusinessKeywords = JsonParser.Deserializer.DeserializeJSON <List <BusinessKeywordInfo> >(returnValue);
                return(lstBusinessKeywords);
            }

            return(null);
        }
        public List <BusinessTypeInfo> GetBusinessType(int sectorID, int siteCatID)
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";

            string businessTypeURL = string.Format(APIEndPoint.GetBusinessTypeBySectorAndSite, sectorID, siteCatID);
            string returnValue     = fetchRest.GetData(businessTypeURL, string.Empty);

            if (returnValue != string.Empty)
            {
                List <BusinessTypeInfo> lstBusinessTypes = JsonParser.Deserializer.DeserializeJSON <List <BusinessTypeInfo> >(returnValue);
                return(lstBusinessTypes);
            }
            return(null);
        }
        public KeywordDetailInfo FindByKeywords(string keywords)
        {
            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";
            string keyWordURL = string.Format(APIEndPoint.GetByKeywords, keywords);

            string returnValue = fetchRest.GetData(keyWordURL, string.Empty);

            if (returnValue != string.Empty)
            {
                KeywordDetailInfo lstBusinessKeywords = JsonParser.Deserializer.DeserializeJSON <KeywordDetailInfo>(returnValue);
                return(lstBusinessKeywords);
            }

            return(null);
        }
Esempio n. 9
0
 private void CallAPIForMail(string ScheduleOn)
 {
     try
     {
         FetchRest           fetchRest          = new FetchRest();
         string              configurecode      = Config.GetSetting("configurecode").ToString();
         string              DomainName         = HttpContext.Current.Request.Url.Host;
         string              PostData           = "{'sender':'" + DomainName + "','RequestType':1,'ExecuteOn':'" + ScheduleOn + "' }";
         string              MassMailRequestURL = APIEndPoint.AutomatedTaskRequest;
         Uri                 URI      = new Uri(MassMailRequestURL);
         HttpResponseMessage response = fetchRest.PostData(DomainName, configurecode, URI, PostData);
         if (response.IsSuccessStatusCode)
         {
         }
     }
     catch (Exception)
     {
     }
 }
        public SiteResourceConsumptionInfo GetSiteConsumptionDetail(string domainName)
        {
            string configurecode = Config.GetSetting("configurecode").ToString();

            FetchRest fetchRest = new FetchRest();

            fetchRest.Method = "Get";

            domainName = domainName.Replace('.', '_');

            string siteConsumptionURL = string.Format(APIEndPoint.GetSiteConsumption, domainName);
            string returnValue        = fetchRest.GetData(siteConsumptionURL, string.Empty);

            if (returnValue != string.Empty)
            {
                SiteResourceConsumptionInfo siteConsumptionInfo = JsonParser.Deserializer.DeserializeJSON <SiteResourceConsumptionInfo>(returnValue);
                return(siteConsumptionInfo);
            }
            return(null);
        }