Continued business system
This commit is contained in:
35
Server/Business/IBusiness.cs
Normal file
35
Server/Business/IBusiness.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Business
|
||||
{
|
||||
public abstract class BusinessBase : IBankAccountOwner
|
||||
{
|
||||
public abstract int Id { get; }
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract Vector3 Position { get; }
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == this.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Load();
|
||||
}
|
||||
}
|
||||
23
Server/Business/TestBusiness.cs
Normal file
23
Server/Business/TestBusiness.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Util;
|
||||
|
||||
namespace reallife_gamemode.Server.Business
|
||||
{
|
||||
class TestBusiness : BusinessBase
|
||||
{
|
||||
public override int Id => 1;
|
||||
|
||||
public override string Name => "Test Business";
|
||||
|
||||
public override Vector3 Position => throw new NotImplementedException();
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user