private bool UpdateFillEntity()
        {
            this.Product = new Products
            {
                AppId         = this.CurrentAppId,
                Title         = this.txtProductTitle.Text,
                Price         = this.txtPrice.Text,
                PurchasePrice = this.txtPurchasePrice.Text,
                Quantity      = this.txtQuantity.Text,
                CategoryName  = this.cboCategory.Text,
                CategoryId    = this.GetCategoryId()
            };

            ProductsValidation        validator = new ProductsValidation();
            ValidationResult          results   = validator.Validate(Product);
            IList <ValidationFailure> failures  = results.Errors;

            if (!(results.IsValid))
            {
                foreach (ValidationFailure failure in failures)
                {
                    MessageBox.Show(failure.ErrorMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return(false);
                }
            }
            return(true);
        }
        private bool FillEntity()
        {
            this.Product = new Products
            {
                AppId         = InventoryRepo.GetAppId(),
                Title         = this.txtProductTitle.Text,
                Price         = this.txtPrice.Text,
                PurchasePrice = this.txtPurchasePrice.Text,
                Quantity      = this.txtQuantity.Text
            };

            if (!this.CategoryFillEntity())
            {
                return(false);
            }

            this.Product.CategoryName = this.cboCategory.Text;
            this.Product.CategoryId   = this.GetCategoryId();


            ProductsValidation        validator = new ProductsValidation();
            ValidationResult          results   = validator.Validate(this.Product);
            IList <ValidationFailure> failures  = results.Errors;

            if (!(results.IsValid))
            {
                foreach (ValidationFailure failure in failures)
                {
                    MessageBox.Show(failure.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return(false);
                }
            }
            return(true);
        }