示例#1
0
 public MainPage()
 {
     InitializeComponent();
     partLocations1.Visibility = Visibility.Collapsed;
     viewModel        = new PartInventoryViewModel();
     this.DataContext = viewModel;
 }
示例#2
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            PartInventoryViewModel viewModel = (PartInventoryViewModel)this.DataContext;

            string error = viewModel.InventoryLocationSaved();

            if (error != null)
            {
                MessageBox.Show(error);
            }
        }
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            PartInventoryViewModel model = this.DataContext as PartInventoryViewModel;

            if (model != null)
            {
                //edit existing location
                if (model.CurrentItem.InventoryItem != null && !string.IsNullOrEmpty(quantityTextBox.Text))
                {
                    model.CurrentItem.InventoryItem.Quantity  = int.Parse(quantityTextBox.Text);
                    model.CurrentItem.InventoryItem.BinNumber = binTextBox.Text;
                    model.UpdateInventoryLocation();
                }
            }
            this.Visibility = Visibility.Collapsed;
        }
示例#4
0
        /// <summary>
        /// convert part to part inventory list model
        /// </summary>
        /// <param name="part"></param>
        /// <returns></returns>
        public PartInventoryViewModel ConvertToListView(Part part)
        {
            PartInventoryViewModel model = new PartInventoryViewModel();

            var _partRepository            = new PartRepository();
            var _dynamicsPartRepository    = new PartDynamicsRepository();
            var _foundryOrderRepository    = new FoundryOrderRepository();
            var _dynamicsReceiptRepository = new ReceiptDynamicsRepository();

            var dynamicsPartQty    = _dynamicsPartRepository.GetPartQuantityMaster(part.Number);
            var dynamicsPartStatus = _dynamicsPartRepository.GetItemStatus(part.Number);
            var dynamicsPartSales  = _dynamicsPartRepository.GetItemSales(part.Number);

            model.PartId          = part.PartId;
            model.PartNumber      = part.Number;
            model.CustomerId      = part.CustomerId;
            model.FoundryId       = part.FoundryId;
            model.QuantityOnHand  = (dynamicsPartStatus != null) ? Math.Round(dynamicsPartStatus.Quantity_on_Hand, 2) : 0.00m;
            model.Cost            = (dynamicsPartStatus != null) ? Math.Round(dynamicsPartStatus.Cost, 2) : 0.00m;
            model.OnOrderQuantity = (dynamicsPartQty != null) ? Math.Round(dynamicsPartQty.QTYONORD, 2) : 0.00m;
            model.ReceiptDate     = (dynamicsPartStatus != null && dynamicsPartStatus.Last_Receipt_Date != null) ? dynamicsPartStatus.Last_Receipt_Date : DateTime.MinValue;
            model.ReceiptDateStr  = (dynamicsPartStatus != null && dynamicsPartStatus.Last_Receipt_Date != null) ? dynamicsPartStatus.Last_Receipt_Date.ToShortDateString() : "N/A";
            model.ReceiptQuantity = (dynamicsPartQty != null) ? Math.Round(dynamicsPartQty.LRCPTQTY, 2) : 0.00m;
            model.SalesDate       = (dynamicsPartStatus != null && dynamicsPartStatus.Last_Sale_Date != null) ? dynamicsPartStatus.Last_Sale_Date : DateTime.MinValue;
            model.SalesDateStr    = (dynamicsPartStatus != null && dynamicsPartStatus.Last_Sale_Date != null) ? dynamicsPartStatus.Last_Sale_Date.ToShortDateString() : "N/A";
            model.YearToDateSales = (dynamicsPartSales != null) ? Math.Round(dynamicsPartSales.YTD_SALES, 2) : 0.00m;

            if (_partRepository != null)
            {
                _partRepository.Dispose();
                _partRepository = null;
            }

            if (_dynamicsPartRepository != null)
            {
                _dynamicsPartRepository.Dispose();
                _dynamicsPartRepository = null;
            }

            return(model);
        }
示例#5
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            // we only allow update, not add, in the RI.
            PartInventoryViewModel model = DataContext as PartInventoryViewModel;

            if (model != null && model.CurrentItem != null && model.CurrentItem.InventoryItem != null)
            {
                model.CurrentItem.InventoryItem.BinNumber = binTextBox.Text;
                if (!string.IsNullOrEmpty(quantityTextBox.Text))
                {
                    model.CurrentItem.InventoryItem.Quantity = int.Parse(quantityTextBox.Text);
                }
                else
                {
                    model.CurrentItem.InventoryItem.Quantity = 0;
                }
                model.UpdateInventoryLocation();

                this.Visibility = Visibility.Collapsed;
            }
        }
示例#6
0
 public MainPage()
 {
     InitializeComponent();
     viewModel        = new PartInventoryViewModel();
     this.DataContext = viewModel;
 }