General tidy.
This commit is contained in:
@@ -78,7 +78,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetSystemAccountUser\n\tQuery: " + dbCommand.CommandText + "\n\tException: " + exc.Message);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
return SystemAccountUser;
|
||||
@@ -97,7 +97,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Insert SystemAccountUser.
|
||||
public override bool InsertSystemAccountUser(SbmSystemAccountUser systemAccountUser, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertSystemAccountUser";
|
||||
ClearErrorState();
|
||||
if (!IsValidSystemAccountUser(systemAccountUser)) return false;
|
||||
if (SysId.IsValid(systemAccountUser.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
@@ -117,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbSystemAccountUser.ExecuteInsertCommand(dbCommand);
|
||||
systemAccountUser.Id = new SysId(dbSystemAccountUser._AccountId);
|
||||
systemAccountUser.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. {GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -128,14 +127,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Update SystemAccountUser.
|
||||
public override bool UpdateSystemAccountUser(SbmSystemAccountUser systemAccountUser, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateSystemAccountUser";
|
||||
ClearErrorState();
|
||||
if (!IsValidSystemAccountUser(systemAccountUser)) return false;
|
||||
if (!SysId.IsValid(systemAccountUser.AccountId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!SysId.IsValid(systemAccountUser.UserId)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!systemAccountUser.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. {GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t")}");
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -153,7 +151,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
PopulateTo(dbSystemAccountUser, systemAccountUser, dbUpdateInfo);
|
||||
dbSystemAccountUser.ExecuteUpdateCommand(dbCommand);
|
||||
systemAccountUser.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. {GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t")}");
|
||||
|
||||
// Record updates.
|
||||
/*updateLogMonitor.RecordUpdatedValues(systemAccountUser);
|
||||
@@ -174,7 +172,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
public override bool DeleteSystemAccountUser(SbmSystemAccountUser systemAccountUser, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteSystemAccountUser";
|
||||
ClearErrorState();
|
||||
if (!SystemAccountUserCanBeDeleted(systemAccountUser)) return false;
|
||||
using (var dbConnection = db.CreateConnection())
|
||||
@@ -191,7 +188,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
dbCommand.CommandText = "DELETE FROM " + SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SystemAccountUser) + " WHERE Id=" + SysId.ToString(systemAccountUser.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
systemAccountUser.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t"));
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. {GetLogProperties(systemAccountUser).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
@@ -457,7 +454,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// SystemAccountUser list.
|
||||
public override List<SbmSystemAccountUser> GetSystemAccountUserList(SbmSystemAccountUser.Params prm)
|
||||
{
|
||||
List<SbmSystemAccountUser> SystemAccountUseres = new List<SbmSystemAccountUser>();
|
||||
ClearErrorState();
|
||||
List<SbmSystemAccountUser> systemAccountUsers = new List<SbmSystemAccountUser>();
|
||||
DbQuery qry = new DbQuery(db.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SystemAccountUser), aliasSystemAccountUser);
|
||||
SystemAccountUser_Db dbSystemAccountUser = new SystemAccountUser_Db(DbInfo);
|
||||
@@ -478,16 +476,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
dbSystemAccountUser = new SystemAccountUser_Db(DbInfo);
|
||||
dbSystemAccountUser.PopulateFrom(dbDataReader);
|
||||
SystemAccountUseres.Add(CreateSystemAccountUser(dbSystemAccountUser));
|
||||
systemAccountUsers.Add(CreateSystemAccountUser(dbSystemAccountUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetSystemAccountUserList\n\tQuery: " + dbCommand.CommandText + "\n\tException: " + exc.Message);
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
return SystemAccountUseres;
|
||||
return systemAccountUsers;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user