示例#1
0
        public String getUrl(String url)
        {
            String data = null;

            try {
                WebRequest   request    = WebRequest.Create(url);
                WebResponse  response   = request.GetResponse();
                Stream       dataStream = response.GetResponseStream();
                StreamReader reader     = new StreamReader(dataStream);
                data = reader.ReadToEnd();
                reader.Close();
                response.Close();
                return(data);
            } catch (Exception e) {
                LogMgr.err(e.Message);
            }
            return(data);
        }
示例#2
0
        private String calculateFecha(long epoch)
        {
            if (epoch == 0)
            {
                return("20000101");
            }
            DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            dt.AddSeconds(epoch);
            dt.AddDays(1);
            try {
                return(String.Format("{0:D4}{1:D2}{2:D2}", dt.Year, dt.Month, dt.Day));
            }
            catch (Exception e) {
                LogMgr.err(e.Message);
            }
            return("20000101");
        }