Пример #1
0
 public GRNModalItems EditGrnItems(AddGrnLineItemViewModel lineItem,List<ProductSerialNumbers> productSerials)
 {
     this.Owner = Application.Current.MainWindow;
     txtReason.IsEnabled = true;
     ComboBoxSelectedProduct.IsEnabled = false;
     _vm.LoadForEdit(lineItem, productSerials);
     ShowDialog();
     return _vm.GetModalItems();
 }
Пример #2
0
        public void LoadForEdit(AddGrnLineItemViewModel lineItem, List<ProductSerialNumbers> productSerials)
        {
            SelectedProduct = Products.First(n => n.ProductId == lineItem.ProductId);
            LineItemId = lineItem.LineItemId;
            LineItemTotal = lineItem.LineItemTotal;
            UnitCost = lineItem.UnitCost;
            Qty = lineItem.Qty;
            Expected = lineItem.Expected;
            isConsolidatedProduct = lineItem.isConsolidatedProduct;
            BreakBulk = lineItem.BreakBulk;
            Reason = lineItem.Reason;

            RecalcTotal();
            AddProducts();
            if (productSerials != null && productSerials.Any())
                productSerials.ForEach(n => ProductSerialNumbersList.Add(n));

            IsNew = false;
        }
Пример #3
0
        private void AddLineItem(Guid lineItemId, Guid productId, string productDesc, decimal unitCost, decimal qty,
            decimal expected, decimal lineItemTotal, bool isEditable, bool isconsolidatedProduct, bool breakBulk, string reason,Guid parentproductId)
        {
            var item = LineItems.FirstOrDefault(n => n.ProductId == productId);
            if (item != null)
            {
                item.ProductId = productId;
                item.Product = productDesc;
                item.UnitCost = unitCost;
                item.Qty = qty;
                item.Expected = expected;
                item.isConsolidatedProduct = isconsolidatedProduct;
                item.BreakBulk = breakBulk;
                item.Reason = reason;
                item.ParentProductId = parentproductId;
            }
            else
            {
                int sequenceNo = 1;
                if (LineItems.Any())
                {
                    sequenceNo = LineItems.Max(n => n.SequenceNo) + 1;
                }

                item = new AddGrnLineItemViewModel
                {
                    SequenceNo = sequenceNo,
                    ProductId = productId,
                    Product = productDesc,
                    UnitCost = unitCost,
                    Qty = qty,
                    Expected = expected,
                    IsEditable = isEditable,
                    LineItemId = lineItemId,
                    LineItemTotal = lineItemTotal,
                    isConsolidatedProduct = isconsolidatedProduct,
                    BreakBulk = breakBulk,
                    Reason = reason ,
                    ParentProductId = parentproductId
                };
                LineItems.Add(item);
            }
            CalcTotals();
        }
Пример #4
0
 void RemoveLineItem(AddGrnLineItemViewModel lineItem)
 {
     if (lineItem.ParentProductId != Guid.Empty)
     {
         if (MessageBox.Show("Are you sure you want to remove the selected product?", "Distributr: Confirm Action", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
         {
             var items = LineItems.Where(n => n.ParentProductId == lineItem.ParentProductId).ToList();
             foreach (var itemtoDelete in items)
             {
                 LineItems.Remove(itemtoDelete);
             }
             RefreshLineItem();
             CalcTotals();
         }
     }
   
 }
Пример #5
0
 private void EditGRN(AddGrnLineItemViewModel lineitem)
 {
     if (lineitem == null) return;
     using (var container = NestedContainer)
     {
         var serials = _inventorySerialNumbersList.Where(n => n.ProductId == lineitem.ProductId).ToList();
         var selected = Using<IGrnPopUp>(container).EditGrnItems(lineitem, serials);
         if (selected != null)                   
             
             UpdateModalItems(selected);
     }
 }