static private void NewSearch(char type) { string id; Console.Clear(); Console.WriteLine("------ New Search ------ \n"); switch (type) { case 'A': Console.Write("Type the artistID you want to search:"); id = Console.ReadLine(); Console.WriteLine(); Artist a = gal.SearchArtist(id); if (a != null) { Console.WriteLine(a.ToString()); } else { Console.WriteLine("ID not found!"); } break; case 'C': Console.Write("Type the curatorID you want to search:"); id = Console.ReadLine(); Console.WriteLine(); Curator c = gal.SearchCurator(id); if (c != null) { Console.WriteLine(c.ToString()); } else { Console.WriteLine("ID not found!"); } break; case 'P': Console.Write("Type the pieceID you want to search:"); id = Console.ReadLine(); Console.WriteLine(); ArtPiece p = gal.SearchArtPiece(id); if (p != null) { Console.WriteLine(p.ToString()); } else { Console.WriteLine("ID not found!"); } break; } Console.WriteLine(); Console.WriteLine("Press any key to continue."); Console.ReadLine(); }
private void SearchCurators_Click(object sender, RoutedEventArgs e) { curatorsText.Text = ""; if (curatorID.Text == "") { MessageBox.Show("Curator ID is required!"); return; } Curator c = gal.SearchCurator(curatorID.Text); if (c != null) { curatorsText.Text = "Curator found!\n"; curatorsText.Text += c.ToString(); } else { MessageBox.Show("Curator ID not registred!"); return; } }
private void addCurator_Click(object sender, RoutedEventArgs e) { if (curatorID.Text == "" || curatorName.Text == "") { MessageBox.Show("ID and Name are required!"); return; } if (!fieldsValidation("id", curatorID)) { MessageBox.Show("Invalid ID!\nID should have 5 characteres."); return; } if (!fieldsValidation("curatorName", curatorName)) { int size = curatorName.Text.Length; MessageBox.Show("Invalid Name!\nName must have maximum 30 characteres."); return; } Curator c = gal.SearchCurator(curatorID.Text); if (c != null) { curatorsText.Text = "Curator ID already exists!"; } else { c = gal.AddCurator(curatorName.Text, curatorID.Text); curatorsText.Text = "Curator added!\n"; curatorsText.Text += c.ToString(); //Clear information curatorID.Text = ""; curatorName.Text = ""; } }