2023-03-15 13:38:06 +00:00
|
|
|
using InnovEnergy.App.Backend.DataTypes;
|
|
|
|
using InnovEnergy.App.Backend.Relations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace InnovEnergy.App.Backend.Database;
|
|
|
|
|
|
|
|
|
|
|
|
public static partial class Db
|
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
private static Boolean Insert(Object obj)
|
|
|
|
{
|
|
|
|
var success = Connection.Insert(obj) > 0;
|
|
|
|
if(success) BackupDatabase();
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2023-03-15 13:38:06 +00:00
|
|
|
public static Boolean Create(Installation installation)
|
|
|
|
{
|
|
|
|
// SQLite wrapper is smart and *modifies* t's Id to the one generated (autoincrement) by the insertion
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(installation);
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(Folder folder)
|
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(folder);
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(User user)
|
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(user);
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(Session session)
|
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(session);
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|
|
|
|
|
2023-03-16 08:25:36 +00:00
|
|
|
public static Boolean Create(InstallationAccess installationAccess)
|
2023-03-16 08:15:59 +00:00
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(installationAccess);
|
2023-03-16 08:15:59 +00:00
|
|
|
}
|
|
|
|
|
2023-03-16 08:25:36 +00:00
|
|
|
public static Boolean Create(FolderAccess folderAccess)
|
2023-03-16 08:15:59 +00:00
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(folderAccess);
|
2023-03-16 08:15:59 +00:00
|
|
|
}
|
2023-03-23 13:58:59 +00:00
|
|
|
|
|
|
|
public static Boolean Create(OrderNumber2Installation o2i)
|
|
|
|
{
|
2023-07-13 11:23:05 +00:00
|
|
|
return Insert(o2i);
|
2023-03-23 13:58:59 +00:00
|
|
|
}
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|