Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string         cityIp   = WebToolsHelper.GetIp();
         TerminalStatus terminal = TerminalOnlineMonitorThread.GetTerminal(cityIp);
         string         cityCode = string.Empty;
         if (terminal != null)
         {
             cityCode = terminal.CityCode;
         }
         else
         {
             cityCode = "101010100";
         }
         if (cityCode != null && cityCode.Length > 0)
         {
             WeatherObject weather = null;
             try
             {
                 weather = WeatherHelper.GetCityWeather(cityCode);
             }
             catch
             {
             }
             if (weather != null)
             {
                 this.lbCity.Text         = weather.weatherinfo.city;
                 this.lbDate.Text         = System.DateTime.Now.ToString("M月d日");
                 this.lbTemp.Text         = weather.weatherinfo.temp1;
                 this.lbTrafficLimit.Text = this.GetTrafficLimitInfo(cityCode);
                 this.lbWeek.Text         = weather.weatherinfo.week;
                 this.lbWind.Text         = weather.weatherinfo.wind1;
                 this.img1.Visible        = true;
                 this.img1.ImageUrl       = weather.weatherinfo.img1;
             }
             else
             {
                 this.lbCity.Text         = "预报出错";
                 this.lbDate.Text         = System.DateTime.Now.ToString("M月d日");
                 this.lbTemp.Text         = string.Empty;
                 this.lbTrafficLimit.Text = this.GetTrafficLimitInfo(cityCode);
                 this.lbWeek.Text         = DateTimeHelper.GetChineseXq(System.DateTime.Now);
                 this.lbWind.Text         = string.Empty;
                 this.img1.Visible        = false;
                 // this.img1.ImageUrl = weather.weatherinfo.img1;
             }
         }
     }
 }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string cityIp = WebToolsHelper.GetIp();

        this.Label1.Text = cityIp;

        // 客户端ip:
        string tmp = "客户端ip:" + Request.ServerVariables.Get("Remote_Addr").ToString();

//客户端主机名:
        tmp += "客户端主机名:" + Request.ServerVariables.Get("Remote_Host").ToString();
//客户端浏览器IE:
        tmp += "客户端浏览器IE:" + Request.Browser.Browser.ToString();
//客户端浏览器 版本号:
        tmp += "客户端浏览器 版本号:" + Request.Browser.MajorVersion;
//客户端操作系统:
        tmp += "客户端操作系统:" + Request.Browser.Platform;
//服务器ip:
        tmp += "服务器ip:" + Request.ServerVariables.Get("Local_Addr").ToString();
//服务器名:
        tmp += "服务器名:" + Request.ServerVariables.Get("Server_Name").ToString();
        this.Label1.Text = tmp;
    }