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