OracleConnection connection = new OracleConnection(DbHelper.ServerInfo.GetConnectionString(DBLogin, DBPassword));
connection.Open();
return connection;
}
public static Oracle.DataAccess.Client.OracleConnection GetConnectionODP()
{
Oracle.DataAccess.Client.OracleConnection connection = new Oracle.DataAccess.Client.OracleConnection(DbHelper.ServerInfo.GetConnectionString(DBLogin, DBPassword));
connection.Open();
return connection;
}
public static string CheckConnection()
{
try
{
using (OracleConnection connection = GetConnection()) return "";
}
catch (Exception excpt)
{
return excpt.Message;
}
}
public static bool DisplayConnectionError(IWin32Window owner)
{
string connectionError = CheckConnection();
if (connectionError != "")
{
MessageBox.Show(owner, connectionError);
return true;
}
return false;
}
public static string ExecuteScript(string script)
{
OracleBatchCommand batch = new OracleBatchCommand();
batch.InitFromString(script);
batch.StatementExecuted += new StatementExecutedDelegate(batch_StatementExecuted);
using (OracleConnection connection = GetConnection())
return batch.Execute(connection);
}
public static string ExecuteScripts(params string[] scripts)
{
string resultScript = "";
foreach (string script in scripts)
resultScript += script + "\r\n";
return ExecuteScript(resultScript);
}
static void batch_StatementExecuted(int statementIndex, int statementsTotal) { StatementExecuted(statementIndex, statementsTotal); }
public static void ExecuteScriptAndShowErrors(string script)
{
string error = ExecuteScript(script);
if (!string.IsNullOrEmpty(error))
MessageBox.Show(error);
}
/// <summary>
/// Проверка на наличие юзверя
/// </summary>
/// <returns></returns>
public static bool TryLogin(string username, string password)
{
try
{
using (OracleConnection connection = GetConnection())
using (OracleCommand cmd = new OracleCommand(AdminName + ".TryToLogin", connection))
{
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter loginParam = cmd.Parameters.AddWithValue("pLOGIN", username);
OracleParameter passParam = cmd.Parameters.AddWithValue("pPASSWORD", getHashString(password));
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.