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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user