Beispiel #1
0
        private void OnAddItem(object sender, EventArgs e)
        {
            Malt         f   = new Malt();
            DialogResult ret = f.ShowDialog();

            if (ret == DialogResult.OK)
            {
                if ((null != f.SelectedMalt) && f.SelectedMalt.ParsedOk && (f.SelectedMalt.MengdeProsent > 0) && (f.SelectedMalt.MengdeProsent <= 100))
                {
                    double malt_amount;
                    if (Classes.Calulator.GetMaltAmountByPercentage(f.SelectedMalt.MengdeProsent / 100.0, f.SelectedMalt.ME / 100.0, _recipe.BHE / 100.0, _recipe.OriginalGravity, _recipe.BatchVolum, out malt_amount))
                    {
                        f.SelectedMalt.Mengde = malt_amount;
                    }

                    if (_recipe.ContainsMalt(f.SelectedMalt))
                    {
                        _recipe.ReplaceMalt(f.SelectedMalt);
                    }
                    else
                    {
                        _recipe.AddMalt(f.SelectedMalt);
                    }
                    UpdateControls();
                }
            }
        }
Beispiel #2
0
        private void OnAddItem(object sender, EventArgs e)
        {
            if (!PreOnAddItem())
            {
                return;
            }
            Malt f = new Malt();

            f.GrainListFile = Properties.Settings.Default.GrainList;
            DialogResult ret = f.ShowDialog();

            if (ret == DialogResult.OK)
            {
                if ((null != f.SelectedMalt) && f.SelectedMalt.ParsedOk && (f.SelectedMalt.MengdeProsent > 0) && (f.SelectedMalt.MengdeProsent <= 100))
                {
                    double malt_amount;
                    //if (Classes.Calulator.GetMaltAmountByPercentage(f.SelectedMalt.MengdeProsent / 100.0, f.SelectedMalt.ME / 100.0, _recipe.BHE / 100.0, _recipe.OriginalGravity, _recipe.BatchVolum, out malt_amount))
                    if (Classes.Calulator.GetMaltAmountByPercentage(f.SelectedMalt.MengdeProsent / 100.0, f.SelectedMalt.ME / 100.0, _recipe.BHE / 100.0, _recipe.OriginalGravity, _recipe.BatchVolum + _recipe.FermenterTrubLoss + _recipe.KettleLoss, out malt_amount))
                    {
                        f.SelectedMalt.Mengde = malt_amount;
                    }

                    if (_recipe.ContainsMalt(f.SelectedMalt))
                    {
                        _recipe.ReplaceMalt(f.SelectedMalt);
                    }
                    else
                    {
                        _recipe.AddMalt(f.SelectedMalt);
                    }
                    UpdateControls();
                }
            }
        }