private void btnCargarL_Click(object sender, EventArgs e) { { if (!AgendaDAL.Existe(Convert.ToInt32(cbmTera.SelectedValue))) { Agenda pAgenda = new Agenda(); { pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; if (chbLunes1.Checked) { pAgenda.Lunes = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbMartes2.Checked) { pAgenda.Martes = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbMiercoles3.Checked) { pAgenda.Miércoles = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbJueves4.Checked) { pAgenda.Jueves = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbViernes5.Checked) { pAgenda.Viernes = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbSabado6.Checked) { pAgenda.Sabado = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } if (chbDomingo7.Checked) { pAgenda.Domingo = true; pAgenda.IdTerapeuta = (Int64)cbmTera.SelectedValue; } AgendaDAL.AgregarDia(pAgenda); MessageBox.Show("Se agrego el DIA", "Dias Guardados", MessageBoxButtons.OK, MessageBoxIcon.Information); btnModLab.Enabled = true; } } else { MessageBox.Show("Ya Se han Asiganado los dias al Terapeuta!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnEliminar_Click(object sender, EventArgs e) { if (AgendaDAL.Existe(Convert.ToInt32(cboTerapeuta.SelectedValue))) { Int64 Id = Convert.ToInt64(cboTerapeuta.SelectedValue); AgendaDAL.EliminarAgenda(Id); MessageBox.Show("Agenda Eliminada", "Agenda", MessageBoxButtons.OK, MessageBoxIcon.Information); btnModLab.Enabled = false; Agenda pAgenda = new Agenda(); pAgenda = AgendaDAL.ObtenerAgenda(((Terapeuta)cboTerapeuta.SelectedItem).Id); if (pAgenda.Lunes) { chbLunes.Checked = true; } else { chbLunes.Checked = false; } if (pAgenda.Martes) { chbMartes1.Checked = true; } else { chbMartes1.Checked = false; } if (pAgenda.Miércoles) { chbMiercoles.Checked = true; } else { chbMiercoles.Checked = false; } if (pAgenda.Jueves) { chbJueves.Checked = true; } else { chbJueves.Checked = false; } if (pAgenda.Viernes) { chbViernes.Checked = true; } else { chbViernes.Checked = false; } if (pAgenda.Sabado) { chbSabado.Checked = true; } else { chbSabado.Checked = false; } if (pAgenda.Domingo) { chbDomingo.Checked = true; } else { chbDomingo.Checked = false; } } else { MessageBox.Show("No Existe Agenda a Eliminar", "Agenda", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }