private void CreateNewArticle()
 {
     try
     {
         var checkedChar = CheckInputService.CheckAllCharacteristics(AddRefTxtBox, AddNameTxtBox, AddPriceTxtBox, AddQuantTxtBox, AddAnArticleTxtBlockInfo);
         if (checkedChar == true)
         {
             if (MessageBox.Show("Etes-vous sûr de vouloir ajouté cet article au stock?", "DataGridView", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
             {
                 var newProduct = ProductManager.AddANewProductByRefChecking(AddRefTxtBox.Text, AddNameTxtBox.Text, AddExclPriceTxtBox.Text, AddPriceTxtBox.Text, AddQuantTxtBox.Text);
                 if (newProduct == null)
                 {
                     AddAnArticleTxtBlockInfo.FontSize   = 12;
                     AddAnArticleTxtBlockInfo.Foreground = new SolidColorBrush(Colors.Yellow);
                     AddAnArticleTxtBlockInfo.Text       = "L'article existe déjà";
                 }
                 else
                 {
                     AddAnArticleTxtBlockInfo.FontSize = 12;
                     AddAnArticleTxtBlockInfo.Text     = "Le nouveau produit a été intégré au stock";
                 }
                 ArticlesListManagementPage.ReloadDataGrid();
             }
         }
     }
     catch (Exception except)
     {
         AddAnArticleTxtBlockInfo.Foreground = new SolidColorBrush(Colors.Orange);
         AddAnArticleTxtBlockInfo.Text       = $"L'erreur suivante est survenue: {except.Message}";
     }
 }
        private void EditAnArticle()
        {
            try
            {
                if (MessageBox.Show("Etes-vous sûr de vouloir modifié cet article?", "DataGridView", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    var checkedChar = CheckInputService.CheckAllCharacteristics(EditRefTxtBox, EditNameTxtBox, EditPriceTxtBox, EditQuantTxtBox, EditAnArticleTxtBlockInfo);
                    if (checkedChar == false)
                    {
                        MessageBox.Show("Une erreur de saisie est survenue.");
                        SelectAnArticle();
                    }
                    else
                    {
                        ProductViewManager.CurrentItemSelected.Reference    = EditRefTxtBox.Text;
                        ProductViewManager.CurrentItemSelected.Name         = EditNameTxtBox.Text;
                        ProductViewManager.CurrentItemSelected.ExclTaxPrice = Convert.ToDouble(EditExclTaxPriceTxtBox.Text);
                        ProductViewManager.CurrentItemSelected.Price        = Convert.ToDouble(EditPriceTxtBox.Text);
                        ProductViewManager.CurrentItemSelected.Quantity     = Convert.ToDouble(EditQuantTxtBox.Text);

                        EditAnArticleTxtBlockInfo.Foreground = new SolidColorBrush(Colors.GreenYellow);
                        EditAnArticleTxtBlockInfo.Text       = "Le produit a été modifié avec succès";

                        ProductManager.UpdateAProduct(ProductViewManager.CurrentItemSelected);
                        Close();
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
예제 #3
0
 private void SetDiscountParameter()
 {
     CheckInputService.CheckDoubleTypeInput(DiscountTxtBox);
     if (CheckInputService.CorrectPickedChara == false || DiscountTxtBox.Text == "")
     {
         DiscountParameter = 0;
     }
     else
     {
         SalesParameter.Discount = Convert.ToInt32(DiscountTxtBox.Text);
         DiscountParameter       = Convert.ToInt32(DiscountTxtBox.Text);
     }
 }
예제 #4
0
 private void SetQuantityParameter()
 {
     CheckInputService.CheckDoubleTypeInput(QuantParamTxtBox);
     if (CheckInputService.CorrectPickedChara == false || QuantParamTxtBox.Text == "")
     {
         QuantityParameter = 0;
     }
     else
     {
         SalesParameter.Quantity = Convert.ToInt32(QuantParamTxtBox.Text);
         QuantityParameter       = Convert.ToInt32(QuantParamTxtBox.Text);
     }
 }
예제 #5
0
 public void SearchAnArticleToSell()
 {
     try
     {
         var input = CheckInputService.CheckStringTypeInput(SearchAnArticleToSellTxtBox);
         if (input == true)
         {
             ArticleToSellDataGrid.ItemsSource = ProductManager.GetProductByGlobalResearch(SearchAnArticleToSellTxtBox.Text);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
 private void SearchByPriceInterval()
 {
     try
     {
         var priceChecked = CheckInputService.CheckDoubleIntervalNumber(SearchMinPriceTxtBox, SearchMaxPriceTxtBox);
         if (priceChecked == true)
         {
             ProductsDataGrid.ItemsSource = ProductManager.GetProductByPriceInterval(SearchMinPriceTxtBox.Text, SearchMaxPriceTxtBox.Text);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
예제 #7
0
 private void SetAChequeAmount()
 {
     try
     {
         CheckInputService.CheckDoubleTypeInput(ChqTxtBox);
         if (CheckInputService.CorrectPickedChara == false || ChqTxtBox.Text == "")
         {
             ChequeAmount = 0;
         }
         else
         {
             SalesManagementPage.Payment.ChequePayment = Convert.ToDouble(ChqTxtBox.Text);
             ChequeAmount = Convert.ToDouble(ChqTxtBox.Text);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }