From 72cfaf9fb66ae83059382723698de1233496bd28 Mon Sep 17 00:00:00 2001
From: CB2-20200827ONU\Administrator <liaoxujun@qq.com>
Date: 星期六, 09 十月 2021 16:52:27 +0800
Subject: [PATCH] 修改定时提醒任务的BUG 增加合同多页面浏览
---
CY_ECommercePlatform/CY.WebForm/Global.asax.cs | 205 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 194 insertions(+), 11 deletions(-)
diff --git a/CY_ECommercePlatform/CY.WebForm/Global.asax.cs b/CY_ECommercePlatform/CY.WebForm/Global.asax.cs
index 943e38a..e9532fb 100644
--- a/CY_ECommercePlatform/CY.WebForm/Global.asax.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Global.asax.cs
@@ -24,7 +24,7 @@
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().Interval = 1000*3000;//琛ㄧず闂撮殧 1涓皬鏃�
TimeTaskHelper.Instance().Start();
}
void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e)
@@ -33,7 +33,11 @@
//杩欓噷鎵ц瀹氭椂浠诲姟
DateTime time = DateTime.Now;
- if (time.ToString("ddd HH") == "鍛ㄤ竴 00")
+ #region 鏈畬缁撳鎴蜂緥琛岀疆浣�
+
+
+ var data = time.ToString("ddd HH");
+ if (data == "鍛ㄤ竴 1")
{
Database DC = new Database();
@@ -67,6 +71,11 @@
}
+
+ #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")
{
@@ -94,13 +103,17 @@
DC.Connection.Close();
}
}
+ #endregion
+ #region 鑺傛棩鎻愰啋缃綅
+
+
///浠ヤ笅涓鸿妭鏃ユ彁閱�
- time.AddDays(20);
+ var date20days= time.AddDays(20);
ChineseLunisolarCalendar chineseLunisolarCalendar = new ChineseLunisolarCalendar();
- int lyear = chineseLunisolarCalendar.GetYear(time);
- int lmonth = chineseLunisolarCalendar.GetMonth(time);
- int lday = chineseLunisolarCalendar.GetDayOfMonth(time);
+ int lyear = chineseLunisolarCalendar.GetYear(date20days);
+ int lmonth = chineseLunisolarCalendar.GetMonth(date20days);
+ int lday = chineseLunisolarCalendar.GetDayOfMonth(date20days);
//鑾峰彇闂版湀锛屻��0銆�鍒欒〃绀烘病鏈夐棸鏈�
int leapMonth = chineseLunisolarCalendar.GetLeapMonth(lyear);
@@ -109,7 +122,7 @@
{
Database DC = new Database();
- string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'";
+ string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'true'";
try
{
@@ -140,7 +153,7 @@
{
//涓鑺傛彁閱�
Database DC = new Database();
- string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'";
+ string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'true'";
try
{
@@ -168,7 +181,7 @@
{
//绔崍鑺�
Database DC = new Database();
- string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'";
+ string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'true'";
try
{
@@ -203,7 +216,7 @@
{
//涓鑺傛彁閱�
Database DC = new Database();
- string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'";
+ string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'true'";
try
{
@@ -234,7 +247,7 @@
{
//绔崍鑺�
Database DC = new Database();
- string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [[JieJiaRiWiHu]] = 'true'";
+ string sqlStr = "USE [ECTEST] UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'true'";
try
{
@@ -258,6 +271,176 @@
}
}
+ #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 = "USE [ECTEST] 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 = "USE [ECTEST] 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 = "USE [ECTEST] 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 = "USE [ECTEST] 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 = "USE [ECTEST] 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
}
--
Gitblit v1.9.1