Esempio n. 1
0
        /// <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.");
        }
Esempio n. 2
0
        /// <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));
            }
        }
Esempio n. 3
0
        /// <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);
            }
        }
Esempio n. 4
0
 public CustomerDetail(DiduContext _diduContext, IQuotation quotation)
 {
     _context   = _diduContext;
     _quotation = quotation;
 }
Esempio n. 5
0
 /// <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;
 }
Esempio n. 6
0
        /// <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));
        }
Esempio n. 7
0
        /// <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));
        }
Esempio n. 8
0
        /// <summary>
        /// 获取报价单日期年度列表
        /// </summary>
        /// <returns></returns>
        public List <string> GetOrderYearList()
        {
            IQuotation dal = baseDal as IQuotation;

            return(dal.GetOrderYearList());
        }
Esempio n. 9
0
 /// <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;
 }