Automatic add business bank account, renamed sms to telephone business
This commit is contained in:
@@ -36,12 +36,25 @@ namespace reallife_gamemode.Server.Business
|
||||
public void Setup()
|
||||
{
|
||||
_informationLabel = NAPI.TextLabel.CreateTextLabel(Name, Position, 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
||||
|
||||
if (GetBankAccount() == null)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("Creating Bank Account for Business: " + Name);
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
|
||||
dbContext.BusinessBankAccounts.Add(new BusinessBankAccount()
|
||||
{
|
||||
BusinessId = Id,
|
||||
Balance = 0
|
||||
});
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
//NAPI.Util.ConsoleOutput("Updating Business: " + Name);
|
||||
|
||||
User owner = GetOwner();
|
||||
string infoText = Name + "\n" + "Besitzer: " + (owner == null ? "Niemand" : owner.Name) + "\nKasse: " + (GetBankAccount()?.Balance ?? 0);
|
||||
_informationLabel.Text = infoText;
|
||||
@@ -52,7 +65,6 @@ namespace reallife_gamemode.Server.Business
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User user = dbContext.Users.FirstOrDefault(u => u.BusinessId == Id);
|
||||
//NAPI.Util.ConsoleOutput("[" + Name + "] GetOwner: " + (user?.Name ?? "null"));
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
21
Server/Business/ShopBusiness.cs
Normal file
21
Server/Business/ShopBusiness.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace reallife_gamemode.Server.Business
|
||||
{
|
||||
class ShopBusiness : BusinessBase
|
||||
{
|
||||
public override int Id => 2;
|
||||
|
||||
public override string Name => "24/7 Business";
|
||||
|
||||
public override Vector3 Position => new Vector3();
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ using GTANetworkAPI;
|
||||
|
||||
namespace reallife_gamemode.Server.Business
|
||||
{
|
||||
public class SmsBusiness : BusinessBase
|
||||
public class TelefonBusiness : BusinessBase
|
||||
{
|
||||
public override int Id => 1;
|
||||
|
||||
public override string Name => "SMS Business";
|
||||
public override string Name => "Telefon Business";
|
||||
|
||||
public override Vector3 Position => new Vector3(-423, 1130, 326);
|
||||
|
||||
Reference in New Issue
Block a user