From 4d584101e46ff34b2694e88af706b9b2e92364bc Mon Sep 17 00:00:00 2001 From: CB2-20200827ONU\Administrator <liaoxujun@qq.com> Date: 星期三, 22 九月 2021 08:55:31 +0800 Subject: [PATCH] no message --- CY_ECommercePlatform/CY.WebForm/Global.asax.cs | 246 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 245 insertions(+), 1 deletions(-) diff --git a/CY_ECommercePlatform/CY.WebForm/Global.asax.cs b/CY_ECommercePlatform/CY.WebForm/Global.asax.cs index 8be62be..943e38a 100644 --- a/CY_ECommercePlatform/CY.WebForm/Global.asax.cs +++ b/CY_ECommercePlatform/CY.WebForm/Global.asax.cs @@ -5,6 +5,13 @@ using System.Web.Security; using System.Web.SessionState; using System.Web.Routing; +using CY.WebForm.Helper; +using CY.BLL; +using System.Data.SqlClient; +using CY.SQLDAL; +using CY.Infrastructure.Logging; +using System.Data; +using System.Globalization; namespace CY.WebForm { @@ -14,7 +21,244 @@ void Application_Start(object sender, EventArgs e) { // 鍦ㄥ簲鐢ㄧ▼搴忓惎鍔ㄦ椂杩愯鐨勪唬鐮� - log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/config/log4net.config"))); + log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/config/log4net.config"))); + // 鍦ㄥ簲鐢ㄧ▼搴忓惎鍔ㄦ椂杩愯鐨勪唬鐮� + TimeTaskHelper.Instance().ExecuteTask += new System.Timers.ElapsedEventHandler(Global_ExecuteTask); + TimeTaskHelper.Instance().Interval = 1000*10;//琛ㄧず闂撮殧 1涓皬鏃� + TimeTaskHelper.Instance().Start(); + } + void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e) + { + //鍦ㄨ繖閲岀紪鍐欓渶瑕佸畾鏃舵墽琛岀殑閫昏緫浠g爜 + + //杩欓噷鎵ц瀹氭椂浠诲姟 + DateTime time = DateTime.Now; + if (time.ToString("ddd HH") == "鍛ㄤ竴 00") + { + + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [NeedWiHu] = 'true' WHERE[Shifouwanjie] = 2"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("鍛ㄤ竴鎵ц涓哄畬缁撳鎴� 鎻愰啋璁剧疆澶辫触 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + + + + + + + + } + string strtime = time.ToString("MM dd HH"); + if (strtime == "01 01 01" || strtime == "04 01 01" || strtime == "07 01 01" || strtime == "10 01 01") + { + //1 銆�4銆�7銆�10鏈� 1鍙�1鐐癸紝鍒锋柊 宸插畬缁撹鍗曠殑缁存姢鎻愰啋 + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [NeedWiHu] = 'true' WHERE[Shifouwanjie] = 1"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("瀹岀粨璁㈠崟瀹㈡埛3涓湀涓�娆℃彁閱掗敊璇� 鎻愰啋璁剧疆澶辫触 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + } + ///浠ヤ笅涓鸿妭鏃ユ彁閱� + time.AddDays(20); + + ChineseLunisolarCalendar chineseLunisolarCalendar = new ChineseLunisolarCalendar(); + int lyear = chineseLunisolarCalendar.GetYear(time); + int lmonth = chineseLunisolarCalendar.GetMonth(time); + int lday = chineseLunisolarCalendar.GetDayOfMonth(time); + //鑾峰彇闂版湀锛屻��0銆�鍒欒〃绀烘病鏈夐棸鏈� + int leapMonth = chineseLunisolarCalendar.GetLeapMonth(lyear); + + + if(lmonth==1&&lday==1&& time.Hour==1) + { + + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("鏄ヨ妭璁剧疆鎻愰啋閿欒 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + //鏄ヨ妭鎻愰啋 + } + if (leapMonth == 0) + { + //娌℃湁闂版湀 + if (lmonth == 8 && lday == 15&&time.Hour==1) + { + //涓鑺傛彁閱� + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("涓鑺傛彁閱掗敊璇� 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + } + + if (lmonth == 5 && lday == 5 && time.Hour == 1) + { + //绔崍鑺� + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("绔崍鑺傝缃彁閱掗敊璇� 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + } + } + else + { + //鏈夐棸鏈� + //娌℃湁闂版湀 + int ms = 8; + if (leapMonth < 8) + ms++; + if (lmonth == ms && lday == 15 && time.Hour == 1) + { + //涓鑺傛彁閱� + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("涓鑺傝缃彁閱掗敊璇� 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + } + + ms = 5; + if (leapMonth < 5) + ms++; + if (lmonth == ms && lday == 5 && time.Hour == 1) + { + //绔崍鑺� + Database DC = new Database(); + string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'"; + + try + { + SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection); + //SqlDataAdapter myDa = new SqlDataAdapter(myCmd); + int a = myCmd.ExecuteNonQuery(); + //myDa.Dispose(); + + + } + catch (Exception ee) + { + new Log4NetAdapter().Log("绔崍鑺傝缃彁閱掗敊璇� 閿欒锛�" + ee.Message); + + } + finally + { + if (DC.Connection.State != System.Data.ConnectionState.Closed) + DC.Connection.Close(); + } + + } + } + } protected void Application_BeginRequest(Object sender, EventArgs e) -- Gitblit v1.9.1