Пример #1
0
 Backend.Objects.SaleItem ToSaleItem(Backend.Objects.Product product)
 {
     return(new Backend.Objects.SaleItem
     {
         Product = product,
     });
 }
Пример #2
0
        void Initialize()
        {
            user    = Util.Data.GetUser();
            store   = Util.Data.GetStore();
            product = ProductObject;

            //Get Task
            if (Task == Enums.Task.Get || Task == Enums.Task.Update)
            {
                GetProduct();
            }
            else if (Task == Enums.Task.Create)
            {
                product = new Backend.Objects.Product
                {
                    Supplier = new Backend.Objects.ProductSupplier(),
                    Brand    = new Backend.Objects.ProductBrand(),
                    Type     = new Backend.Objects.ProductType(),
                    Tax      = new Backend.Objects.Tax()
                };

                txtCustomBarcode.Text = ServerUtil.RandomDigits(13);
                btnDelete.Visible     = false;
            }

            sign_currency1.Text = sign_currency2.Text = store.CurrencySign;

            // Add DropDown Items
            SetDropDownItems();

            Translate();
        }
Пример #3
0
        void GetProduct(Backend.Objects.Product product = null)
        {
            product = product ?? Product;

            //Get
            if (product is object && User is object && Store is object)
            {
                lblProductName.Text    = product.Name;
                lblProductId.Text      = product.Id;
                lblProductPrice.Text   = string.Format("{0} {1}", Store.CurrencySign, product.RetailPrice.ToString());
                lblProductBarcode.Text = product.Barcode;
                lblCurrentStock.Text   = product.Stock.ToString();

                // If is from Search Item then Get Supplier .. Since the couldn't be fetched in another query
                if (product.IsSearchItem)
                {
                    product.Supplier = ProductSupplier.GetSupplier(product.Supplier.Id);
                    product.Image    = Backend.Database.Queries.Product.GetImage(product.ImageBlobId, product.Name, product.Color);
                    //Update
                    Product = product;
                }

                imgProductImage.Image      = product.Image;
                lblProductSupplier.Text    = product.Supplier.Name;
                lblProductSupplyPrice.Text = product.SupplyPrice.ToString();
                lblProductPrice.Text       = product.RetailPrice.ToString();
            }
            else
            {
                Alert.Show("Error", $"Something wrong occured", Alert.AlertType.Error);
            }
        }
Пример #4
0
        void AddProductToCheckout(Backend.Objects.Product product)
        {
            // Increment to 1 Since OnClick adds 1
            decimal quantity = 1;

            // Get Balance Value if Required else add 1
            if (product.IsBalanceRequired)
            {
                quantity = GetBalanceValue();
            }

            /** Add Product To Checkout only if it doesn't contains it else, update Quantity * */
            foreach (ProductCheckout productCheckout in CheckoutGrid.Controls)
            {
                if (productCheckout.Item.Product.Id == product.Id)
                {
                    productCheckout.Item.Quantity += quantity;
                    //Update
                    productCheckout.OnQuantityUpdated();
                    return;
                }
            }

            var saleItem = ToSaleItem(product);

            saleItem.Quantity += quantity;

            // Add a new Item to Checkout
            AddProductToCheckoutGrid(saleItem);

            // Update
            UpdateCheckout();
        }
Пример #5
0
 Backend.Objects.DiscountProduct ToProductDiscount(Backend.Objects.Product product)
 {
     return(new Backend.Objects.DiscountProduct
     {
         ProductId = product.Id,
         DiscountId = discount.Id,
     });
 }
Пример #6
0
        public void OnAddProduct(object sender, EventArgs e)
        {
            var product = (Backend.Objects.Product)sender;

            Product = product;
            GetProduct(product);

            // Render Product in Cards
            RenderCards(true);
        }
Пример #7
0
        void Get(Backend.Objects.Product product)
        {
            lblProductName.Text     = product.Name;
            lblProductBarcode.Text  = product.Barcode;
            lblProductQuantity.Text = lblProductQuantity_Card.Text = Item.Quantity.ToString();
            lblProductPrice.Text    = lblProductPrice_Sub.Text = string.Format("{0} {1}", Currency,
                                                                               ToRoundedString(product.Price));

            imgProductImage.Image    = product.Image;
            lblDiscountPrice.Visible = product.IsDiscounted;
            Indicator.BackColor      = cardProductQuantity.BackColor = cardProductQuantity.color = lblShowProductDetails.ForeColor = product.Color;
        }
Пример #8
0
        void AddProductToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ InventoryGrid ] With Rows
            InventoryReportModel inventoryReportModel = new InventoryReportModel
            {
                Product  = product,
                Currency = Store.CurrencySign,
            };

            //Add To Grid
            InventoryGrid.Controls.Add(inventoryReportModel);
        }
Пример #9
0
        void AddTopProductToGrid(Backend.Objects.Product product, int medalIndex)
        {
            //Fill Grid [ TopSoldProductsGrid ] With Rows
            TopSoldProductModel productModel = new TopSoldProductModel
            {
                Product    = product,
                Currency   = Currency,
                MedalIndex = medalIndex,
            };

            //Add To Grid
            TopSoldProductsGrid.Controls.Add(productModel);
        }
Пример #10
0
        void AddProductToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ ProductsGrid ] With Rows
            ProductModel productModel = new ProductModel
            {
                OnDelete = OnDeleteProduct,
                Product  = product,
                User     = User,
                Store    = Store,
            };

            //Add To Grid
            ProductsGrid.Controls.Add(productModel);
        }
Пример #11
0
        void AddProductToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ ProductsGrid ] With Rows
            DiscountProductModel productModel = new DiscountProductModel
            {
                Product       = product,
                Currency      = Store.CurrencySign,
                DiscountValue = Discount.Value,
                DiscountType  = Discount.Type,
            };

            //Add To Grid
            ProductsGrid.Controls.Add(productModel);
        }
Пример #12
0
        void AddItemToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ ItemsGrid ] With Rows
            ProductItemModel productItemModel = new ProductItemModel
            {
                OnAdd        = OnAddItem,
                Product      = product,
                User         = User,
                Store        = Store,
                IsSearchItem = true,
            };

            //Add To Grid
            ItemsGrid.Controls.Add(productItemModel);
        }
Пример #13
0
        void AddProductToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ ProductsGrid ] With Rows
            ProductSellModel productModel = new ProductSellModel
            {
                OnAdd    = OnAddProductToCheckout,
                OnSelect = OnSelectProduct,
                Product  = product,
                User     = Sale.User,
                Store    = Sale.Store,
            };

            //Add To Grid
            ProductsGrid.Controls.Add(productModel);
        }
Пример #14
0
        void UploadProductImage(Backend.Objects.Product product)
        {
            Backend.Objects.File file = new Backend.Objects.File
            {
                SystemFileName = LocalImagePath,
                Extension      = ".jpg",
                ServerFolder   = ServerConstants.ServerFolderPath,
            };
            // Returns BlobId
            var response = QueryController.Blob.Create(file);
            var _file    = (Backend.Objects.File)response.Data;

            // Update ImageBlobId
            QueryController.Products.Product.UpdateImage(product, _file);
            product.Image = imgProductImage.Image;
        }
Пример #15
0
        void AddProductToGrid(Backend.Objects.Product product)
        {
            //Fill Grid [ ItemsGrid ] With Rows
            ProductItemModel productItemModel = new ProductItemModel
            {
                //OnAdd = OnAddProduct,
                OnDelete  = OnRemoveProduct,
                Product   = product,
                User      = User,
                Store     = Store,
                CanDelete = true,
            };

            //Add To Grid
            ProductDiscountsGrid.Controls.Add(productItemModel);
        }
Пример #16
0
        public bool IsProductInCheckout(Backend.Objects.Product product)
        {
            foreach (ProductCheckout productCheckout in CheckoutGrid.Controls)
            {
                if (productCheckout.Item.Product.Id == product.Id)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }