コード例 #1
0
        public override bool Insertar()
        {
            ConexionDb conexion = new ConexionDb();
            int retorno = 0;

            try {
                retorno = Convert.ToInt32(conexion.ObtenerValor(String.Format("Insert Into Presupuestos (UsuarioId,Descripcion) Values ({0},'{1}'); SELECT SCOPE_IDENTITY(); --", this.UsuarioId, this.Descripcion)));
                if (retorno > 0) {
                    foreach (PresupuestoDetalle pd in Detalle)
                    {
                        conexion.Ejecutar("Insert Into PresupuestoDetalle (PresupuestoId,TipoEgresoId,Monto) Values ("+ retorno + "," + pd.TipoEgresoId + "," + pd.Monto + ")--");
                    }
                }
            }
            catch
            {
                retorno = 0;
            }
            return retorno > 0;
        }