private void button3_Click(object sender, EventArgs e)// remove { RemoveInfo removeInfo = new RemoveInfo(); switch (comboBox1.SelectedIndex) { case 0: { List <client> query = (from client in db.client select client).ToList(); client item = query.First(w => w.id_client.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); removeInfo.removeClient(item); dw.ShowInfoToAdmin(dataGridView1, comboBox1); } break; case 1: { List <employee> query = (from employee in db.employee select employee).ToList(); employee item = query.First(w => w.id_employee.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); if (admin == item) { MessageBox.Show("Нельзя удалить самого себя"); } else { removeInfo.removeemployee(item.id_employee); dw.ShowInfoToAdmin(dataGridView1, comboBox1); } } break; case 2: { List <employee> query = (from employee in db.employee select employee).ToList(); employee item = query.First(w => w.id_employee.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); if (admin == item) { MessageBox.Show("Нельзя удалить самого себя"); } else { removeInfo.removeemployee(item.id_employee); dw.ShowInfoToAdmin(dataGridView1, comboBox1); } } break; case 3: { List <service> query = (from service in db.service select service).ToList(); service item = query.First(w => w.name.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); removeInfo.removeService(item); dw.ShowInfoToAdmin(dataGridView1, comboBox1); } break; case 4: { List <procedure_schedule> query = (from procedure_schedule in db.procedure_schedule select procedure_schedule).ToList(); procedure_schedule item = query.First(w => w.date.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); removeInfo.removeProcedure(item); dw.ShowInfoToAdmin(dataGridView1, comboBox1); } break; } }
public AddNewUser(string newemployee, EditService editService) { this.editService = editService; this.newemployee = db.employee.SingleOrDefault(w => (w.surname + " " + w.name + " " + w.lastlename) == newemployee); }
public DataView(employee employee) { this.employee = employee; }
public EditInfo(employee newemployee, EditUser editUser) { this.newemployee = newemployee; this.editUser = editUser; }