public MaterialStockItem(SubMaterial stockDBItem)
 {
     StockDBItem = stockDBItem;
     CanIssue = true;
     QuantityToIssue = null;
     FromStock = new MaterialsFromStock();
 }
 public bool Issue()
 {
     try
     {
        // FromStock.SubMaterialsNameID = StockDBItem.SubMaterialsNameID;
         FromStock.Quantity = QuantityToIssue.Value;
         FromStock.IssuedDate = DBResources.Instance.GetServerTime();
         //FromStock.OrderID = OrderNumber.Value;
         StockDBItem.InStock = Stock - FromStock.Quantity;
         DBResources.Instance.Context.MaterialsFromStocks.Add(FromStock);
         DBResources.Instance.Context.SaveChanges();
         FromStock = new MaterialsFromStock();
         QuantityToIssue = null;
         OrderNumber = null;
         OnPropertyChanged("Stock");
         OnPropertyChanged("QuantityToIssue");
         OnPropertyChanged("OrderNumber");
         return true;
     }
     catch
     {
         throw;
     }
 }