Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductDetailsViewModel"/> class.
        /// </summary>
        /// <param name="itemNumber">The item number.</param>
        public ProductDetailsViewModel(string itemNumber)
        {
            if (string.IsNullOrWhiteSpace(itemNumber))
            {
                throw new ArgumentNullException("itemNumber");
            }

            ItemDataManager dataManager = new ItemDataManager(
                PosApplication.Instance.Settings.Database.Connection,
                PosApplication.Instance.Settings.Database.DataAreaID);

            this.ProductDetails = dataManager.GetProductDetails(
                ApplicationSettings.Terminal.StorePrimaryId,
                itemNumber,
                ApplicationSettings.Terminal.CultureName);

            Image image = GUIHelper.GetBitmap(this.ProductDetails.ImageData);

            this.Image = image ?? Resources.ProductUnavailable;

            decimal price = PosApplication.Instance.Services.Price.GetItemPrice(itemNumber, this.ProductDetails.UnitOfMeasure);

            this.Price = PosApplication.Instance.Services.Rounding.RoundForDisplay(price, true, true);

            this.FormattedProductCategoryHierarchy = GetFormattedProductCategoryHierarchy();
        }