Example #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);
            }
        }
Example #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);
     }
 }
Example #3
0
 public static void SavePositionsForWarehouse()
 {
     foreach (DBProductData position in ItemsPositions)
     {
         if (position.IsInDB)
         {
             WareHouseDBController.Update(position.Data);
         }
         else
         {
             WareHouseDBController.Insert(position.Data);
             position.IsInDB = true;
         }
     }
 }
Example #4
0
        public static void ProceedPayment(Invoice invoice)
        {
            var currentUserName = CurrentUser.Name;
            var jsonStr         = JsonConvert.SerializeObject(invoice);

            PrintInvoice.Print(invoice);
            DocumentsDBController.Add(
                (int)DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds,
                currentUserName,
                jsonStr);
            foreach (CheckLine position in invoice.Positions)
            {
                WareHouseDBController.DecreaseAmountBy(position.Data.EAN13, position.Amount);
            }
            ItemsPositions.Clear();
        }
Example #5
0
 public static void DeleteFromDB(int selectedIndex)
 {
     if (ItemsPositions.Count == 0)
     {
         MessageBox.Show(LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingError"],
                         LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingErrorTitle"], MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else if (selectedIndex == -1)
     {
         if (MessageBox.Show(LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingPositions"],
                             LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingPositionsTitle"], MessageBoxButton.YesNo,
                             MessageBoxImage.Warning) == MessageBoxResult.Yes)
         {
             foreach (DBProductData position in ItemsPositions)
             {
                 if (position.IsInDB)
                 {
                     WareHouseDBController.Remove(position.Data.EAN13);
                 }
             }
             ItemsPositions.Clear();
         }
     }
     else
     {
         if ((ItemsPositions[selectedIndex] as DBProductData).IsInDB)
         {
             if (MessageBox.Show(LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingPosition"],
                                 LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingPositionTitle"], MessageBoxButton.YesNo,
                                 MessageBoxImage.Warning) == MessageBoxResult.Yes)
             {
                 var code = (ItemsPositions[selectedIndex] as DBProductData).Data.EAN13;
                 WareHouseDBController.Remove(code);
                 ItemsPositions.RemoveAt(selectedIndex);
             }
         }
         else
         {
             MessageBox.Show(LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingNotInDB"],
                             LanguageEngine.Language["WareHouseActivity DeleteFromDB DeletingNotInDBTitle"], MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }