private void ButtonCheckStatus_Click(object sender, EventArgs e) { try { if (!(textBoxInsertNumber.Text == "") && !(textBoxInsertNumber.Text == "Wpisz numer przesyłki")) { ParcelStatus theStatus = _parcelController.GetParcelStatusById(ConvertStringToInt(textBoxInsertNumber.Text)); switch (theStatus) { case ParcelStatus.AtPostingPoint: { labelStatus.Text = "Przesyłka w punkcie nadania"; break; } case ParcelStatus.OnWayToWarehouse: { labelStatus.Text = "Przeyłka w drodze do magazynu"; break; } case ParcelStatus.InWarehouse: { labelStatus.Text = "Przesyłka w magazynie"; break; } case ParcelStatus.OnWayToTheCustomer: { labelStatus.Text = "Przesyłka w drodze do odbiorcy"; break; } case ParcelStatus.Returned: { labelStatus.Text = "Przesyłka zwrócona"; break; } case ParcelStatus.Delivered: { labelStatus.Text = "Przesyłka dostarczona"; break; } default: { labelStatus.Text = "Brak przesyłki o podanym numerze"; break; } } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i < listBox1.Items.Count; i++) { if (listBox1.SelectedIndex == i) { radioButton1.Enabled = true; radioButton2.Enabled = true; radioButton3.Enabled = true; radioButton4.Enabled = true; radioButton5.Enabled = true; radioButton6.Enabled = true; radioButton7.Enabled = true; ParcelStatus status = _parcelController.GetParcelStatusById(ConvertStringToInt(listBox1.Items[i].ToString())); switch (status) { case ParcelStatus.AtPostingPoint: { radioButton1.Checked = true; break; } case ParcelStatus.OnWayToWarehouse: { radioButton2.Checked = true; break; } case ParcelStatus.InWarehouse: { radioButton3.Checked = true; break; } case ParcelStatus.OnWayToTheCustomer: { radioButton4.Checked = true; break; } case ParcelStatus.Returned: { radioButton5.Checked = true; break; } case ParcelStatus.Delivered: { radioButton6.Checked = true; break; } default: { radioButton7.Checked = true; break; } } } } }