private void Button_Click_1(object sender, RoutedEventArgs e) { List <string> Queries = new List <string>(); // for each of the following queries there should be a case in the switch below Queries.Add("Children who don't have a single contract"); Queries.Add("Nannies who get their vacation from the minister of economy"); Queries.Add("Contracts in which the children met the nanny"); Queries.Add("Contracts that are signed"); Queries.Add("Mothers for which there is no nanny that can fit 100% with their schedule"); ListDisplay listDisplay; // note that the constructor below has a quite long parameter ChoicePromptWin choicePromptWin = new ChoicePromptWin(Queries, "What do you wish to find?", (s) => { switch ((string)s) { // a case for each of the queries above case "Children who don't have a single contract": listDisplay = new ListDisplay((string)s, "Go to selected child's window", bl.UnattendedChildren()); listDisplay.ShowDialog(); break; case "Nannies who get their vacation from the minister of economy": listDisplay = new ListDisplay((string)s, "Go to selected nanny's window", bl.VacationByEconomy()); listDisplay.ShowDialog(); break; case "Contracts in which the children met the nanny": listDisplay = new ListDisplay((string)s, "Go to selected contract's window", bl.ContractsByCondition(c => c.IsMet)); listDisplay.ShowDialog(); break; case "Contracts that are signed": listDisplay = new ListDisplay((string)s, "Go to selected contract's window", bl.ContractsByCondition(c => c.IsSigned)); listDisplay.ShowDialog(); break; case "Mothers for which there is no nanny that can fit 100% with their schedule": listDisplay = new ListDisplay((string)s, "Go to selected mother's window", from Mother m in bl.GetMothers() where bl.SuitableNannies(m).Count() == 0 select m); listDisplay.ShowDialog(); break; } }); // This is the end of the constructor above choicePromptWin.ShowDialog(); ///////////////////////////////////////////////////////////////////////// OLD***********************OLD //string ret = "Nannies with vaction from the minister of economy:\n"; //foreach (Nanny n in bl.VacationByEconomy()) // ret += bl.ToShortString(n) + "\n"; //ret += "**************\nUnattended Children:\n"; //foreach (Child c in bl.UnattendedChildren()) // ret += bl.ToShortString(c) +"\n"; //ret += "***************\nContracts where children met the nanny:\n"; //foreach (Contract c in bl.ContractsByCondition(c => c.IsMet)) // ret += bl.ToShortString(c) + "\n"; //ret += "***************\nNumber of signed contracts:" + bl.NumOfContractsByCondition(c => c.IsSigned); //MessageBox.Show(ret); }
private void ShowChildBTN_Click(object sender, RoutedEventArgs e) { //if (ChildLST.SelectedItem == null) //{ // MessageBox.Show("Please select a child first"); // return; //} //string id = ""; //for (int i = 0; i < ChildLST.SelectedItem.ToString().Length && ChildLST.SelectedItem.ToString()[i] != ' '; i++) // id += ChildLST.SelectedItem.ToString()[i]; //Child c = bl.FindChildByID(id); //ShowObjectWin showObjectWin = new ShowObjectWin(c); //showObjectWin.ShowDialog(); ListDisplay listDisplay = new ListDisplay("List of all children", "Go to selected child's window", bl.GetChildren()); listDisplay.ShowDialog(); }
private void ShowMotherBTN_Click(object sender, RoutedEventArgs e) { //if (MotherLST.SelectedItem == null) //{ // MessageBox.Show("Please select a mother first"); // return; //} //string id = ""; //for (int i = 0; i < MotherLST.SelectedItem.ToString().Length && MotherLST.SelectedItem.ToString()[i] != ' '; i++) // id += MotherLST.SelectedItem.ToString()[i]; //Mother m = bl.FindMotherByID(id); //ShowObjectWin showObjectWin = new ShowObjectWin(m); //showObjectWin.ShowDialog(); ListDisplay listDisplay = new ListDisplay("List of all mothers", "Go to selected mother's window", bl.GetMothers()); listDisplay.ShowDialog(); }
private void ShowNannyBTN_Click(object sender, RoutedEventArgs e) { //if (NannyLST.SelectedItem == null) //{ // MessageBox.Show("Please select a nanny first"); // return; //} //string id = ""; //for (int i = 0; i < NannyLST.SelectedItem.ToString().Length && NannyLST.SelectedItem.ToString()[i] != ' '; i++) // id += NannyLST.SelectedItem.ToString()[i]; //Nanny n = bl.FindNannyByID(id); //ShowObjectWin showObjectWin = new ShowObjectWin(n); //showObjectWin.ShowDialog(); ListDisplay listDisplay = new ListDisplay("List of all nannies", "Go to selected nanny's window", bl.GetNannies()); listDisplay.ShowDialog(); }
private void ShowContractBTN_Click(object sender, RoutedEventArgs e) { //if (ContractLST.SelectedItem == null) //{ // MessageBox.Show("Please select a contract first"); // return; //} //string id = ""; //for (int i = 0; i < ContractLST.SelectedItem.ToString().Length && ContractLST.SelectedItem.ToString()[i] != ' '; i++) // id += ContractLST.SelectedItem.ToString()[i]; //Contract c = bl.FindContractBySerialNum(id); //ShowObjectWin showObjectWin = new ShowObjectWin(c); //showObjectWin.ShowDialog(); ListDisplay listDisplay = new ListDisplay("List of all contracts", "Go to selected contract's window", bl.GetContracts()); listDisplay.ShowDialog(); }