From e8e3122fdc4844202fb9e05477d47139e47a8aae Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 12 十二月 2025 08:59:47 +0800
Subject: [PATCH] 作业本送货变二级菜单
---
CY_ECommercePlatform/CY.WebForm/Global.asax.cs | 429 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 428 insertions(+), 1 deletions(-)
diff --git a/CY_ECommercePlatform/CY.WebForm/Global.asax.cs b/CY_ECommercePlatform/CY.WebForm/Global.asax.cs
index 8be62be..ffb0dd6 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,427 @@
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*3000;//琛ㄧず闂撮殧 1涓皬鏃�
+ TimeTaskHelper.Instance().Start();
+ }
+ void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ //鍦ㄨ繖閲岀紪鍐欓渶瑕佸畾鏃舵墽琛岀殑閫昏緫浠g爜
+
+ //杩欓噷鎵ц瀹氭椂浠诲姟
+ DateTime time = DateTime.Now;
+ #region 鏈畬缁撳鎴蜂緥琛岀疆浣�
+
+
+ var data = time.ToString("ddd HH");
+ if (data == "鍛ㄤ竴 1")
+ {
+
+ Database DC = new Database();
+ string sqlStr = " 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();
+ }
+
+
+
+
+
+
+
+
+ }
+
+ #endregion
+ #region 宸插畬缁撳鎴风淮鎶ょ疆浣�
+
+
+ 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 = " 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();
+ }
+ }
+ #endregion
+ #region 鑺傛棩鎻愰啋缃綅
+
+
+ ///浠ヤ笅涓鸿妭鏃ユ彁閱�
+ var date20days= time.AddDays(20);
+
+ ChineseLunisolarCalendar chineseLunisolarCalendar = new ChineseLunisolarCalendar();
+ int lyear = chineseLunisolarCalendar.GetYear(date20days);
+ int lmonth = chineseLunisolarCalendar.GetMonth(date20days);
+ int lday = chineseLunisolarCalendar.GetDayOfMonth(date20days);
+ //鑾峰彇闂版湀锛屻��0銆�鍒欒〃绀烘病鏈夐棸鏈�
+ int leapMonth = chineseLunisolarCalendar.GetLeapMonth(lyear);
+
+
+ if(lmonth==1&&lday==1&& time.Hour==1)
+ {
+
+ Database DC = new Database();
+ string sqlStr = " 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 = " 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 = " 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 = " 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 = " 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();
+ }
+
+ }
+ }
+ #endregion
+ #region 鑺傛棩鎻愰啋杩囨湡缃綅鍙栨秷
+ ///浠ヤ笅涓鸿妭鏃ユ彁閱�
+
+
+ ChineseLunisolarCalendar chineseLunisolarCalendar2 = new ChineseLunisolarCalendar();
+ lyear = chineseLunisolarCalendar2.GetYear(time);
+ lmonth = chineseLunisolarCalendar2.GetMonth(time);
+ lday = chineseLunisolarCalendar2.GetDayOfMonth(time);
+ //鑾峰彇闂版湀锛屻��0銆�鍒欒〃绀烘病鏈夐棸鏈�
+ leapMonth = chineseLunisolarCalendar.GetLeapMonth(lyear);
+
+
+ if (lmonth == 1 && lday == 1 && time.Hour == 1)
+ {
+
+ Database DC = new Database();
+ string sqlStr = " UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false'";
+
+ 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 = " UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false'";
+
+ 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 = " UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false'";
+
+ 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 = " UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false'";
+
+ 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 = " UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false'";
+
+ 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();
+ }
+
+ }
+ }
+
+
+ #endregion
+
}
protected void Application_BeginRequest(Object sender, EventArgs e)
--
Gitblit v1.9.1