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); } }
public int Editar(clsElemento obj, SentenciaSQL sql) { int resultado = 0; EjecutorBaseDatos.limpiarParametros(); string sentenciaSQL = construirUpdate(obj) + CondicionSQL(sql); resultado = EjecutorBaseDatos.ejecutarSentencia(sentenciaSQL); return resultado; }
public clsElemento CrearObjeto(System.Data.DataTable tabla) { if (tabla.Rows.Count == 0) return null; clsElemento obj = new clsElemento(); System.Data.DataRow fila = tabla.Rows[0]; { obj.Id = Convert.ToInt16(fila["Id"]); obj.idGrupoElemento = Convert.ToByte(fila["idGrupoElemento"]); obj.idUnidadMedida = Convert.ToByte(fila["idUnidadMedida"]); obj.Referencia = fila["Referencia"].ToString(); obj.Nombre = fila["Nombre"].ToString(); obj.Mt2 = Convert.ToDouble(fila["Mt2"]); obj.Peso = Convert.ToDouble(fila["Peso"]); obj.Rotacion = Convert.ToBoolean(fila["Rotacion"]); obj.Activo = Convert.ToBoolean(fila["Activo"]); } return obj; }
public List<clsElemento> CrearObjetos(System.Data.DataTable tabla) { if (tabla.Rows.Count == 0) return null; var lista = new List<clsElemento>(); foreach (System.Data.DataRow fila in tabla.Rows) { var obj = new clsElemento(); obj.Id = Convert.ToInt16(fila["Id"]); obj.idGrupoElemento = Convert.ToByte(fila["idGrupoElemento"]); obj.idUnidadMedida = Convert.ToByte(fila["idUnidadMedida"]); obj.Referencia = fila["Referencia"].ToString(); obj.Nombre = fila["Nombre"].ToString(); obj.Mt2 = Convert.ToDouble(fila["Mt2"]); obj.Peso = Convert.ToDouble(fila["Peso"]); obj.Rotacion = Convert.ToBoolean(fila["Rotacion"]); obj.Activo = Convert.ToBoolean(fila["Activo"]); lista.Add(obj); } return lista; }
public int insertarElemento(clsElemento obj) { m_clsElementoDALC = new clsElementoDALC(m_EjecutorBaseDatos); return m_clsElementoDALC.Insertar(obj); }
public int eliminarElemento(clsElemento obj, SentenciaSQL sql) { m_clsElementoDALC = new clsElementoDALC(m_EjecutorBaseDatos); return m_clsElementoDALC.Eliminar(obj, sql); }
public int Insertar(clsElemento obj) { int resultado = 0; EjecutorBaseDatos.limpiarParametros(); string sentenciaSQL = construirInsert(obj); resultado = EjecutorBaseDatos.ejecutarSentenciaInsert(sentenciaSQL); return resultado; }