/// <summary> /// 새로운 입출고 데이터를 등록합니다. 이 때 규격은 선택된 상태입니다. /// </summary> /// <param name="inventory"></param> public IOStockManagerViewModel(ObservableInventory inventory) : this(inventory.Product) { Title = string.Format("새로운 입출고 데이터 등록하기"); IsEnabledRadioButton = true; IsEnabledInventoryComboBox = false; SelectedInventory = inventory; }
/// <summary> /// 인벤토리 속성의 트리뷰노드를 생성합니다. /// </summary> /// <param name="inventory"></param> public TreeViewNode(ObservableInventory inventory) : this() { if (inventory == null && string.IsNullOrEmpty(inventory.ID)) throw new NotSupportedException(); Type = NodeType.INVENTORY; ObservableObjectID = inventory.ID; }
public InventoryManagerViewModel(ObservableInventory inventory) : this(inventory.Product) { _target = inventory; Specification = inventory.Specification; Memo = inventory.Memo; Maker = inventory.Maker; Measure = inventory.Measure; }
public void CheckQuantity(ObservableInventory inventory) { string sql = string.Format("select * from {0} where {1} = {2} order by {3}", typeof(IOStockFormat).Name, "InventoryID", nameof(inventory.ID), "Date"); var formats = DataDirector.GetInstance().DB.Query<IOStockFormat>(sql); IOStockFormat near = null; foreach (var fmt in formats) { int remainQty = 0; int iosQty = fmt.Quantity; if (fmt.StockType == IOStockType.OUTGOING) iosQty = -iosQty; if (near != null) remainQty = near.RemainingQuantity; int exp = remainQty + iosQty; Assert.AreEqual(fmt.RemainingQuantity, exp); near = fmt; } var last = formats.Last(); var stock = new ObservableIOStock(last); Assert.AreEqual(stock.RemainingQuantity, stock.Inventory.Quantity); }
private void OnDataInserted(object obj, SQLInsertEventArgs e) { IID iID = e.IID; Console.WriteLine("{0}(TYPE: {1}, ID: {2})", nameof(OnDataInserted), typeof(IID).Name, iID.ID); switch (iID.GetType().Name) { case nameof(InventoryFormat): InventoryFormat invf = iID as InventoryFormat; ObservableInventory oinv = new ObservableInventory(invf); _inventory.Add(oinv); _subject.NotifyNewItemAdded(oinv); break; case nameof(IOStockFormat): IOStockFormat stof = iID as IOStockFormat; IOStockDataGridItem osto = new IOStockDataGridItem(stof); _subject.NotifyNewItemAdded(osto); break; case nameof(Product): Product prod = iID as Product; Observable<Product> oprod = new Observable<Product>(prod); _field.Add<Product>(oprod); _subject.NotifyNewItemAdded(oprod); break; case nameof(Maker): Maker maker = iID as Maker; Observable<Maker> omaker = new Observable<Maker>(maker); _field.Add<Maker>(omaker); _subject.NotifyNewItemAdded(omaker); break; case nameof(Measure): Measure meas = iID as Measure; Observable<Measure> omeas = new Observable<Measure>(meas); _field.Add<Measure>(omeas); _subject.NotifyNewItemAdded(omeas); break; case nameof(Customer): Customer cust = iID as Customer; Observable<Customer> ocust = new Observable<Customer>(cust); _field.Add<Customer>(ocust); _subject.NotifyNewItemAdded(ocust); break; case nameof(Supplier): Supplier supp = iID as Supplier; Observable<Supplier> osupp = new Observable<Supplier>(supp); _field.Add<Supplier>(osupp); _subject.NotifyNewItemAdded(osupp); break; case nameof(Project): Project proj = iID as Project; Observable<Project> oproj = new Observable<Project>(proj); _field.Add<Project>(oproj); _subject.NotifyNewItemAdded(oproj); break; case nameof(Warehouse): Warehouse ware = iID as Warehouse; Observable<Warehouse> oware = new Observable<Warehouse>(ware); _field.Add<Warehouse>(oware); _subject.NotifyNewItemAdded(oware); break; case nameof(Employee): Employee emp = iID as Employee; Observable<Employee> oemp = new Observable<Employee>(emp); _field.Add<Employee>(oemp); _subject.NotifyNewItemAdded(oemp); break; default: throw new NotSupportedException(); } }
public void OpenManager(ObservableInventory inventory) { IOStockManagerViewModel viewmodel = new IOStockManagerViewModel(inventory); IOStockManagerWindow window = new IOStockManagerWindow(); window.DataContext = viewmodel; window.Owner = Application.Current.MainWindow; window.ShowDialog(); }
/// <summary> /// 수정 또는 새로운 재고 데이터를 생성하여 데이터베이스에 이를 저장한다. /// </summary> private void ApplyModifiedInventoryProperties() { ObservableInventory inventory = null; if (Inventory == null) { if (Product == null) { Observable<Product> product = new Observable<Product>(ProductText); DataDirector.GetInstance().AddField(product); Product = product; } inventory = new ObservableInventory(Product, SpecificationText, InventoryQuantity, SpecificationMemo, Maker, Measure); DataDirector.GetInstance().AddInventory(inventory); } else { inventory = DataDirector.GetInstance().SearchInventory(Inventory.ID); inventory.Format = Inventory.Format; inventory.Quantity = InventoryQuantity; } Inventory = inventory; }
public InventoryManagerViewModel(InventoryManagerDialog dialog, ObservableInventory inventory) : this(inventory) { Title = "규격 데이터를 수정합니다."; _control = dialog; }
public void Add(ObservableInventory observableInventory) { if (_inventories.ContainsKey(observableInventory.ID)) return; _inventories.Add(observableInventory.ID, observableInventory); }