public static bool eliminarTrigger(clsAuditoria objAuditoria) { List<SqlParameter> lstParametrosSQL = new List<SqlParameter>(); SqlParameter sqlParametro; lstParametrosSQL = crearLista(objAuditoria); sqlParametro = new SqlParameter(); sqlParametro.ParameterName = "@Accion"; sqlParametro.Value = 2; sqlParametro.Direction = ParameterDirection.Input; lstParametrosSQL.Add(sqlParametro); sqlParametro = new SqlParameter(); sqlParametro.ParameterName = "@Exito"; sqlParametro.Value = 0; sqlParametro.Direction = ParameterDirection.Output; lstParametrosSQL.Add(sqlParametro); int numResultado = clsGestorBD.ejecutarStoredProcedureInt("up_CrearTrigger", lstParametrosSQL); if (numResultado != 0) { return true; } else { return false; } }
public static DataTable seleccionarColumnas(clsAuditoria objAuditoria) { List<SqlParameter> lstParametrosSQL = new List<SqlParameter>(); SqlParameter sqlParametro; lstParametrosSQL = crearLista(objAuditoria); sqlParametro = new SqlParameter(); sqlParametro.ParameterName = "@Accion"; sqlParametro.Value = 5; sqlParametro.Direction = ParameterDirection.Input; lstParametrosSQL.Add(sqlParametro); return clsGestorBD.ejecutarStoredProcedureDataTable("up_SelColumnas", lstParametrosSQL); }
private static List<SqlParameter> crearLista(clsAuditoria objAuditoria) { List<SqlParameter> lstParametrosSQL = new List<SqlParameter>(); SqlParameter sqlParametro; foreach (PropertyInfo pi in objAuditoria.GetType().GetProperties()) { if (pi.CanRead) { if (pi.Name.Substring(0, 1).CompareTo("_") != 0) { sqlParametro = new SqlParameter(); sqlParametro.ParameterName = "@" + pi.Name; sqlParametro.Value = pi.GetValue(objAuditoria, null); sqlParametro.Direction = ParameterDirection.Input; lstParametrosSQL.Add(sqlParametro); } else { continue; } } } return lstParametrosSQL; }