private void buttonPrintRessource_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); List <string> MedicinStock = Controller.ControllerPrintMedicin(); List <string> ShelfStock = Controller.ControllerPrintShelfStock(); string path = AppDomain.CurrentDomain.BaseDirectory + @"\" + "PrintRessource.txt"; System.IO.File.WriteAllText(path, string.Empty); TextWriter Writer = new StreamWriter(path, true); for (int i = 0; i < MedicinStock.Count / 5; i++) { Writer.WriteLine($"Item Categori: {MedicinStock[(i*5)]}, Item ID: {MedicinStock[(i*5)+1]}," + $"Item Name: {MedicinStock[(i*5)+2]}, Quantity: {MedicinStock[(i*5)+3]}, Price: {MedicinStock[(i*5)+4]}"); } for (int i = 0; i < ShelfStock.Count / 5; i++) { Writer.WriteLine($"Item Categori: {ShelfStock[(i*5)]}, Item ID: {ShelfStock[(i*5)+1]}," + $"Item Name: {ShelfStock[(i*5)+2]}, Quantity: {ShelfStock[(i*5)+3]}, Price: {ShelfStock[(i*5)+4]}"); } Writer.Close(); MessageBox.Show("Print Completed"); Process.Start(path); }
private void buttonSearch_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); if (Controller.ControllerCheckIfAnimalExist(TextBoxAnimalNr.Text) == false) { MessageBox.Show("Animal doesn't exist"); } else { List <string> DoctorList = Controller.ControllerFindAllDoctor(); TextAnimalName.Text = Controller.ControllerSearchAnimal(TextBoxAnimalNr.Text)[1]; if (Controller.ControllerSearchAnimal(TextBoxAnimalNr.Text)[2] == "F") { CheckBoxMale.Checked = false; CheckBoxFemale.Checked = true; CheckBoxMale.Enabled = false; } else { CheckBoxFemale.Checked = false; CheckBoxMale.Checked = true; CheckBoxFemale.Enabled = false; } AnimalBirthCalender.Value = Convert.ToDateTime(Controller.ControllerSearchAnimal(TextBoxAnimalNr.Text)[3]); TextAnimal.Text = Controller.ControllerSearchAnimal(TextBoxAnimalNr.Text)[4]; DoctorComboBox.Text = Controller.ControllerGetDoctorName(TextBoxAnimalNr.Text); TextBoxAnimalChip.Text = Controller.ControllerSearchAnimal(TextBoxAnimalNr.Text)[6]; } }
private void buttonUpdatePrice_Click_1(object sender, EventArgs e) { Contoller Controller = new Contoller(); richTextBoxInformation.AppendText("Starting transaction\n "); int Changes = Controller.ControllerUpdateMedicin(); richTextBoxInformation.AppendText(Changes + " New changes where added \n"); richTextBoxInformation.AppendText("Transaction was succesfully \n"); }
private void ButtonCheckOwner_Click_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); if (Controller.ControllerCheckAnimalOwner(TextOwnerPhone.Text) == true) { CheckOwnerWrong.Checked = false; CheckOwnerRight.Checked = true; } else { CheckOwnerRight.Checked = false; CheckOwnerWrong.Checked = true; } }
public Form_Animal() { Contoller Controller = new Contoller(); InitializeComponent(); List <string> DoctorList = Controller.ControllerFindAllDoctor(); DoctorArray = new string[DoctorList.Count / 2, 2]; for (int i = 0; i < DoctorList.Count / 2; i++) { DoctorArray[i, 0] = DoctorList[(i * 2)]; DoctorArray[i, 1] = DoctorList[(i * 2) + 1]; DoctorComboBox.Items.Add(DoctorList[(i * 2) + 1]); } }
private void buttonAnimalCreate_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); if (TextAnimalName.Text == "" || TextAnimal.Text == "" || DoctorComboBox.Text == "" || TextBoxAnimalChip.Text == "" || TextOwnerPhone.Text == "") { MessageBox.Show("Fill out the blanks"); } else { Controller.ControllerNewAnimal(TextAnimalName.Text, Gender(), Convert.ToDateTime(AnimalBirthCalender.Value).ToString("yyyy-MM-dd"), TextAnimal.Text, Convert.ToInt32(DoctorArray[DoctorComboBox.SelectedIndex, 0]), Convert.ToInt32(TextBoxAnimalChip.Text)); TextBoxAnimalNr.Text = Controller.ControllerFindAnimalID(TextAnimalName.Text, Convert.ToDateTime(AnimalBirthCalender.Value).ToString("yyyy-MM-dd"), TextAnimal.Text, Gender())[0]; Controller.ControllerAddRelation(Convert.ToInt32(TextOwnerPhone.Text), Convert.ToInt32(TextBoxAnimalNr.Text)); } }
private void buttonJournal_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); Controller.ControllerAddJournal(Convert.ToInt32(DoctorArray[DoctorComboBox.SelectedIndex, 0]), Convert.ToInt32(TextBoxAnimalNr.Text), Convert.ToDateTime(JournalCalender.Value).ToString("yyyy-MM-dd"), TextJournalTitle.Text, TextBoxJournal.Text); }
private void buttonAnimalUpdate_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); Controller.ControllerUpdateAnimal(Convert.ToInt32(TextBoxAnimalNr.Text), TextAnimalName.Text, Gender(), Convert.ToDateTime(AnimalBirthCalender.Value).ToString("yyyy-MM-dd"), TextAnimal.Text, Convert.ToInt32(DoctorArray[DoctorComboBox.SelectedIndex, 0]), Convert.ToInt32(TextBoxAnimalChip.Text)); }
private void btnSearch_Click(object sender, EventArgs e) { Contoller Controller = new Contoller(); dataGridViewJournal.DataSource = Controller.ControllerGetJournal(txtBoxAnimalID.Text); }