| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <%@ Application Language="C#" %>
- <%@ Import Namespace="Curtain.DataAccess" %>
- <%@ Import Namespace="Curtain.Log" %>
- <%@ Import Namespace="DK.XuWei.WebMes" %>
- <script runat="server">
- void Application_Start(object sender, EventArgs e)
- {
- // 在应用程序启动时运行的代码
- string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
- DataAccess.DefaultParameterType = SQLParameterType.CDA;
- DataAccess.DefaultDataBaseType = Curtain.DataAccess.DataBaseType.Oracle;
- DataAccess.DefaultConnectionString = connStr;
- Curtain.Log.Logger.Debug("系统定时推送启动!");
- PushData.export02(); // 烘干区
- PushData.export03(); // 施釉房
- PushData.export04(); // 成品检测
- PushData.export05(); // 使用结果
- PushData.getDeviceId(); // 获取在用电能设备
- PushData.getDeviceElectronicCharge(); // 获取设备电量
- //定时器任务 自动推送数据
- tr_Load();
- }
- void Application_End(object sender, EventArgs e)
- {
- // 在应用程序关闭时运行的代码
- System.Threading.Thread.Sleep(1000);
- string url = "http://172.18.32.32:9500/api/start.ashx";
- System.Net.HttpWebRequest myHttpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
- System.Net.HttpWebResponse myHttpWebResponse = (System.Net.HttpWebResponse)myHttpWebRequest.GetResponse();
- System.IO.Stream receiveStream = myHttpWebResponse.GetResponseStream();
- myHttpWebResponse.Close();
- receiveStream.Close();
- }
- void Application_Error(object sender, EventArgs e)
- {
- // 在出现未处理的错误时运行的代码
- //Exception error = Server.GetLastError().GetBaseException();
- //if (error != null)
- //{
- // //记录日志
- // Logger.Error(error);
- // //输出错误信息
- // HttpContext.Current.Response.Write(new JsonResult(JsonStatus.otherError).ToJson());
- //}
- //Server.ClearError();
- }
- void Session_Start(object sender, EventArgs e)
- {
- // 在新会话启动时运行的代码
- }
- void Session_End(object sender, EventArgs e)
- {
- // 在会话结束时运行的代码。
- // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
- // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer
- // 或 SQLServer,则不引发该事件。
- }
- //定时器任务 自动推送数据===============================
- void tr_Load()
- {
- //取刷新时间1小时
- int refreshTime = 900000;
- //设置timer
- System.Timers.Timer tr = new System.Timers.Timer(refreshTime);
- tr.Elapsed += new System.Timers.ElapsedEventHandler(tr_Elapsed);
- tr.Enabled = true;
- tr.AutoReset = true;
- }
- void tr_Elapsed(object sender, EventArgs e)
- {
- PushData.export02(); // 烘干区
- PushData.export03(); // 施釉房
- PushData.export04(); // 成品检测
- PushData.export05(); // 使用结果
- PushData.getDeviceId(); // 获取在用电能设备
- PushData.getDeviceElectronicCharge(); // 获取设备电量
- //Curtain.Log.Logger.Debug(DateTime.Now.ToString());
- }
- </script>
|