Exemple #1
0
 public DataSet SetWithDataSet(ArrayList param, string SPName, out long ReturnValue, int CompanyIndex = 0)
 {
     ReturnValue = 0L;
     try
     {
         if (General.DataBase.Equals("SQL"))
         {
             SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex));
             ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]);
             this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue);
             return(dbResult.Contents);
         }
     }
     catch (Exception ex)
     {
         this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex.Message, ReturnValue);
     }
     return(new DataSet());
 }
Exemple #2
0
        public static SQLDBResult Execute(string procedureName, ArrayList procedureParameters, string strConnection)
        {
            SQLDBResult   sqldbResult = (SQLDBResult)null;
            SqlConnection connection  = (SqlConnection)null;

            try
            {
                connection = new SqlConnection(strConnection);
                connection.Open();
                SqlCommand selectCommand = SQLAdapter.Procedure(connection, procedureName, (SqlTransaction)null).Command(connection, procedureParameters);
                selectCommand.CommandTimeout = 0;
                sqldbResult = new SQLDBResult();
                new SqlDataAdapter(selectCommand).Fill(sqldbResult.Contents);
                foreach (SqlParameter sqlParameter in (DbParameterCollection)selectCommand.Parameters)
                {
                    switch (sqlParameter.Direction)
                    {
                    case ParameterDirection.Output:
                    case ParameterDirection.InputOutput:
                    case ParameterDirection.ReturnValue:
                        sqldbResult.Parameters[(object)sqlParameter.ParameterName] = sqlParameter.Value;
                        continue;

                    default:
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new SQLAdapter.DbUtilException(ex.Message, ex);
            }
            finally
            {
                if (connection != null && connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
            return(sqldbResult);
        }
Exemple #3
0
        public DataSet Get(ArrayList param, string SPName, int CompanyIndex = 0)
        {
            DataSet dataSet     = new DataSet();
            long    ReturnValue = 0L;

            try
            {
                if (General.DataBase.Equals("SQL"))
                {
                    SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex));
                    dataSet     = dbResult.Contents;
                    ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]);
                    //if (SPName == "sp_GetUserDetails")
                    //    throw new Exception();
                    this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue);
                }
            }
            catch (Exception ex)
            {
                this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex, ReturnValue);
            }
            return(dataSet);
        }
Exemple #4
0
 public bool IsDatabaseExists()
 {
     try
     {
         SQLAdapter.Execute(" if exists(select name from sys.databases where name='pact2c') RAISERROR('-100',16,1) ", SQLAdapter.GetConnection());
         return(false);
     }
     catch (Exception ex)
     {
         return(true);
     }
 }
Exemple #5
0
 public int ExecuteScript(string Query, int CompanyIndex = 0)
 {
     return(SQLAdapter.Execute(Query, SQLAdapter.GetConnection(CompanyIndex)));
 }