private void ActivLevel_SelectedIndexChanged(object sender, EventArgs e) { if (ActivLevel.SelectedIndex == 0) { activlevel = 1.3; CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else if (ActivLevel.SelectedIndex == 1) { activlevel = 1.55; CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else if (ActivLevel.SelectedIndex == 2) { activlevel = 1.8; CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else { MessageBox.Show("Зазначте ваш рівень активності", "Некоректні дані", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void ActivLevel_SelectedIndexChanged(object sender, EventArgs e) { double currentcalories; if (ActivLevel.SelectedIndex == 0) { activlevel = 1.3; currentcalories = usercontroler.HarissBenedict(activlevel); currentcalories = currentcalories / 6; BelkiMax.Text = Math.Round(currentcalories / 4).ToString(); FatsMax.Text = Math.Round(currentcalories / 9).ToString(); UglerodMax.Text = Math.Round(currentcalories).ToString(); CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else if (ActivLevel.SelectedIndex == 1) { activlevel = 1.55; currentcalories = usercontroler.HarissBenedict(activlevel); currentcalories = currentcalories / 6; BelkiMax.Text = Math.Round(currentcalories / 4).ToString(); FatsMax.Text = Math.Round(currentcalories / 9).ToString(); UglerodMax.Text = Math.Round(currentcalories).ToString(); CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else if (ActivLevel.SelectedIndex == 2) { activlevel = 1.8; currentcalories = usercontroler.HarissBenedict(activlevel); currentcalories = currentcalories / 6; BelkiMax.Text = Math.Round(currentcalories / 4).ToString(); FatsMax.Text = Math.Round(currentcalories / 9).ToString(); UglerodMax.Text = Math.Round(currentcalories).ToString(); CaloriesMax.Text = usercontroler.HarissBenedict(activlevel).ToString(); } else { MessageBox.Show("Зазначте ваш рівень активності", "Некоректні дані", MessageBoxButtons.OK, MessageBoxIcon.Information); } }