Exemple #1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewRegistration.SelectedItems.Count == 1)
     {
         RegistrationsSet registrationsSet = listViewRegistration.SelectedItems[0].Tag as RegistrationsSet;
         registrationsSet.IdWorker  = Convert.ToInt32(comboBoxWorker.SelectedItem.ToString().Split('.')[0]);
         registrationsSet.IdClent   = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]);
         registrationsSet.IdService = Convert.ToInt32(comboBoxService.SelectedItem.ToString().Split('.')[0]);
         registrationsSet.Price     = Convert.ToInt64(textBoxPrice.Text);
         Program.BSTDB.SaveChanges();
         ShowRegistration();
     }
 }
Exemple #2
0
 private void listViewRegistration_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewRegistration.SelectedItems.Count == 1)
     {
         RegistrationsSet registrationSet = listViewRegistration.SelectedItems[0].Tag as RegistrationsSet;
         comboBoxWorker.SelectedIndex  = comboBoxWorker.FindString(registrationSet.IdWorker.ToString());
         comboBoxClient.SelectedIndex  = comboBoxClient.FindString(registrationSet.IdClent.ToString());
         comboBoxService.SelectedIndex = comboBoxService.FindString(registrationSet.IdService.ToString());
         textBoxPrice.Text             = registrationSet.Price.ToString();
     }
     else
     {
         comboBoxWorker.SelectedItem  = null;
         comboBoxClient.SelectedItem  = null;
         comboBoxService.SelectedItem = null;
         textBoxPrice.Text            = "";
     }
 }
Exemple #3
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (comboBoxWorker.SelectedItem != null && comboBoxClient.SelectedItem != null && comboBoxService.SelectedItem != null && textBoxPrice.Text != "")
     {
         RegistrationsSet registrationSet = new RegistrationsSet();
         registrationSet.IdWorker  = Convert.ToInt32(comboBoxWorker.SelectedItem.ToString().Split('.')[0]);
         registrationSet.IdClent   = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]);
         registrationSet.IdService = Convert.ToInt32(comboBoxService.SelectedItem.ToString().Split('.')[0]);
         registrationSet.Price     = Convert.ToInt64(textBoxPrice.Text);
         Program.BSTDB.RegistrationsSet.Add(registrationSet);
         Program.BSTDB.SaveChanges();
         ShowRegistration();
     }
     else
     {
         MessageBox.Show("Данные не выбраны", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewRegistration.SelectedItems.Count == 1)
         {
             RegistrationsSet registrationSet = listViewRegistration.SelectedItems[0].Tag as RegistrationsSet;
             Program.BSTDB.RegistrationsSet.Remove(registrationSet);
             Program.BSTDB.SaveChanges();
             ShowRegistration();
         }
         comboBoxWorker.SelectedItem  = null;
         comboBoxClient.SelectedItem  = null;
         comboBoxService.SelectedItem = null;
         textBoxPrice.Text            = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }