예제 #1
0
 public MaterialStockItem(SubMaterial stockDBItem)
 {
     StockDBItem = stockDBItem;
     CanIssue = true;
     QuantityToIssue = null;
     FromStock = new MaterialsFromStock();
 }
 public MaterialsFromStockSummary(SubMaterial material)
 {
     this.Material = material;
     Quantity = 0;
 }
예제 #3
0
        public SubMaterial CreateNewSubMaterial(string subMaterialName, ProductMaterial material)
        {
            SubMaterial newSubMaterial = AvailableSubMaterials[material.MaterialName.Name].Where(a => a.Name == subMaterialName)
                                                                                            .Select(a => a).FirstOrDefault();

            if (newSubMaterial == null)
            {
                OrderManagerDBEntities newManager = new OrderManagerDBEntities();
                newSubMaterial = new SubMaterial();
                newSubMaterial.Name = subMaterialName;
                newSubMaterial.MaterialNameID = material.MaterialNameID;
                newManager.SubMaterials.Add(newSubMaterial);
                newManager.SaveChanges();
                newManager.Dispose();

                if (AvailableSubMaterials.ContainsKey(material.MaterialName.Name))
                {
                    PopulateAvailableSubMaterials();
                    newSubMaterial = AvailableSubMaterials[material.MaterialName.Name].Where(a => a.Name == subMaterialName)
                                                                                        .Select(a => a).First();
                }
            }

            return newSubMaterial;
        }