Beispiel #1
0
        private void LoadXmlConfig()
        {
            xmlDoc = new XmlDocument();
            string sXMLPath = Path.Combine(Utility.ComponentBaseFolder + "\\Xml", "API_Crunchbase.xml");

            try
            {
                xmlDoc.Load(sXMLPath);

                _apiUrl         = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("apiurl").Value;
                _apiKey         = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("apikey").Value;
                _verboseLogging = Conversions.ConvertTo <bool>(XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("verboselogging").Value, false);
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log
                                                                       , LogTypeEnum.Error
                                                                       , "Drone.API.Crunchbase BaseManager"
                                                                       , "BaseManager.LoadXmlConfig()"
                                                                       , "nouser"
                                                                       , System.Environment.MachineName
                                                                       , "Path: " + sXMLPath));
            }
        }
Beispiel #2
0
        internal static string ExecuteWebRequest(string query)
        {
            WebResponse response     = null;
            string      responseText = string.Empty;

            try
            {
                WebRequest request = WebRequest.Create(query);
                request.ContentType = "application/json; charset=utf-8";
                response            = (WebResponse)request.GetResponse();

                if (!Object.Equals(response, null))
                {
                    responseText = BuildTextFromResponse(response);
                }
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log
                                                                       , LogTypeEnum.Error
                                                                       , "Drone.API.Facebook Exception"
                                                                       , "ExecuteWebRequest "
                                                                       , "nouser"
                                                                       , System.Environment.MachineName
                                                                       , "Query " + query));
            }

            return(responseText);
        }
Beispiel #3
0
        private void AddVideoFeed(YouTubeQuery q)
        {
            try
            {
                YouTubeRequest request = GetRequest();
                Feed <Video>   feed    = request.Get <Video>(q);

                feed.Maximum = 500;//11_5_13 ss: limited to 500 now??

                if (!Object.Equals(feed, null) && !Object.Equals(feed.Entries, null))
                {
                    foreach (Video vid in feed.Entries)
                    {
                        _channel.Feed.Add(new ChannelVideo(vid));
                    }
                }
            }
            catch (GDataRequestException gdre)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleException(gdre.Message, "Query: " + q.Query, Utility.ApplicationName, LogTypeEnum.Error, LogActionEnum.LogAndEmail, "ChannelManager.GetVideos()", "Drone.API.YouTube Exception", string.Empty, string.Empty, System.Environment.MachineName);
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log, LogTypeEnum.Error, "Drone.API.YouTube Exception", "ChannelManager.GetVideos()", "nouser", System.Environment.MachineName, "Query: " + q.Query));
            }
        }
Beispiel #4
0
        private void BuildChannel(string channelQuery)
        {
            //Get profile and create channel object
            try
            {
                YouTubeService service = new YouTubeService(_appName, _devKey);
                if (!Object.Equals(service, null))
                {
                    ProfileEntry profile = (ProfileEntry)service.Get(channelQuery);

                    if (!Object.Equals(profile, null))
                    {
                        _channel = new Channel(profile, _user, _userID);
                    }
                }
            }
            catch (GDataRequestException gdre)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleException(gdre.Message, "Query: " + channelQuery, Utility.ApplicationName, LogTypeEnum.Error, LogActionEnum.LogAndEmail, "ChannelManager.BuildChannel()", "Drone.API.YouTube Exception", string.Empty, string.Empty, System.Environment.MachineName);
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log, LogTypeEnum.Error, "Drone.API.YouTube Exception", "ChannelManager.BuildChannel()", "nouser", System.Environment.MachineName, "Query: " + channelQuery));
            }
        }
Beispiel #5
0
        private void LoadXmlConfig()
        {
            XmlDocument xmlDoc   = new XmlDocument();
            string      sXMLPath = Path.Combine(Utility.ComponentBaseFolder + "\\Xml", "API_YouTube.xml");

            try
            {
                xmlDoc.Load(sXMLPath);

                _apiUploadsUrl = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("apiuploadsurl").Value;
                _apiChannelUrl = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("apichannelurl").Value;
                _apiVideosUrl  = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("apivideosurl").Value;
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log
                                                                       , LogTypeEnum.Error
                                                                       , "Drone.API.YouTube Exception"
                                                                       , "ChannelManager.LoadXmlConfig()"
                                                                       , "nouser"
                                                                       , System.Environment.MachineName
                                                                       , "Path: " + sXMLPath));
            }
        }
 private static void LogException(Exception e, string sourceMethod, LogTypeEnum type, string additionalMessage = null)
 {
     using (var logClient = new BILoggerServiceClient())
     {
         logClient.HandleBIExceptionAsync(e.ConvertToBIException(LogActionEnum.LogAndEmail
                                                                 , type
                                                                 , sourceMethod + " Error"
                                                                 , sourceMethod
                                                                 , "nouser"
                                                                 , System.Environment.MachineName
                                                                 , additionalMessage));
     }
 }
Beispiel #7
0
        public void Dig_ChangeHostEntryTest()
        {
            var logClient = new BILoggerServiceClient();

            logClient.HandleException("testing", "none", "Drone Processor", LogTypeEnum.Information, LogActionEnum.Email, "DigTest", "Testing Endpoint", "", "ssawyer", "");

            logClient = new BILoggerServiceClient();
            var wsb = logClient.Endpoint.Binding as System.ServiceModel.BasicHttpBinding;

            wsb.ProxyAddress       = new Uri("http://172.19.67.10");
            wsb.BypassProxyOnLocal = false;
            wsb.UseDefaultWebProxy = false;

            //System.Net.WebProxy webProxy = new System.Net.WebProxy("http://172.19.67.10", true);
            ////webProxy.Credentials = new System.Net.NetworkCredential("1", "1");
            //System.Net.WebRequest.DefaultWebProxy = webProxy;

            //just to double check IP from the host file
            IPHostEntry ip2 = Dns.GetHostEntry("bizintel-test.intranet.gdg");

            logClient.HandleException("testing", "none", "Drone Processor", LogTypeEnum.Information, LogActionEnum.Email, "DigTest", "Testing Endpoint", "", "ssawyer", "");
        }
Beispiel #8
0
        private void LoadXmlConfig()
        {
            xmlDoc = new XmlDocument();
            string sXMLPath = Path.Combine(Utility.ComponentBaseFolder + "\\Xml", "API_Facebook.xml");

            try
            {
                xmlDoc.Load(sXMLPath);

                _graphUrl = XDocument.Parse(xmlDoc.InnerXml).Element("api").Element("graphurl").Value;
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log
                                                                       , LogTypeEnum.Error
                                                                       , "Drone.API.Facebook BaseManager"
                                                                       , "BaseManager.LoadXmlConfig()"
                                                                       , "nouser"
                                                                       , System.Environment.MachineName
                                                                       , "Path: " + sXMLPath));
            }
        }
Beispiel #9
0
        internal static string ExecuteAnonymousWebRequest(string query)
        {
            HttpWebResponse response     = null;
            string          responseText = string.Empty;

            try
            {
                WebRequest request = WebRequest.Create(query);
                request.ContentType = "text/xml; charset=utf-8";
                response            = (HttpWebResponse)request.GetResponse();

                if (!Object.Equals(response, null))
                {
                    responseText = BuildTextFromResponse(response);
                }
            }
            catch (WebException we)
            {
                response = we.Response as HttpWebResponse;
                if (!Object.Equals(response, null) && (int)response.StatusCode == 420)
                {
                    Thread.Sleep(300000);                     //if we are rate limited, wait 5 min before proceeding
                }
            }
            catch (Exception e)
            {
                using (var logClient = new BILoggerServiceClient())
                    logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log
                                                                       , LogTypeEnum.Error
                                                                       , "Drone.API.YouTube Exception"
                                                                       , "ExecuteAnonymousWebRequest "
                                                                       , "nouser"
                                                                       , System.Environment.MachineName));
            }

            return(responseText);
        }