private void bEditOwner_Click(object sender, EventArgs e) { //todo save details po.setAddress(textBox9.Text); po.setDob(dateTimePicker1.Value.ToString()); po.setLastName(textBox12.Text); po.setFirstName(textBox13.Text); po.setPhoneOwner(Convert.ToInt32(textBox10.Text)); po.setEmail(textBox11.Text); try { db.updateOwner(po); MessageBox.Show(po.getLastName()); MessageBox.Show("Owner Successfully Edited"); HomePanel.Show(); } catch (Exception er) { MessageBox.Show(er.ToString()); } //db.updateAnimal Cancel_Click(sender, e); }
private void ImageMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { HomePanel homePanel = new HomePanel(); homePanel.Show(); Application.Current.Windows[0].Close(); }
private void Home_Show() { // changes the displayed items to fit the home screen PathTxt.Hide(); PathField.Hide(); ScanBtn.Hide(); PathBtn.Hide(); HomeContent.Show(); HomePanel.Show(); SettingsBox.Show(); SettingsTitle.Show(); }
private void btnDeleteDetails_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure want to Delete this animal", "Confirmation", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { db.DeleteAnimal(animal); HomePanel.Show(); AnmDetailsPanel.Hide(); MessageBox.Show("Animal successfully deleted"); } else { AnmDetailsPanel.Show(); } }
private void btnUpdateDetails_Click(object sender, EventArgs e) { try { animal.setDateBrought(Convert.ToString(dtpDateBroughtDetails.Value)); animal.setDescription(tbDescriptionDetails.Text); animal.setLocationFound(tbLocationFoundDetails.Text); if (tbOwnersIdDetails.Text != string.Empty) { int po_id = Convert.ToInt32(tbOwnersIdDetails.Text); try { po = db.getOwnerById(po_id); } catch (Exception err) { MessageBox.Show("Can't find previous owner: " + err.ToString()); } } else { po = null; } animal.setOwner(po); if (animal.GetType() == typeof(Dog)) { Dog dog = (Dog)animal; dog.setLastWalked(dtpLastWalkedDetails.Value); } else if (animal.GetType() == typeof(Cat)) { Cat cat = (Cat)animal; cat.setExtra(tbExtraDetails.Text); } db.updateAnimal(animal); MessageBox.Show("Animal successfully updated"); AnmDetailsPanel.Hide(); HomePanel.Show(); } catch (Exception er) { MessageBox.Show(er.ToString()); } }
private void Home_btn_Click(object sender, EventArgs e) { addWordPanel.Hide(); HomePanel.Show(); }
private void dataGridView2_CellClick_1(object sender, DataGridViewCellEventArgs e) { Int32 selectedCellCount = dataGridView2.GetCellCount(DataGridViewElementStates.Selected); if (selectedCellCount > 0) { if (dataGridView2.AreAllCellsSelected(true)) { MessageBox.Show("All cells are selected", "Selected Cells"); } else { System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = 0; i < selectedCellCount; i++) { //an attributes to know which part we selecting string condition = dataGridView2.SelectedCells[i].Value .ToString(); //this is an attribute for getting the value of rfid int idselected = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString()); //We need to create an attribute for identifying what species is our animal if (condition == "Delete") { MessageBox.Show(idselected.ToString()); DialogResult dialogResult = MessageBox.Show("Are you sure want to Delete this owner", "Confirmation", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { db.dropOwner(idselected); HomePanel.Show(); } else if (dialogResult == DialogResult.No) { OwnersPanel.Show(); } } else if (condition == "Details") { po = db.getOwnerById(idselected); this.textBox9.Text = po.getAddress(); this.textBox14.Text = Convert.ToString(po.getOwnerId()); this.textBox10.Text = Convert.ToString(po.getPhoneOwner()); this.textBox12.Text = po.getLastName(); this.textBox13.Text = po.getFirstName(); this.dateTimePicker1.Text = Convert.ToString(po.getDob()); this.textBox11.Text = po.getEmail(); //this.tbRfidOwner.Text = animal.getRfidByOwner(po); OwnersPanel.Hide(); OwnDetailsPanel.Show(); } condition = ""; idselected = 0; } } } selectedCellCount = 0; }