/// <summary>
 /// 冻结规则管理器对象【序列化】
 /// </summary>
 /// <param name="manager"></param>
 public static void FreezeOrderSpecificationManager(OrderSpecificationManager manager)
 {
     using (Stream stream = File.Open(SpecificationFileName, FileMode.Create))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         formatter.Serialize(stream, manager);
     }
 }
        /// <summary>
        /// 创建一个用来检查提交订单相关的规则管理器
        /// </summary>
        /// <returns></returns>
        public static OrderSpecificationManager CreateNewOrderSpecificationManager()
        {
            OrderSpecificationManager result = new OrderSpecificationManager()
            {
                Specifcation = new Dictionary <CustomerType, OrderSpecifcationIndex>()
            };

            SubmitOrderSpecification specification = new SubmitOrderSpecification();

            result.Specifcation.Add(CustomerType.Vip, specification.CheckSubmitVipOrder);
            result.Specifcation.Add(CustomerType.Normal, specification.CheckSubmitNormalOrder);

            return(result);
        }
示例#3
0
 public OrderBusiness(OrderSpecificationManager orderSpecManager)
 {
     this._orderSpecManager = orderSpecManager;
 }