//attempts to search for pill private void searchButton_Click(object sender, EventArgs e) { try { string imprint = pillImprintTextBox.Text; pill = pillDB.SelectPill(imprint); //returns pill from database PillFound(); } catch (InvalidDataException except) { MessageBox.Show(except.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception except) { MessageBox.Show(except.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
string pillOriginalImprint; //holds pill oroginal imprint in case that it is modified public ModifyPillForm(PillForm pillForm, ref PillDB pillDB, IPill pill) { InitializeComponent(); this.pillForm = pillForm; this.pillDB = pillDB; this.pill = pill; //allows for date time picker to accept both date and time creationTimeDateTimePicker.CustomFormat = "MM/dd/yyyy hh:mm:ss"; //moves pill information to the form imprintTextBox.Text = pill.Imprint; colorComboBox.Text = pill.Color; shapeComboBox.Text = pill.Shape; drugNameTextBox.Text = pill.DrugName; drugStrengthTextBox.Text = pill.DrugStrength; selectImageTextBox.Text = pill.Photo; creationTimeDateTimePicker.Value = DateTime.Parse(pill.CreationTimestamp); pillOriginalImprint = pill.Imprint; }
private IPill pill; //holds the pill whose information is shown public IdentifyPillForm(PillForm pillForm, IPill pill) { InitializeComponent(); this.pillForm = pillForm; this.pill = pill; //adds pil information to form imprintTextBox.Text = pill.Imprint; colorTextBox.Text = pill.Color; shapeTextBox.Text = pill.Shape; drugNameTextBox.Text = pill.DrugName; drugStrengthTextBox.Text = pill.DrugStrength; imageTextBox.Text = pill.Photo; //allows for date time picker to accept both date and time creationTimeDateTimePicker.CustomFormat = "MM/dd/yyyy hh:mm:ss"; creationTimeDateTimePicker.Value = DateTime.Parse(pill.CreationTimestamp); //trick to make the date time picker unchangable creationTimeDateTimePicker.MinDate = DateTime.Parse(pill.CreationTimestamp); creationTimeDateTimePicker.MaxDate = DateTime.Parse(pill.CreationTimestamp); }