internal void NotifyResetAccountRisk(Account account, DateTime time) { lock (this._ToBeSendEntitiesLock) { this._ToBeSendEntities.Enqueue(AccountRisk.Create(account, time, (int)AlertLevel.Normal)); } this._HasToBeSendEntityEvent.Set(); }
internal void NotifyAccountRisk(AccountRisk accountRisk) { if (!this.CanNotify()) { return; } Logger.InfoFormat("NotifyAccountRisk {0}", accountRisk); _emailNotifier.NotifyAccountRisk(accountRisk); }
internal void NotifyAccountRisk(AccountRisk accountRisk) { //DateTime alertTime = DateTime.Parse(accountNode.Attributes["AlertTime"].Value); //decimal balance = decimal.Parse(accountNode.Attributes["Balance"].Value); //decimal necessary = decimal.Parse(accountNode.Attributes["Necessary"].Value); //decimal equity = decimal.Parse(accountNode.Attributes["Equity"].Value); lock (this._ToBeSendEntitiesLock) { this._ToBeSendEntities.Enqueue(accountRisk); } this._HasToBeSendEntityEvent.Set(); }
internal static AccountRisk Create(Account account, DateTime time, Transaction[] cutTrans) { AccountRisk accountRisk = AccountRisk.Create(account, time, (int)account.AlertLevel); if (cutTrans != null && cutTrans.Length > 0) { List <string> codes = new List <string>(cutTrans.Length); foreach (Transaction tran in cutTrans) { foreach (Order order in tran.Orders) { codes.Add(order.Code); } } accountRisk.TransactionCodes = codes.ToArray(); } else { accountRisk.TransactionCodes = null; } return(accountRisk); }
private void Send(object emailEntity) { try { Execution execution = emailEntity as Execution; if (execution != null) { Logger.InfoFormat("TransactonServer.NotifyExecution(before send) OrderId= {0}", execution.OrderId); this._EmailService.NotifyOrderExecuted(execution.OrderId); Logger.InfoFormat("TransactonServer.NotifyExecution(after send) OrderId= {0}", execution.OrderId); return; } AccountRisk accountRisk = emailEntity as AccountRisk; if (accountRisk != null) { this._EmailService.NotifyRiskLevelChanged(accountRisk.ToRiskLevelChangedInfo()); return; } BalanceInfo balanceInfo = emailEntity as BalanceInfo; if (balanceInfo != null) { this._EmailService.NotifyBalanceChanged(balanceInfo); return; } OrderDeleted orderDeleted = emailEntity as OrderDeleted; if (orderDeleted != null) { this._EmailService.NotifyOrderDeleted(orderDeleted.OrderId); return; } TradeDayReset tradeDayReset = emailEntity as TradeDayReset; if (tradeDayReset != null) { this._EmailService.NotifyResetStatement(tradeDayReset.TradeDay.Day); this.SetTradeDayResetEmailGenerated(tradeDayReset.TradeDay.Day); return; } PasswordResetInfo passwordResetInfo = emailEntity as PasswordResetInfo; if (passwordResetInfo != null) { this._EmailService.NotifyPasswordReset(passwordResetInfo); } VerificationCodeInfo verificationCodeInfo = emailEntity as VerificationCodeInfo; if (verificationCodeInfo != null) { this._EmailService.NotifyTelephonePinReset(verificationCodeInfo); } ApplyDelivery applyDelivery = emailEntity as ApplyDelivery; if (applyDelivery != null) { this._EmailService.NotifyDeliveryListing(applyDelivery.DeliveryRequestId); } } catch (Exception exception) { Logger.Error(emailEntity.ToString(), exception); } }