开发工具:
文件大小: 452kb
下载次数: 0
上传时间: 2012-11-08
详细说明: 气象短息发布平台,适合地市级气象局使用 private void timer1_Tick(object sender, EventArgs e) { // DateTime now = DateTime.Now; DateTime t = DateTime.Now; DateTime zhengdian = new DateTime(t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second); DateTime shijian = new DateTime(t.Year, t.Month, t.Day, 15, 50, 0); // DateTime shijian1 = new DateTime(t.Year, t.Month, t.Day); if (shijian == zhengdian) { StreamReader sr = new StreamReader("d:\\f orecast\\dq1", System.Text.Encoding.Default); string chr1, chr2, fx1, fx2, fs1, fs2; string wea, wind, wins, tqxx; int tmax, tmin; string[] tq = new string[32] { "晴", "多云", "阴", "阵雨", "雷阵雨", "雷阵雨夹雪", "雨夹雪", "小雨", "中雨", "大雨", "暴雨", "大暴雨", "特大暴雨", "阵雪", "小雪", "中雪", "大雪", "暴雪", "雾", "冻雨", "沙尘暴", "小到中雨", "中到大雨", "大到暴雨", "暴雨到大暴雨", "大暴雨到特大暴雨", "小到中雪", "中到大雪", "大到暴雪", "浮尘", "扬沙", "强沙尘暴" }; string[] st = new string[7] { "拉萨", "日喀则", "那曲", "林芝", "泽当", "狮泉河", "昌都" }; string[] stnum = new string[7] { "55591", "55578", "55299", "56312", "55598", "55228", "56137" }; string[] fx = new string[10] { "", "东北风", "东风", "东南风", "南风", "西南风", "西风", "西北风", "北风", "旋转不定风" }; string[] fs = new string[10] { "", "3~4级", "4~5级", "5~6级", "6~7级", "7~8级", "8~9级", "9~10级", "10~11级", "11~12级" }; string strline = sr.ReadLine(); int i = 0, c, w1, w2; SqlConnection con5 = bc1.getcon(); con5.Open(); int rn = bc1.getrecnum("select count(*)from ybdata"); SqlCommand cmd5 = new SqlCommand(); string sqlins; while (strline != null) { chr1 = strline.Substring(0, 5); if (chr1 == stnum[i]) { chr1 = strline.Substring(6, 5); w1 = Convert.ToInt32(chr1) / 100; w2 = Convert.ToInt32(chr1) % 100; if (w1 == w2) { wea = tq[w1]; } else { wea = tq[w1] + "转" + tq[w2]; } chr1 = strline.Substring(12, 5); c = Convert.ToInt32(chr1) - 10000; if (c == 0) { wind = ""; wins = ""; } else { chr2 = c.ToString(); fx1 = fx[Convert.ToInt32(chr2.Substring(0, 1))]; fx2 = fx[Convert.ToInt32(chr2.Substring(1, 1))]; fs1 = fs[Convert.ToInt32(chr2.Substring(2, 1))]; fs2 = fs[Convert.ToInt32(chr2.Substring(3, 1))]; if (fx1 == fx2) { wind = fx1; } else { wind = fx1 + "转" + fx2; } if (fs1 == fs2) { wins = fs1; } else { wins = fs1 + "转" + fs2; } } chr1 = strline.Substring(18, 5); tmin = (Convert.ToInt32(chr1) - 20000) / 100; tmax = (Convert.ToInt32(chr1) - 20000) % 100; if (tmin >= 50) { tmin = 0 - (tmin - 50); } if (tmax >= 50) { tmax = 0 - (tmax - 50); } if (wind == "") { tqxx = "便民气象站:" + st[i] + "今晚到明天" + wea + ",气温" + tmin + "到" + tmax + "度。"; } else { tqxx = "便民气象站:" + st[i] + "今晚到明天" + wea + "," + wind + wins + ",气温" + tmin + "到" + tmax + "度。"; } rn = rn + 1; sqlins = "insert into ybdata (id,diming,yubao,time) values('" + rn + "','" + st[i] + "','" + tqxx + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "')"; cmd5.CommandText = sqlins; cmd5.Connection = con5; cmd5.ExecuteNonQuery(); } strline = sr.ReadLine(); i = i + 1; if (i > 6) { break; } } // MessageBox.Show("预报文件已生成!"); con5.Close(); sr.Close(); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.