/// <summary> /// Dequote /// </summary> public static string Dequote(this IQuotation rule, string value) { if (rule is null) { throw new ArgumentNullException(nameof(rule)); } if (value is null) { throw new ArgumentNullException(nameof(value)); } if (rule.TryDequote(value, out string result)) { return(result); } throw new FormatException("Failed to return quoatation."); }
/// <summary> /// Adds a stock price /// </summary> /// <remarks>Checks if quotation already exists, but has changed</remarks> public void AddOrChangeQuotation(IQuotation quotation) { if (Quotations.Contains(quotation)) { var existentQuotation = Quotations.FirstOrDefault(q => q.Date.Equals(quotation.Date)); if (existentQuotation != null && existentQuotation.Open == quotation.Open && existentQuotation.Close == quotation.Close && existentQuotation.High == quotation.High && existentQuotation.Low == quotation.Low) { return; } ApplyChange(new StockQuotationChangedEvent(Id, typeof(StockAggregate), quotation)); } else { ApplyChange(new StockQuotationAddedEvent(Id, typeof(StockAggregate), quotation)); } }
/// <summary> /// Adds a stock price /// </summary> /// <remarks>Checks if quotation already exists, but has changed</remarks> public void AddQuotation(IQuotation quotation) { if (_quotations.ContainsKey(quotation.Date)) { var existentQuotation = _quotations[quotation.Date]; if (existentQuotation.Open == quotation.Open && existentQuotation.Close == quotation.Close && existentQuotation.High == quotation.High && existentQuotation.Low == quotation.Low) { return; } _quotations.Remove(quotation.Date); _quotations.Add(quotation.Date, quotation); } else { _quotations.Add(quotation.Date, quotation); } }
public CustomerDetail(DiduContext _diduContext, IQuotation quotation) { _context = _diduContext; _quotation = quotation; }
/// <summary> /// Initializes a new instance of the <see cref="StockQuotationAddedEvent"/> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="aggregateType">Type of the aggregate.</param> /// <param name="quotation">The quotation.</param> public StockQuotationAddedEvent(Guid id, Type aggregateType, IQuotation quotation) : base(id, aggregateType) { Quotation = quotation; }
/// <summary> /// Dequote /// </summary> /// <param name="source">String to Dequote</param> /// <param name="rule">Rule to Use</param> /// <returns>Dequoted String</returns> public static string Dequote(this string source, IQuotation rule) { rule ??= Quotation.Default; return(rule.Dequote(source)); }
/// <summary> /// Try Dequote /// </summary> /// <param name="source">String to Dequote</param> /// <param name="result">Dequoted string or null</param> /// <param name="rule">Rule to use</param> /// <returns>true if dequoted, false otherwise</returns> public static bool TryDequote(this string source, out string result, IQuotation rule) { rule ??= Quotation.Default; return(rule.TryDequote(source, out result)); }
/// <summary> /// 获取报价单日期年度列表 /// </summary> /// <returns></returns> public List <string> GetOrderYearList() { IQuotation dal = baseDal as IQuotation; return(dal.GetOrderYearList()); }
/// <summary> /// Initializs this object with the given values /// </summary> /// <param name="stockId">The id if the stock</param> /// <param name="stockVersion">The version of the stock</param> /// <param name="quotation">The quotation</param> public StockQuotationAddOrChangeCommand(Guid stockId, int stockVersion, IQuotation quotation) : base(stockVersion, stockId) { Quotation = quotation; }