Update to new namespace Entities
This commit is contained in:
@@ -1,27 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
// Reflections of SQL Database objects
|
||||
|
||||
// Reflections of SQL Database objects
|
||||
|
||||
namespace MistoxWebsite.Shared {
|
||||
|
||||
public class PageLoadObject {
|
||||
public Account? user { get; set; }
|
||||
public AccountClaims? claims { get; set; }
|
||||
public List<Receipt>? receipts { get; set; }
|
||||
public List<Product>? products { get; set; }
|
||||
public List<Cart>? Cart { get; set; }
|
||||
}
|
||||
|
||||
public class DirObj {
|
||||
public FileType? Type { get; set; }
|
||||
public string Path { get; set; } = "";
|
||||
public DirObj? [] Children { get; set; } = new DirObj?[0];
|
||||
}
|
||||
|
||||
public enum FileType {
|
||||
File,
|
||||
Directory
|
||||
}
|
||||
namespace MistoxWebsite.Server.Entities {
|
||||
|
||||
public class Account {
|
||||
public int ID { get; set; } // PK
|
||||
@@ -33,25 +12,6 @@ namespace MistoxWebsite.Shared {
|
||||
public string Error { get; set; } = "";
|
||||
}
|
||||
|
||||
public class Product {
|
||||
public int ID { get; set; } // PK
|
||||
public string Name { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
public int CurShowingIMG = 0;
|
||||
public List<string> Images { get; set; } = new List<string>();
|
||||
public int Cost { get; set; }
|
||||
public string URL { get; set; } = "";
|
||||
}
|
||||
|
||||
public class WebSiteData {
|
||||
public int AccountID { get; set; } // PK
|
||||
public bool FailedPasswordLock { get; set; } = false;
|
||||
public int PasswordAttempts { get; set; } = 5;
|
||||
public int CurrentPasswordAttempts { get; set; } = 0;
|
||||
public string Role { get; set; } = "Generic";
|
||||
public string EmailToken { get; set; } = "";
|
||||
}
|
||||
|
||||
public class AccountInventory {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
@@ -60,25 +20,14 @@ namespace MistoxWebsite.Shared {
|
||||
public string Stats { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class UserInventory {
|
||||
public string Item { get; set; } = string.Empty;
|
||||
public int Quantity { get; set; }
|
||||
public string Stats { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Receipt {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
public string ReceiptID { get; set; } = string.Empty;
|
||||
public int LineItem { get; set; }
|
||||
public int TaxAmount { get; set; }
|
||||
public int TotalCost { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
||||
|
||||
public class ReceiptProduct {
|
||||
public Receipt receipt { get; set; } = new Receipt();
|
||||
public Product product { get; set; } = new Product();
|
||||
public class Product {
|
||||
public int ID { get; set; } // PK
|
||||
public string Name { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
public int CurShowingIMG = 0;
|
||||
public List<string> Images { get; set; } = new List<string>();
|
||||
public int Cost { get; set; }
|
||||
public string URL { get; set; } = "";
|
||||
}
|
||||
|
||||
public class Cart {
|
||||
@@ -97,23 +46,23 @@ namespace MistoxWebsite.Shared {
|
||||
public int Deaths { get; set; }
|
||||
}
|
||||
|
||||
public class AccountClaims {
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string EmailVerified { get; set; } = string.Empty;
|
||||
public string Role { get; set; } = string.Empty;
|
||||
public string FailedPasswordLock { get; set; } = string.Empty;
|
||||
public class Receipt {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
public string ReceiptID { get; set; } = string.Empty;
|
||||
public int LineItem { get; set; }
|
||||
public int TaxAmount { get; set; }
|
||||
public int TotalCost { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
||||
|
||||
public class PaymentObject {
|
||||
public string CardNumber { get; set; } = string.Empty;
|
||||
public long ExperationMonth { get; set; }
|
||||
public long ExperationYear { get; set; }
|
||||
public string CVC { get; set; } = string.Empty;
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string Zip { get; set; } = string.Empty;
|
||||
public List<int> productIDs { get; set; } = new List<int>();
|
||||
public class WebSiteData {
|
||||
public int AccountID { get; set; } // PK
|
||||
public bool FailedPasswordLock { get; set; } = false;
|
||||
public int PasswordAttempts { get; set; } = 5;
|
||||
public int CurrentPasswordAttempts { get; set; } = 0;
|
||||
public string Role { get; set; } = "Generic";
|
||||
public string EmailToken { get; set; } = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace MistoxWebsite.Server.Entities {
|
||||
|
||||
public class PageLoadObject {
|
||||
public Account? user { get; set; }
|
||||
public AccountClaims? claims { get; set; }
|
||||
public List<Receipt>? receipts { get; set; }
|
||||
public List<Product>? products { get; set; }
|
||||
public List<Cart>? Cart { get; set; }
|
||||
}
|
||||
|
||||
public class AccountClaims {
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string EmailVerified { get; set; } = string.Empty;
|
||||
public string Role { get; set; } = string.Empty;
|
||||
public string FailedPasswordLock { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MistoxWebsite.Server.Entities {
|
||||
|
||||
public class UserInventory {
|
||||
public string Item { get; set; } = string.Empty;
|
||||
public int Quantity { get; set; }
|
||||
public string Stats { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
@@ -46,8 +46,8 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
return receipts;
|
||||
}
|
||||
|
||||
public async Task<List<ReceiptProduct>> GetAllReceiptsJoinedToProduct( Account account ) {
|
||||
List<ReceiptProduct> join = new List<ReceiptProduct> ();
|
||||
public async Task<List<( Receipt, Product )>> GetAllReceiptsJoinedToProduct( Account account ) {
|
||||
List<( Receipt, Product )> join = new();
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
connection.Open();
|
||||
string command = @"
|
||||
@@ -78,8 +78,7 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
int _cost = !reader.IsDBNull( "Cost" ) ? reader.GetInt32("Cost") : 0;
|
||||
string _url = !reader.IsDBNull( "URL" ) ? reader.GetString("URL") : "Something Random That Wont Ever Be In A URL";
|
||||
|
||||
join.Add( new ReceiptProduct() {
|
||||
receipt = new Receipt {
|
||||
Receipt r = new() {
|
||||
AccountID = _accountid,
|
||||
ProductID = _gameid,
|
||||
ReceiptID = _receiptid,
|
||||
@@ -87,15 +86,17 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
TotalCost = _totalcost,
|
||||
TaxAmount = _taxamount,
|
||||
LineItem = _lineitem
|
||||
},
|
||||
product = new Product() {
|
||||
};
|
||||
|
||||
Product p = new() {
|
||||
ID = _id,
|
||||
Cost = _cost,
|
||||
Description = _desc,
|
||||
Name = _name,
|
||||
URL = _url
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
join.Add( (r, p) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MistoxWebsite.Shared;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
Reference in New Issue
Block a user