Innovenergy_trunk/csharp/App/Backend/Database/Update.cs

47 lines
1.0 KiB
C#
Raw Normal View History

2023-03-15 13:38:06 +00:00
using InnovEnergy.App.Backend.DataTypes;
namespace InnovEnergy.App.Backend.Database;
public static partial class Db
{
private static Boolean Update(Object obj)
{
var success = Connection.Update(obj) > 0;
if(success) Backup();
return success;
}
2023-03-15 13:38:06 +00:00
public static Boolean Update(Folder folder)
{
return Update(obj: folder);
2023-03-15 13:38:06 +00:00
}
2023-11-22 08:35:29 +00:00
public static Boolean Update(Error error)
{
return Update(obj: error);
}
public static Boolean Update(Warning warning)
{
return Update(obj: warning);
}
2023-03-15 13:38:06 +00:00
public static Boolean Update(Installation installation)
{
return Update(obj: installation);
2023-03-15 13:38:06 +00:00
}
public static Boolean Update(User user)
{
var originalUser = GetUserById(user.Id);
2023-04-06 06:32:47 +00:00
if (originalUser is null) return false;
// these columns must not be modified!
user.ParentId = originalUser.ParentId;
user.Name = originalUser.Name;
return Update(obj: user);
2023-03-15 13:38:06 +00:00
}
}