public void SaveChanges()
        {
            ToBuysData toBuysData = new ToBuysData();
            int        counter    = 0;

            foreach (var item in ProductsToBuy)
            {
                if (InputHelper.isCorrectWareHouseProductToBuy(item))
                {
                    OPostModel postModel = new OPostModel()
                    {
                        ProductId        = item.ProductId,
                        ProductQuantity  = item.QuantityInStock,
                        ProductNetPrice  = item.NetPrice,
                        ProductSellPrice = item.SellPrice,
                        ClientId         = SelectedClient.Id
                    };
                    toBuysData.UpdateToBuy(postModel);
                    counter++;
                }
                else
                {
                    MessageBox.Show(InputHelper.isWrongWareHouseProductMassageToBuy(item));
                    break;
                }
            }
            if (counter == ProductsToBuy.Count)
            {
                MessageBox.Show("Замовлення успішно оновлено.");
            }
        }
 public void UpdateToBuy(OPostModel model)
 {
     try
     {
         SqlDataAccess sql = new SqlDataAccess();
         sql.SaveData("dbo.spToBuysUpdate", model, "WMData");
     }
     catch (Exception ex)
     {
         throw new InvalidDataException($"PostToBuy(OPostModel model) coundn't post data (model.ProductId = {model.ProductId}).", ex);
     }
 }