private void btnBaja_Click(object sender, EventArgs e) { if (txtBuscar.Text == "") { MessageBox.Show("Falta ID"); } else { empleados MyEmplead = bdo.empleados.Single(q => q.id == int.Parse(txtBuscar.Text)); bdo.empleados.DeleteOnSubmit(MyEmplead); bdo.SubmitChanges(); cargarGrid(); cargarGrid(); txtID.Text = ""; txtName.Text = ""; txtSurname.Text = ""; txtAge.Text = ""; txtBuscar.Text = ""; chkMarried.Checked = false; } }
private void btnAlta_Click(object sender, EventArgs e) { try { empleados MyEmpleado = new empleados(); MyEmpleado.id = int.Parse(txtID.Text); MyEmpleado.nombre = txtName.Text; MyEmpleado.apellido = txtSurname.Text; MyEmpleado.edad = int.Parse(txtAge.Text); bool casao = false; if (chkMarried.Checked == true) { casao = true; } else { } MyEmpleado.casado = casao; bdo.empleados.InsertOnSubmit(MyEmpleado); bdo.SubmitChanges(); cargarGrid(); txtID.Text = ""; txtName.Text = ""; txtSurname.Text = ""; txtAge.Text = ""; txtBuscar.Text = ""; chkMarried.Checked = false; } catch { if (txtID.Text == "" || txtName.Text == "" || txtSurname.Text == "" || txtAge.Text == "") { MessageBox.Show("Falta algún valor"); } } }
private void btnModif_Click(object sender, EventArgs e) { if (txtBuscar.Text == "") { MessageBox.Show("Falta algún valor"); } else { empleados MyEmpleao = bdo.empleados.Single(q => q.id == int.Parse(txtBuscar.Text)); //MyEmpleao.id = int.Parse(txtID.Text); MyEmpleao.nombre = txtName.Text; MyEmpleao.apellido = txtSurname.Text; MyEmpleao.edad = int.Parse(txtAge.Text); bool casao = false; if (chkMarried.Checked == true) { casao = true; } else { } MyEmpleao.casado = casao; bdo.SubmitChanges(); cargarGrid(); cargarGrid(); txtID.Text = ""; txtName.Text = ""; txtSurname.Text = ""; txtAge.Text = ""; txtBuscar.Text = ""; chkMarried.Checked = false; } }
private void btnBuscar_Click(object sender, EventArgs e) { empleados MyEmpleado = bdo.empleados.Single(q => q.id == int.Parse(txtBuscar.Text)); string variablet = txtBuscar.Text; }
partial void Deleteempleados(empleados instance);
partial void Updateempleados(empleados instance);
partial void Insertempleados(empleados instance);