/// <summary> /// Кнопка Поиск /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonShowFigure_Click(object sender, EventArgs e) { int count = 0; if (CheckBoxParallelepiped.Checked == false && CheckBoxPyramid.Checked == false && CheckBoxBall.Checked == false && CheckBoxVolume.Checked == false) { MessageBox.Show("Вы не ввели критерии для поиска!"); return; } foreach (FigureBase figures in _listFigureSearch) { switch (figures) { case BoxOfBeer _ when CheckBoxParallelepiped.Checked: case EgyptianForce _ when CheckBoxPyramid.Checked: case DiscoBall _ when CheckBoxBall.Checked: { count++; SendDataFromFormEvent?.Invoke(this, new FigureEventArgs(figures)); break; } } if (CheckBoxVolume.Checked && figures.Volume.ToString(). StartsWith(TextBoxVolume.Text)) { count++; SendDataFromFormEvent?.Invoke(this, new FigureEventArgs(figures)); } } if (count == 0) { MessageBox.Show("Таких фигур нет или вы ввели нечисловое значение.\n" + "Будьте внимательны!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); CheckBoxParallelepiped.Checked = false; CheckBoxPyramid.Checked = false; CheckBoxBall.Checked = false; CheckBoxVolume.Checked = false; }
/// <summary> /// Кнопка для продолжения ввода /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonNext_Click(object sender, EventArgs e) { _worker.Name = NameBox.Text; _worker.Surname = SurnameBox.Text; switch (TypeOfSalaryBox.Text) { case _hourlyPaymentItem: { _worker.TypeOfSalary = TypeOfSalary.HourlyPayment; var paymentForm = new HourlyPaymentForm(); paymentForm.SendDataFromFormEvent += AddWorkerSalaryEvent; paymentForm.ShowDialog(); break; } case _tariffPaymentItem: { _worker.TypeOfSalary = TypeOfSalary.TariffPayment; var paymentForm = new TariffPaymentForm(); paymentForm.SendDataFromFormEvent += AddWorkerSalaryEvent; paymentForm.ShowDialog(); break; } case _ratePaymenttItem: { _worker.TypeOfSalary = TypeOfSalary.RatePayment; var paymentForm = new RatePaymentForm(); paymentForm.SendDataFromFormEvent += AddWorkerSalaryEvent; paymentForm.ShowDialog(); break; } } SendDataFromFormEvent?.Invoke(this, new WorkerEventArgs(_worker)); Close(); }
/// <summary> /// Метод для передачи события /// </summary> /// <param name="e"></param> protected void OnSendDataFromFormEvent(NachislatorEventArgs e) { SendDataFromFormEvent?.Invoke(this, e); }