private void ordersDataGridView_SelectionChanged(object sender, EventArgs e) { if (ordersDataGridView.SelectedRows.Count == 0) { tabControl1.Hide(); } else { tabControl1.Show(); dbDataSet.OrdersRow order = (ordersBindingSource.Current as DataRowView).Row as dbDataSet.OrdersRow; orderStatusBindingSource.Position = order.IsStatusNameNull() ? 0 : staffPositionsBindingSource.Find("Name", order.StatusName); clientNameOrderTextBox.Text = order.IsClientNameNull() ? "" : order.ClientName; admissionDateDateTimePicker.Value = order.IsAdmissionDateNull() ? DateTime.Now : order.AdmissionDate; deliveryDateDateTimePicker.Value = order.IsDeliveryDateNull() ? DateTime.Now : order.DeliveryDate; } }
private void button4_Click(object sender, EventArgs e) { dbDataSet.OrdersRow order = (ordersBindingSource.Current as DataRowView).Row as dbDataSet.OrdersRow; bool notEnoughData = order.IsClientIdNull() || order.IsNameNull() || order.IsAdmissionDateNull() || order.IsDeliveryDateNull() ; if (notEnoughData) { MessageBox.Show("Недостаточно данных для печати.\nПожалуйста, заполните все необходимые поля.", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBoxContract.Checked) { PrintContract(); } if (checkBoxTechnicalSpecification.Checked) { PrintTechnicalSpecification(); } if (checkBoxCirtificateAccept.Checked) { PrintSertificateAccept(); } if (checkBoxShedule.Checked) { PrintSheduleOfWork(); } }