Ejemplo n.º 1
0
        public static void AddPosition(string code, string number)
        {
            var info = WareHouseDBController.Find(code);

            if (info.Any())
            {
                var amount = number.Length != 0
                    ? double.Parse(number, CultureInfo.InvariantCulture)
                    : 1;
                var item = new CheckLine(new ProductData(info), amount);
                var availablePosition = ItemsPositions.Where(x => (x as CheckLine).Data.EAN13 == code);
                if (availablePosition.Any())
                {
                    (availablePosition.FirstOrDefault() as CheckLine).Amount += amount;
                }
                else
                {
                    ItemsPositions.Add(item);
                }
            }
            else
            {
                MessageBox.Show(String.Format(LanguageEngine.Language["FastInvoiceActivity AddPositionErrorMessageBox"], code),
                                LanguageEngine.Language["FastInvoiceActivity AddPositionErrorMessageBoxTitle"], MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 2
0
 public static void AddPositionForSaving(string code)
 {
     if (code.Length == 13)
     {
         var availablePosition = ItemsPositions.Where(x => (x as DBProductData).Data.EAN13 == code);
         if (availablePosition.Any())
         {
             MessageBox.Show(String.Format(LanguageEngine.Language["WareHouseActivity PositionContainsQuestion"], code),
                             LanguageEngine.Language["WareHouseActivity PositionContainsQuestionTitle"], MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             var info = WareHouseDBController.Find(code);
             if (!info.Any())
             {
                 ItemsPositions.Add(new DBProductData(new ProductData(code), false));
             }
             else if (MessageBox.Show(String.Format(LanguageEngine.Language["WareHouseActivity ContainsQuestion"], code),
                                      LanguageEngine.Language["WareHouseActivity ContainsQuestionTitle"], MessageBoxButton.YesNo,
                                      MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 if (!ItemsPositions.Where(x => (x as DBProductData).Data.EAN13 == code).Any())
                 {
                     ItemsPositions.Add(new DBProductData(new ProductData(info), true));
                 }
             }
         }
     }
     else
     {
         MessageBox.Show(LanguageEngine.Language["WareHouseActivity EAN13FormatError"],
                         LanguageEngine.Language["WareHouseActivity EAN13FormatErrorTitle"], MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }