Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public int Editar(clsElemento obj, SentenciaSQL sql)
 {
     int resultado = 0;
     EjecutorBaseDatos.limpiarParametros();
     string sentenciaSQL = construirUpdate(obj) + CondicionSQL(sql);
     resultado = EjecutorBaseDatos.ejecutarSentencia(sentenciaSQL);
     return resultado;
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 public int insertarElemento(clsElemento obj)
 {
     m_clsElementoDALC = new clsElementoDALC(m_EjecutorBaseDatos);
     return m_clsElementoDALC.Insertar(obj);
 }
Exemplo n.º 6
0
 public int eliminarElemento(clsElemento obj, SentenciaSQL sql)
 {
     m_clsElementoDALC = new clsElementoDALC(m_EjecutorBaseDatos);
     return m_clsElementoDALC.Eliminar(obj, sql);
 }
Exemplo n.º 7
0
 public int Insertar(clsElemento obj)
 {
     int resultado = 0;
     EjecutorBaseDatos.limpiarParametros();
     string sentenciaSQL = construirInsert(obj);
     resultado = EjecutorBaseDatos.ejecutarSentenciaInsert(sentenciaSQL);
     return resultado;
 }