private void filetr_detail() { app_location app_location = app_branchapp_locationViewSource.View.CurrentItem as app_location; item_inventory item_inventory = item_inventoryViewSource.View.CurrentItem as item_inventory; if (app_location != null) { if (item_inventoryitem_inventory_detailViewSource != null) { if (item_inventoryitem_inventory_detailViewSource.View != null) { item_inventoryitem_inventory_detailViewSource.View.Filter = i => { item_inventory_detail item_inventory_detail = (item_inventory_detail)i; if (item_inventory_detail.id_location == app_location.id_location && item_inventory_detail.id_inventory == item_inventory.id_inventory) { return(true); } else { return(false); } }; } } } TextBox_TextChanged(null, null); }
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { app_location app_location = app_branchapp_locationViewSource.View.CurrentItem as app_location; if (app_location != null) { if (item_inventoryitem_inventory_detailViewSource != null) { if (item_inventoryitem_inventory_detailViewSource.View != null) { item_inventoryitem_inventory_detailViewSource.View.Filter = i => { item_inventory_detail item_inventory_detail = (item_inventory_detail)i; if ((item_inventory_detail.item_product.item.name.ToUpper().Contains(txtsearch.Text.ToUpper()) || item_inventory_detail.item_product.item.code.ToUpper().Contains(txtsearch.Text.ToUpper())) && app_location.id_location == item_inventory_detail.id_location) { return(true); } else { return(false); } }; } } } }
private void BindItemMovement() { item_inventory item_inventory = null; app_location app_location = null; item_inventory = (item_inventory)item_inventoryViewSource.View.CurrentItem; app_location = app_branchapp_locationViewSource.View.CurrentItem as app_location; if (app_location != null && item_inventory != null) { if (item_inventory.item_inventory_detail.Where(x => x.id_location == app_location.id_location).Count() == 0) { if (app_location != null) { List <item_product> item_productLIST = InventoryDB.item_product.Where(x => x.id_company == CurrentSession.Id_Company && x.item.is_active).ToList(); Class.StockCalculations Stock = new Class.StockCalculations(); List <Class.StockList> StockList = Stock.ByBranchLocation(app_location.id_location, DateTime.Now); foreach (item_product i in item_productLIST) { item_inventory_detail item_inventory_detail = new item_inventory_detail(); item_inventory_detail.State = EntityState.Added; item_inventory_detail.item_product = i; item_inventory_detail.id_item_product = i.id_item_product; item_inventory_detail.app_location = app_location; item_inventory_detail.id_location = app_location.id_location; item_inventory_detail.timestamp = DateTime.Now; if (StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault() != null) { item_inventory_detail.value_system = StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault().Quantity; item_inventory_detail.unit_value = StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault().Cost; } else { item_inventory_detail.value_system = 0; } if (CurrencyID > 0) { item_inventory_detail.id_currencyfx = CurrencyID; } item_inventory.item_inventory_detail.Add(item_inventory_detail); } } } item_inventoryitem_inventory_detailViewSource.View.Refresh(); filetr_detail(); } }
private void EditCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { crud_modal.Children.Clear(); crud_modal.Visibility = Visibility.Hidden; item_inventory_detail item_inventory_detail = e.Parameter as item_inventory_detail; item_inventory item_inventory = (item_inventory)item_inventoryDataGrid.SelectedItem; if (item_inventory_detail != null) { crud_modal.Visibility = System.Windows.Visibility.Visible; objpnl_ItemMovement = new cntrl.Panels.pnl_ItemMovement(); foreach (item_inventory_detail _item_inventory_detail in item_inventoryitem_inventory_detailViewSource.View.OfType <item_inventory_detail>().Where(x => x.id_item_product == item_inventory_detail.id_item_product).ToList()) { if (_item_inventory_detail.item_inventory_dimension.Count() == 0) { if (InventoryDB.item_dimension.Where(x => x.id_item == _item_inventory_detail.item_product.id_item).ToList() != null) { List <item_dimension> item_dimensionList = InventoryDB.item_dimension.Where(x => x.id_item == _item_inventory_detail.item_product.id_item).ToList(); foreach (item_dimension item_dimension in item_dimensionList) { item_inventory_dimension item_inventory_dimension = new item_inventory_dimension(); item_inventory_dimension.id_dimension = item_dimension.id_app_dimension; item_inventory_dimension.value = item_dimension.value; // item_inventory_dimension.id_measurement = item_dimension.id_measurement; item_inventory_detail.item_inventory_dimension.Add(item_inventory_dimension); } } } _item_inventory_detail.IsSelected = true; } objpnl_ItemMovement.item_inventoryList = item_inventoryitem_inventory_detailViewSource.View.OfType <item_inventory_detail>().Where(x => x.id_item_product == item_inventory_detail.id_item_product).ToList(); objpnl_ItemMovement.InventoryDB = InventoryDB; crud_modal.Children.Add(objpnl_ItemMovement); } }
public void add_item(item_inventory_detail item_inventory_detail) { item_inventory_detail.id_inventory = item_inventoryList.FirstOrDefault().id_inventory; // item_inventory_detail.item_inventory = item_inventoryList.FirstOrDefault().item_inventory; item_inventory_detail.value_system = item_inventoryList.FirstOrDefault().value_system; item_inventory_detail.id_item_product = item_inventoryList.FirstOrDefault().id_item_product; item_inventory_detail.item_product = item_inventoryList.FirstOrDefault().item_product; item_inventory_detail.id_location = item_inventoryList.FirstOrDefault().id_location; item_inventory_detail.IsSelected = true; item_inventory_detail.State = EntityState.Added; item_inventory_detail.timestamp = item_inventoryList.FirstOrDefault().item_inventory.trans_date; if (InventoryDB.app_currencyfx.Where(x => x.app_currency.is_priority && x.is_active).FirstOrDefault() != null) { item_inventory_detail.id_currencyfx = InventoryDB.app_currencyfx.Where(x => x.app_currency.is_priority && x.is_active).FirstOrDefault().id_currencyfx; } item_inventoryList.FirstOrDefault().item_inventory.item_inventory_detail.Add(item_inventory_detail); if (item_inventory_detail.id_item_product > 0) { if (InventoryDB.item_product.Where(x => x.id_item_product == item_inventory_detail.id_item_product).FirstOrDefault() != null) { item_product item_product = InventoryDB.item_product.Where(x => x.id_item_product == item_inventory_detail.id_item_product).FirstOrDefault(); if (InventoryDB.item_dimension.Where(x => x.id_item == item_product.id_item).ToList() != null) { List <item_dimension> item_dimensionList = InventoryDB.item_dimension.Where(x => x.id_item == item_product.id_item).ToList(); foreach (item_dimension item_dimension in item_dimensionList) { item_inventory_dimension item_inventory_dimension = new item_inventory_dimension(); item_inventory_dimension.id_dimension = item_dimension.id_app_dimension; item_inventory_dimension.value = item_dimension.value; // item_inventory_dimension.id_measurement = item_dimension.id_measurement; item_inventory_detail.item_inventory_dimension.Add(item_inventory_dimension); } } } } }
private void item_transfer_detailDataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) { item_inventory_detail item_inventory_detail = e.NewItem as item_inventory_detail; add_item(item_inventory_detail); }