private static bool SendBonus() { string strConn = ""; SqlConnection sqlConn = null; SqlCommand sqlCmd = null; SqlDataReader sqlReader = null; try { Loger.Debug("\r\n\r\n>>> 开始发送股权登记公告 <<<"); strConn = BaseConfig.ConnPlay; sqlConn = new SqlConnection(strConn.Trim()); if (sqlConn.State == ConnectionState.Closed) sqlConn.Open(); // string strSql = @"SELECT * FROM BonusList where BonusRegDate = @BonusRegDate"; string strSql = @"SELECT * FROM BonusList "; sqlCmd = new SqlCommand(strSql, sqlConn); sqlCmd.Parameters.Add("@BonusRegDate", SqlDbType.SmallDateTime).Value = DateTime.Today.ToString("yyyy-MM-dd"); sqlReader = sqlCmd.ExecuteReader(); Dictionary<string, Bonus> mapBonus = new Dictionary<string, Bonus>(); while (sqlReader.Read()) { int bonusId = Convert.ToInt32(sqlReader["BonusId"]); string stockCode = sqlReader["StockCode"].ToString(); int stockMarket = Convert.ToInt32(sqlReader["stockMarket"]); double sendBonus = Convert.ToDouble(sqlReader["SendBonus"]); double transferBonus = Convert.ToDouble(sqlReader["TransferBonus"]); double bonusIssue = Convert.ToDouble(sqlReader["BonusIssue"]); DateTime bonusRegDate = Convert.ToDateTime(sqlReader["BonusRegDate"]); DateTime bonusExeDate = Convert.ToDateTime(sqlReader["BonusExeDate"]); int sendFlag = Convert.ToInt32(sqlReader["SendFlag"]); Bonus currBonus = new Bonus(); currBonus.Initialize(); currBonus.StockCode = stockCode; currBonus.Market = (StockMarket)stockMarket; currBonus.SendBonus = sendBonus; currBonus.TransferBonus = transferBonus; currBonus.BonusIssue = bonusIssue; currBonus.BonusRegDate = bonusRegDate; currBonus.BonusExeDate = bonusExeDate; currBonus.SendFlag = sendFlag; mapBonus[stockCode] = currBonus; } sqlReader.Close(); Loger.Debug("mapBonus count = " + mapBonus.Count); zns.ITransactionRemotingProvider[] znRmtIobj = new zns.ITransactionRemotingProvider[BaseConfig.mapNotifySrv.Count]; for (int i = 0; i < BaseConfig.mapNotifySrv.Count; i++) { znRmtIobj[i] = Activator.GetObject(typeof(zns.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[i].ri) as zns.ITransactionRemotingProvider; } Dictionary<string, Bonus> t_mapBonus = new Dictionary<string, Bonus>(mapBonus); foreach (var data in t_mapBonus) { Bonus t_Bonus = new Bonus(); t_Bonus = data.Value; zns.Interface.RI_Result RetSetExRights = zns.Interface.RI_Result.Success; for (int i = 0; i < BaseConfig.mapNotifySrv.Count; i++) { znRmtIobj[i] = Activator.GetObject(typeof(zns.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[i].ri) as zns.ITransactionRemotingProvider; zns.ITransactionRemotingProvider rmt = znRmtIobj[i]; RetSetExRights = rmt.SetExRights("@!pH@2^!@8", t_Bonus.StockCode, (zns.Interface.RI_Market)t_Bonus.Market, t_Bonus.SendBonus, t_Bonus.TransferBonus, t_Bonus.BonusIssue, t_Bonus.BonusRegDate, t_Bonus.BonusExeDate, true); Loger.Debug("StockCode = " + data.Value.StockCode + "\t" + "status = " + RetSetExRights); } t_Bonus.SendFlag = 1; mapBonus[data.Key] = t_Bonus; } Loger.Debug("<<< 股权登记公告发送完成 >>>"); return true; } catch (Exception err) { Loger.Debug(err); if (sqlReader != null && !sqlReader.IsClosed) sqlReader.Close(); return false; } finally { if (sqlConn.State != ConnectionState.Closed) sqlConn.Close(); } }