private void button1_Click(object sender, EventArgs e) { ordersBindingSource.CancelEdit(); 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; }
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; } }