Browse Source

Account constructor with int calling other constructor

master
Gregory Rudolph 3 years ago
parent
commit
558c02ac02
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 9
      Account.cs
  2. 4
      GMTicket.cs

9
Account.cs

@ -19,8 +19,7 @@ namespace NightmareCoreWeb2
public List<Character> Characters { get; set; } public List<Character> Characters { get; set; }
public List<AccountAccess> Access { get; set; } public List<AccountAccess> Access { get; set; }
public Account(int id)
public static Account AccountByID(int id)
{ {
MySqlConnection conn = new MySqlConnection(Program.connStr); MySqlConnection conn = new MySqlConnection(Program.connStr);
@ -33,7 +32,7 @@ namespace NightmareCoreWeb2
{ {
try try
{ {
return new Account(rdr.GetString(0)); new Account(rdr.GetString(0));
} }
catch (Exception e) catch (Exception e)
@ -41,9 +40,9 @@ namespace NightmareCoreWeb2
Console.WriteLine(e); Console.WriteLine(e);
} }
} }
return null;
} }
public Account(string username) public Account(string username)
{ {
MySqlConnection conn = new MySqlConnection(Program.connStr); MySqlConnection conn = new MySqlConnection(Program.connStr);
@ -115,7 +114,7 @@ namespace NightmareCoreWeb2
Console.WriteLine(e); Console.WriteLine(e);
} }
} }
foreach (var access in this.Access) foreach (var access in this.Access)
{ {
if (access.RealmID == -1 && access.RealmID >= 1) if (access.RealmID == -1 && access.RealmID >= 1)
{ {

4
GMTicket.cs

@ -66,11 +66,11 @@ namespace NightmareCoreWeb2
this.LastModifiedTime = DateTimeOffset.FromUnixTimeSeconds(rdr.GetInt32(3)).UtcDateTime; this.LastModifiedTime = DateTimeOffset.FromUnixTimeSeconds(rdr.GetInt32(3)).UtcDateTime;
if (rdr.GetInt32(4) != 0) if (rdr.GetInt32(4) != 0)
{ {
this.ClosedBy = Account.AccountByID(rdr.GetInt32(4)); this.ClosedBy = new Account(rdr.GetInt32(4));
} }
if (rdr.GetInt32(5) != 0) if (rdr.GetInt32(5) != 0)
{ {
this.AssignedTo = Account.AccountByID(rdr.GetInt32(5)); this.AssignedTo = new Account(rdr.GetInt32(5));
} }
this.Description = rdr.GetString(6); this.Description = rdr.GetString(6);
} }

Loading…
Cancel
Save