Пример #1
0
 public void Update(IProductInfo info)
 {
     Name          = info.Name;
     Description   = info.Description;
     Price         = info.Price;
     DeliveryPrice = info.DeliveryPrice;
 }
Пример #2
0
        public static Product SyncProduct(Product product, IProductInfo schema)
        {
            product.Toolkit.Id = schema.Toolkit.Id;
            product.Toolkit.Version = schema.Toolkit.Version;

            SyncContainer(product, schema);

            return product;
        }
Пример #3
0
 public ProductInfoViewModel(IProductInfo productInfo)
 {
     ProductName    = productInfo.ProductName;
     CopyrightNote  = productInfo.CopyrightNote;
     ProductVersion = productInfo.ProductVersion;
     LicenceUrl     = productInfo.LicenceUrl;
     ProjectUrl     = productInfo.ProjectUrl;
     SourceUrl      = productInfo.SourceUrl;
 }
Пример #4
0
        /// <summary>
        /// 指定されたアプリケーションに対してハンドルされていない例外の発生を監視します。
        /// </summary>
        /// <param name="application">アプリケーション</param>
        /// <param name="logger">ロガー</param>
        /// <param name="productInfo">プロダクト情報</param>
        public static void Observe(Application application, ILoggerFacade logger, IProductInfo productInfo)
        {
            if (_isObserved)
            {
                throw new InvalidOperationException();
            }

            _isObserved = true;

            Logger      = logger;
            ProductInfo = productInfo;

            application.DispatcherUnhandledException   += App_DispatcherUnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }
Пример #5
0
        /// <summary>
        /// Adds the product.
        /// </summary>
        /// <param name="cartId">The cart identifier.</param>
        /// <param name="product">The product.</param>
        /// <returns>
        /// The added cart
        /// </returns>
        public bool AddProduct(Guid cartId, IProductInfo product)
        {
            ICartInfo existingCart = this.Request <CartInfo>(HttpMethod.Get, cartId);

            if (existingCart == null || existingCart.Products.Any(p => p.ProductId.Equals(product.ProductId)))
            {
                return(false);
            }

            ICartInfo cart = new CartInfo()
            {
                CartId      = cartId,
                ProductsRaw = new ProductInfo[] { product as ProductInfo }
            };

            return(this.Request <CartInfo>(HttpMethod.Put, null, cart) != null);
        }
Пример #6
0
        /// <summary>
        /// Returns the entry with the id
        /// </summary>
        public IProductInfo Get(int id)
        {
            IProductInfo result = null;

            var comm = GetCommand(MySql_Get);

            comm.Parameters.Add(new MySqlParameter("id", id));

            using (MySqlDataReader dr = comm.ExecuteReader())
            {
                while (dr.Read())
                {
                    result = new ProductInfo(dr.GetInt64("pro_identi"), dr.GetString("pro_name"), dr.GetDouble("pro_price"), dr.GetString("pro_descri"));
                }
            }

            return(result);
        }
Пример #7
0
        public void AddItem(OrderItem item, IProductInfo product)
        {
            switch (_state)
            {
                case OrderState.Cancelled:
                    throw new InvalidStateException(
                        "You can't add an item. This order is already cancelled. Place a new order.");
                case OrderState.Paid:
                    throw new InvalidStateException("You can't change this order. It's already paid. Place a new order.");
            }

            var priceForNewItem = item.Quantity*product.Price;
            var e = new OrderItemAdded(
                Id,
                _location,
                _items.ToArray(),
                item,
                _price + priceForNewItem);
            ApplyChange(e);
        }
Пример #8
0
        public Order(
            Guid orderId,
            DiningLocation diningLocation,
            OrderItem[] orderItems,
            IProductInfo[] products)
            : this()
        {
            var price = orderItems
                .Select(i => new
                                 {
                                     product = products.Single(p => p.MenuItemId == i.MenuItemId),
                                     item = i
                                 })
                .Select(i => i.item.Quantity*i.product.Price)
                .Sum();

            var e = new OrderPlaced(
                orderId,
                diningLocation,
                orderItems,
                price);
            ApplyChange(e);
        }
Пример #9
0
 public bool Save(IProductInfo product)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="productInfo">商品信息</param>
 public FrmCreateOrder(IProductInfo productInfo)
 {
     InitializeComponent();
     this.mProductInfo = productInfo;
     Init();
 }
Пример #11
0
 public bool Update(IProductInfo product)
 {
     return(Product.GetInstance().Update(product));
 }
Пример #12
0
 public bool Delete(IProductInfo product)
 {
     return(Product.GetInstance().Delete(product));
 }
Пример #13
0
 public bool Save(IProductInfo product)
 {
     return(Product.GetInstance().Save(product));
 }
 public TestUpdateManager(IProductInfo productInfo, string versionMetadataPath) : base(productInfo.AppDataPath, versionMetadataPath)
 {
 }
Пример #15
0
 /// <summary>
 /// このクラスの新しいインスタンスを生成します。
 /// </summary>
 /// <param name="logger">ロガー</param>
 /// <param name="productInfo">プロダクト情報</param>
 /// <param name="process">プロセス情報</param>
 public SharedDataStore(ILoggerFacade logger, IProductInfo productInfo, Process process)
 {
     this._logger      = logger;
     this._productInfo = productInfo;
     this._process     = process;
 }