Example #1
0
        public override bool Equals(Drinks v1)
        {
            Milk other = v1 as Milk;

            if ((other != null) && (this.Name == other.Name) && (this.Volume == other.Volume) && (this.Fatness == other.Fatness))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public override void ChangingElement(Panel panel, Drinks element, DChange del)
        {
            Milk temp = element as Milk;

            nameBox.Text   = element.Name;
            volume.Value   = Convert.ToDecimal(element.Volume);
            Featness.Value = Convert.ToDecimal(temp.Fatness);

            this.save.Text = "Change Object";

            delToAdd    = null;
            delToChange = del;
        }
Example #3
0
        private void MakingObject(object sender, EventArgs e)
        {
            try
            {
                if ((nameBox.Text.Trim()).Length == 0)
                {
                    throw new Exception("Please, enter name of drink");
                }
                Milk template = new Milk(nameBox.Text.Trim().ToString(), Convert.ToDouble(volume.Value), Convert.ToDouble(Featness.Value));

                ChooseAction(template);
            }
            catch (ArgumentOutOfRangeException exept)
            {
            }
            catch (Exception exept)
            {
                MessageBox.Show(exept.Message);
            }
        }