예제 #1
0
 void ButtonRemoveWorker_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridWorkers.SelectedItem != null)
     {
         int id = ((WorkerView)dataGridWorkers.SelectedItem).ID;
         new Thread(() =>
         {
             Tuple <bool, byte> status = ZooConnection.DeleteModel(ModelType.Worker, id);
             if (status == null)
             {
                 MessageBox.Show("[ERROR] Cannot delete worker, server connection error!");
             }
             else if (!status.Item1)
             {
                 MessageBox.Show(ZooClient.DecodeDeleteError(status.Item2));
             }
             else
             {
                 UpdateOvertimes();
                 UpdateWorkers();
             }
         }).Start();
     }
 }
예제 #2
0
 void ButtonRemoveAttraction_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridAttractions.SelectedItem != null)
     {
         int id = (int)ZooClient.GetProperty(dataGridAttractions.SelectedItem, "ID");
         new Thread(() =>
         {
             Tuple <bool, byte> status = ZooConnection.DeleteModel(ModelType.Attraction, id);
             if (status == null)
             {
                 MessageBox.Show("[ERROR] Cannot remove attraction from Zoo, server connection error!");
             }
             else if (!status.Item1)
             {
                 MessageBox.Show(ZooClient.DecodeDeleteError(status.Item2));
             }
             else
             {
                 UpdatePlaces();
                 UpdateAttractions();
             }
         }).Start();
     }
 }
예제 #3
0
 void ButtonRemoveAnimal_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridAnimals.SelectedItem != null)
     {
         int id = ((AnimalView)dataGridAnimals.SelectedItem).ID;
         new Thread(() =>
         {
             Tuple <bool, byte> status = ZooConnection.DeleteModel(ModelType.Animal, id);
             if (status == null)
             {
                 MessageBox.Show("[ERROR] Cannot remove animal from Zoo, server connection error!");
             }
             else if (!status.Item1)
             {
                 MessageBox.Show(ZooClient.DecodeDeleteError(status.Item2));
             }
             else
             {
                 UpdateAnimals();
                 UpdateFoods();
             }
         }).Start();
     }
 }