示例#1
0
        public void AddMaterial_Executed(object sender)
        {
            if (AppProperties.FormHaveModifications)
            {
                if (string.IsNullOrEmpty(Description))
                {
                    MessageBox.Show("Manca la descrizione");
                    return;
                }
                if (!Price.HasValue)
                {
                    MessageBox.Show("Manca il prezzo");
                    return;
                }
                if (!SelectedMeasure.HasValue)
                {
                    MessageBox.Show("Nessuna unità di misura selezionata");
                    return;
                }
                _contoData.MaterialAdd(new Material
                {
                    Description = Description,
                    Price       = Price,
                    MeasureId   = SelectedMeasure.Value
                });

                UpdateList();

                Description     = string.Empty;
                Price           = null;
                SelectedMeasure = null;
                AppProperties.FormHaveModifications = false;
            }
        }