protected void btnSave_Click(object sender, EventArgs e) { LABORATORIO laboratorio = new LABORATORIO(); ILaboratorios bdd = new BusinessLogic(); ListaLaboratorio selectedLab = Session["selectedLab"] as ListaLaboratorio; if (Session["selectedLab"] != null) { laboratorio.IDLABORATORIO = selectedLab.IdLaboratorio; laboratorio = laboratorio.MarkAsModified(); } else { laboratorio.IDLABORATORIO = Guid.NewGuid(); laboratorio = laboratorio.MarkAsAdded(); } Guid idCorporacion = new Guid(ddlCorporacion.SelectedValue); if (idCorporacion == Guid.Empty) laboratorio.IDCORPORACION = null; else laboratorio.IDCORPORACION = idCorporacion; laboratorio.IDUBICACION = new Guid(ddlUbicacion.SelectedValue); laboratorio.DIRECCION = txtDireccion1.Text; laboratorio.DIRECCION2 = txtDireccion2.Text; laboratorio.NOMBRELABORATORIO = txtNombre.Text; laboratorio.OBSERVACION = txtObservacion.Text; laboratorio.ORIGEN = ddlOrigen.Text; laboratorio.TELEFONO = txtTelefono.Text; laboratorio.ABREVIATURALABORATORIO = txtAbreviatura.Text; bdd.SaveLaboratorio(laboratorio); Response.Redirect("~/ui/MantenimientoCorpLab.aspx"); }
protected void btnBorrar_Click(object sender, EventArgs e) { ILaboratorios bdd = new BusinessLogic(); List<ListaLaboratorio> laboratorios = Session["laboratorios"] as List<ListaLaboratorio>; CheckBox chkBorrar; LABORATORIO selectedLab = null; GridLaboratorios.Rows.ToList().ForEach(row => { chkBorrar = row.FindControl("chkBorrar") as CheckBox; if (chkBorrar.Checked) { selectedLab = laboratorios.Where(x => x.Nombre == row.Cells[3].Text).Select(lab => new LABORATORIO { IDLABORATORIO=lab.IdLaboratorio, NOMBRELABORATORIO=lab.Nombre, ESBORRADOLABORATORIO = true }).FirstOrDefault(); selectedLab = selectedLab.MarkAsModified(); bdd.SaveLaboratorio(selectedLab); } }); Response.Redirect("~/ui/MantenimientoCorpLab.aspx"); }