public int ExecuteNonQuery(IConnectionCustom Connection, ICommandCustom Command)
        {
            if (Connection == null)
            {
                Connection = _dbConnection;
            }
            Command.IDbCommand.CommandTimeout = 600;
            PrepareCommand(Command.IDbCommand, Connection.iDbConnection, (SqlTransaction)null);
            int retval = -1;

            try
            {
                retval = Command.IDbCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Command.IDbCommand.Parameters.Clear();
            if (Connection.iDbConnection.State != ConnectionState.Closed)
            {
                Connection.iDbConnection.Close();
            }
            return(retval);
        }
 public bool ExecuteNonQuery(IConnectionCustom Connection, List <ICommandCustom> CommandList)
 {
     if (Connection == null)
     {
         Connection = _dbConnection;
     }
     if (Connection == null)
     {
         throw new Exception("数据库连接SqlConnection对象不存在");
     }
     if (CommandList == null)
     {
         throw new Exception("SqlBaseCommand不存在");
     }
     if (CommandList.Count == 0)
     {
         throw new Exception("SqlBaseCommand只有O条");
     }
     if (CommandList.Count == 1)
     {
         return(((CommandCustom)CommandList[0]).comparison(ExecuteNonQuery(Connection, CommandList[0])));
     }
     else
     {
         SqlTransactionCustom Transaction = new SqlTransactionCustom(Connection.iDbConnection);
         Transaction.BeginTransaction();
         try
         {
             CommandCustom Command;
             for (int i = 0; i < CommandList.Count; i++)
             {
                 Command = ((CommandCustom)CommandList[i]);
                 Command.ComparisonTypeCustom = ComparisonTypeCustom.ThanEqual;
                 if (!Command.comparison(ExecuteNonQuery(Transaction, Command)))
                 {
                     Transaction.Rollback();
                     return(false);
                 }
             }
             Transaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             Transaction.Rollback();
             throw ex;
         }
     }
 }
 public ConnectionCustom(string connectionString)
 {
     _connectionString = connectionString;
     switch (DatabaseTypeCustom)
     {
     case DatabaseTypeCustom.Sql:
         _ConnectionCustom = new SqlConnectionCustom(connectionString);
         break;
         //case DatabaseTypeCustom.Oracle:
         //    _ConnectionCustom = new FWMySqlConnection(connectionString);
         //    break;
         //case DatabaseTypeCustom.Odbc:
         //    _ConnectionCustom = new FWOdbcConnection(connectionString);
         //    break;
         //case DatabaseTypeCustom.OleDb:
         //    _ConnectionCustom = new FWOleDbConnection(connectionString);
         //    break;
         //case DatabaseTypeCustom.MySql:
         //    _ConnectionCustom = new FWMySqlConnection(connectionString);
         //    break;
     }
 }
 public int ExecuteNonQuery(IConnectionCustom Connection, ICommandCustom Command)
 {
     return(_iFWCommandHelper.ExecuteNonQuery(Connection, Command));
 }
        public static List <T> queryList <T>(IConnectionCustom connection, ICommandCustom command)
        {
            SqlEntityToCommandCustom sqlEntityToCommandCustom = new SqlEntityToCommandCustom();

            return(sqlEntityToCommandCustom.queryList <T>(connection, command));
        }
Beispiel #6
0
        public static List <T> queryList <T>(IConnectionCustom connection, ICommandCustom command)
        {
            EntityToCommandCustom fwEntityToFWCommand = new EntityToCommandCustom(command.DatabaseTypeCustom);

            return(fwEntityToFWCommand.queryList <T>(connection, command));
        }
Beispiel #7
0
 public CommandCustom(IConnectionCustom connectionCustom)
     : this(connectionCustom != null ? connectionCustom.DatabaseTypeCustom : (new ConnectionCustom()).DatabaseTypeCustom)
 {
 }
Beispiel #8
0
 public EntityToCommandCustom(IConnectionCustom fwConnection)
     : this(fwConnection != null ? fwConnection.DatabaseTypeCustom : (new ConnectionCustom()).DatabaseTypeCustom)
 {
 }
Beispiel #9
0
 public T query <T>(IConnectionCustom connection, string afterWhereSql, List <IParameterCustom> afterWhereSqlParams)
 {
     return(entityToCommandCustom.query <T>(connection, afterWhereSql, afterWhereSqlParams));
 }
 public CommandCustomHelper(IConnectionCustom iConnectionCustom)
     : this(iConnectionCustom.DatabaseTypeCustom)
 {
     _connectionString = iConnectionCustom.connectionString;
 }
 public DataTable ExecuteDataTable(IConnectionCustom Connection, ICommandCustom Command)
 {
     return(ExecuteDataSet(Connection, Command).Tables[0]);
 }
 public DataSet ExecuteDataSet(IConnectionCustom Connection, ICommandCustom Command)
 {
     return(ExecuteDataSet(Connection.iDbConnection, Command.IDbCommand));
 }
        public static List <IDbResultCustom> insertOrUpdate <T>(IConnectionCustom connection, List <T> entityList, List <string> idPropertyNameList)
        {
            SqlEntityToCommandCustom sqlEntityToCommandCustom = new SqlEntityToCommandCustom();

            return(sqlEntityToCommandCustom.insertOrUpdate <T>(connection, entityList, idPropertyNameList));
        }
 public DataTable ExecuteDataTable(IConnectionCustom Connection, ICommandCustom Command)
 {
     return(_iFWCommandHelper.ExecuteDataTable(Connection, Command));
 }
Beispiel #15
0
        public static int ExecuteNonQuery(IConnectionCustom Connection, ICommandCustom Command)
        {
            CommandCustomHelper fwCommandHelper = new CommandCustomHelper(Connection);

            return(fwCommandHelper.ExecuteNonQuery(Connection, Command));
        }
 public bool ExecuteNonQuery(IConnectionCustom Connection, List <ICommandCustom> CommandList)
 {
     return(_iFWCommandHelper.ExecuteNonQuery(Connection, CommandList));
 }
Beispiel #17
0
        public static DataTable ExecuteDataTable(IConnectionCustom Connection, ICommandCustom Command)
        {
            CommandCustomHelper fwCommandHelper = new CommandCustomHelper(Connection);

            return(fwCommandHelper.ExecuteDataTable(Connection, Command));
        }
Beispiel #18
0
 public List <IDbResultCustom> insertOrUpdate <T>(IConnectionCustom connection, List <T> entityList, List <string> idPropertyNameList, List <string> uniquePropertyNameList)
 {
     return(entityToCommandCustom.insertOrUpdate(connection, entityList, idPropertyNameList, uniquePropertyNameList));
 }
        public static DataTable ExecuteDataTable(IConnectionCustom Connection, ICommandCustom Command)
        {
            SqlCommandHelper commandHelper = new SqlCommandHelper();

            return(commandHelper.ExecuteDataTable(Connection, Command));
        }
Beispiel #20
0
 public List <T> queryList <T>(IConnectionCustom connection, ICommandCustom fwcmd)
 {
     return(entityToCommandCustom.queryList <T>(connection, fwcmd));
 }
        public static bool ExecuteNonQuery(IConnectionCustom Connection, List <ICommandCustom> CommandList)
        {
            SqlCommandHelper commandHelper = new SqlCommandHelper();

            return(commandHelper.ExecuteNonQuery(Connection, CommandList));
        }
Beispiel #22
0
 public IDbResultCustom insertOrUpdate <T>(IConnectionCustom connection, T entity, List <string> idPropertyNameList)
 {
     return(entityToCommandCustom.insertOrUpdate(connection, entity, idPropertyNameList));
 }
        public static int ExecuteNonQuery(IConnectionCustom Connection, ICommandCustom Command)
        {
            SqlCommandHelper commandHelper = new SqlCommandHelper();

            return(commandHelper.ExecuteNonQuery(Connection, Command));
        }
Beispiel #24
0
        public static T query <T>(IConnectionCustom connection, string afterWhereSql, List <IParameterCustom> afterWhereSqlParams)
        {
            EntityToCommandCustom fwEntityToFWCommand = new EntityToCommandCustom(connection);

            return(fwEntityToFWCommand.query <T>(connection, afterWhereSql, afterWhereSqlParams));
        }
 public int ExecuteScalar(IConnectionCustom Connection, ICommandCustom Command)
 {
     return(_iFWCommandHelper.ExecuteScalar(Connection, Command));
 }
Beispiel #26
0
        public static List <IDbResultCustom> insertOrUpdate <T>(IConnectionCustom connection, List <T> entityList, List <string> idPropertyNameList)
        {
            EntityToCommandCustom fwEntityToFWCommand = new EntityToCommandCustom(connection);

            return(fwEntityToFWCommand.insertOrUpdate <T>(connection, entityList, idPropertyNameList));
        }
        public static T query <T>(IConnectionCustom connection, string afterWhereSql, List <IParameterCustom> afterWhereSqlParams)
        {
            SqlEntityToCommandCustom sqlEntityToCommandCustom = new SqlEntityToCommandCustom();

            return(sqlEntityToCommandCustom.query <T>(connection, afterWhereSql, afterWhereSqlParams));
        }