public void registarDatos() { clsElemento Elemento = new clsElemento(); if (cbidGrupoElemento.Value != null) Elemento.idGrupoElemento = Convert.ToByte(cbidGrupoElemento.Value); if (cbidUnidadMedida.Value != null) Elemento.idUnidadMedida = Convert.ToByte(cbidUnidadMedida.Value); Elemento.Referencia = txtReferencia.Text; Elemento.Nombre = txtNombre.Text; Double valorMt2 = 0; Double.TryParse(txtMt2.Text, out valorMt2); Elemento.Mt2 = valorMt2; Double valorPeso = 0; Double.TryParse(txtPeso.Text, out valorPeso); Elemento.Peso = valorPeso; Elemento.Rotacion = ckRotacion.Checked ? true : false; Elemento.Activo = ckActivo.Checked ? true : false; var ejecutor = (Comandos)Session["ejecutorBDSAFcore"]; var fachadaCore = new clsFachadaSAFcore(ref ejecutor); int resultado = 0; if (IdElemento == 0) { resultado = fachadaCore.insertarElemento(Elemento); lbId.Text = resultado.ToString(); } else { SentenciaSQL sql = new SentenciaSQL(); sql.FiltroBD.Add(new FiltroBD(clsElemento.Campos.Id, IdElemento, FiltroBD.OperadorLogico.igual)); resultado = fachadaCore.editarElemento(Elemento, sql); } }