Ejemplo n.º 1
0
 void ButtonPayMonthSalary_Click(object sender, RoutedEventArgs e)
 {
     new Thread(() =>
     {
         object operation = ZooConnection.CreateModel(ModelType.CashBalance);
         ZooClient.SetProperty(operation, "BalanceTypeID", 0);
         if (!ZooConnection.AddModel(operation))
         {
             MessageBox.Show("[ERROR] Cannot pay month salary to employees, cannot add new operation to database, check log for detailed cause.");
         }
         else
         {
             MessageBox.Show("Succesfully pay month salary to employees.");
         }
     }).Start();
 }
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         ZooClient.SetProperty(food, "Name", textBoxName.Text);
         ZooClient.SetProperty(food, "Amount", double.Parse(textBoxAmount.Text));
         if (!parentWindow.ZooConnection.ModifyModel(food))
         {
             MessageBox.Show("[ERROR] Cannot add new food to database, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if(IsDataInputValid())
     {
         object operation = parentWindow.ZooConnection.CreateModel(ModelType.CashBalance);
         ZooClient.SetProperty(operation, "SubmitDate", datePickerSubmit.SelectedDate);
         ZooClient.SetProperty(operation, "Money", decimal.Parse(textBoxMoney.Text));
         ZooClient.SetProperty(operation, "BalanceTypeID", ZooClient.GetProperty(dataGridTypes.SelectedItem, "ID"));
         if (string.IsNullOrWhiteSpace(textBoxDescription.Text))
             ZooClient.SetProperty(operation, "DetailedDescription", textBoxDescription.Text);
         if (!parentWindow.ZooConnection.AddModel(operation))
         {
             MessageBox.Show("[ERROR] Cannot add new finance operation to database, check log for detailed cause.");
             DialogResult = false;
         }
         else
             DialogResult = true;
         Close();
     }
 }
Ejemplo n.º 4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         object overtime = parentWindow.ZooConnection.CreateModel(ModelType.Overtime);
         ZooClient.SetProperty(overtime, "Date", datePickerDate.SelectedDate);
         ZooClient.SetProperty(overtime, "Hours", int.Parse(textBoxHours.Text));
         ZooClient.SetProperty(overtime, "WorkerID", workerID);
         if (!parentWindow.ZooConnection.AddModel(overtime))
         {
             MessageBox.Show("[ERROR] Cannot submit new overtime to database, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         ZooClient.SetProperty(animal, "Name", textBoxName.Text);
         ZooClient.SetProperty(animal, "Count", int.Parse(textBoxCount.Text));
         ZooClient.SetProperty(animal, "MaintenanceCost", decimal.Parse(textBoxCost.Text));
         ZooClient.SetProperty(animal, "PlaceID", ZooClient.GetProperty(dataGridPlaces.SelectedItem, "ID"));
         ZooClient.SetProperty(animal, "FoodID", ZooClient.GetProperty(dataGridFoods.SelectedItem, "ID"));
         if (!parentWindow.ZooConnection.ModifyModel(animal))
         {
             MessageBox.Show("[ERROR] Cannot add new animal to database, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         object place = parentWindow.ZooConnection.CreateModel(ModelType.Place);
         ZooClient.SetProperty(place, "Name", textBoxName.Text);
         ZooClient.SetProperty(place, "OpenTime", timePickerOpen.Value.Value.TimeOfDay);
         ZooClient.SetProperty(place, "CloseTime", timePickerClose.Value.Value.TimeOfDay);
         ZooClient.SetProperty(place, "MaintenanceCost", decimal.Parse(textBoxCost.Text));
         if (!parentWindow.ZooConnection.ModifyModel(place))
         {
             MessageBox.Show("[ERROR] Cannot modify place, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }
Ejemplo n.º 7
0
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         ZooClient.SetProperty(attraction, "Name", textBoxName.Text);
         if (!string.IsNullOrWhiteSpace(textBoxDescription.Text))
         {
             ZooClient.SetProperty(attraction, "Description", textBoxDescription.Text);
         }
         ZooClient.SetProperty(attraction, "PlaceID", ZooClient.GetProperty(dataGridPlaces.SelectedItem, "ID"));
         if (!parentWindow.ZooConnection.ModifyModel(attraction))
         {
             MessageBox.Show("[ERROR] Cannot add new worker to database, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }
Ejemplo n.º 8
0
 void Button_Click(object sender, RoutedEventArgs e)
 {
     if (IsDataInputValid())
     {
         ZooClient.SetProperty(worker, "Surname", textBoxSurname.Text);
         ZooClient.SetProperty(worker, "Name", textBoxName.Text);
         ZooClient.SetProperty(worker, "Age", int.Parse(textBoxAge.Text));
         ZooClient.SetProperty(worker, "Salary", decimal.Parse(textBoxSalary.Text));
         ZooClient.SetProperty(worker, "StartDate", datePickerStartDate.SelectedDate);
         ZooClient.SetProperty(worker, "PlaceID", ZooClient.GetProperty(dataGridPlaces.SelectedItem, "ID"));
         if (!parentWindow.ZooConnection.ModifyModel(worker))
         {
             MessageBox.Show("[ERROR] Cannot modify worker, check log for detailed cause.");
             DialogResult = false;
         }
         else
         {
             DialogResult = true;
         }
         Close();
     }
 }