CEL_Payroll/Payroll.BO/Query Analyzer/BOAdministrator.cs
2024-09-17 14:30:13 +06:00

75 lines
1.5 KiB
C#

using System;
using System.Collections;
namespace Payroll.BO
{
public class BOAdministrator
{
public BOAdministrator()
{
//SQLHelper.CloseConnection();
}
public void DatabaseBackup(string sFilePath)
{
int nCount=0;
DAAdministrator oAdmin=new DAAdministrator();
try
{
nCount++;
oAdmin.DatabaseBackup(sFilePath);
}
catch(Exception e)
{
if(nCount<=3)
{
nCount++;
oAdmin=new DAAdministrator();
oAdmin.DatabaseBackup(sFilePath);
}
else
{
//oAdmin=null;
throw new Exception(e.Message);
}
}
}
public void RestoreDatabase(string sDBName, string sBackupFilePath,string sToDataFilePath,string sToLogFilePath)
{
try
{
DAAdministrator oAdmin=new DAAdministrator();
oAdmin.RestoreDatabase(sDBName,sBackupFilePath,sToDataFilePath,sToLogFilePath);
oAdmin=null;
}
catch(Exception e)
{
throw new Exception(e.Message);
}
}
public void DatabaseRestore(string sFilePath)
{
try
{
DAAdministrator oAdmin=new DAAdministrator();
oAdmin.RestoreDatabase(sFilePath);
oAdmin=null;
}
catch(Exception e)
{
throw new Exception(e.Message);
}
}
public ArrayList GetDataBases()
{
DAAdministrator oAdmin=new DAAdministrator();
return oAdmin.GetDataBases();
}
public void AttachSingleDB(string sFilePath, string sDBName)
{
DAAdministrator oAdmin=new DAAdministrator();
oAdmin.AttachSingleDB(sFilePath,sDBName);
}
}
}