Esempio n. 1
0
 private void CmbMaterialsSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     InputChanged(null, null);
     if (cmbMaterials.SelectedValue != null)
     {
         var material = MaterialsService.Get((Guid)cmbMaterials.SelectedValue);
         tbAmount.Tag = string.Format(RepositoryMaterialsAndItemsResources.AmountBy, material.StringUnit);
     }
 }
Esempio n. 2
0
        public void ValidateAmount(Guid materialID, int amount, out int result)
        {
            var material         = MaterialsService.Get(materialID);
            var all              = GetAll(materialID);
            var repositoryAmount = all.Sum(m => m.Amount);

            if (repositoryAmount + amount >= material.LowestAmount)
            {
                result = -2;
            }
            else if (repositoryAmount + amount >= 0)
            {
                result = -1;
            }
            else
            {
                result = repositoryAmount;
            }
        }
Esempio n. 3
0
        public static string RepositoryMaterialDetailer(RepositoryMaterial repositoryMaterial, ActionType actionType)
        {
            var material = MaterialsService.Get(repositoryMaterial.MaterialID);

            if (material == null)
            {
                return(null);
            }
            switch (actionType)
            {
            case ActionType.Created:
                return(string.Format("به موجودی ماده‌ای با نام {0} {1} {2} اضافه شد.", material.Name,
                                     repositoryMaterial.Amount, material.StringUnit));

            case ActionType.Removed:
                return(string.Format("از موجودی ماده‌ای با نام {0} {1} {2} کم شد.", material.Name,
                                     repositoryMaterial.Amount, material.StringUnit));

            default:
                return(null);
            }
        }