update news & events
This commit is contained in:
37
TWASys-App/DBModels/DBManagement.cs
Normal file
37
TWASys-App/DBModels/DBManagement.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using MySqlConnector;
|
||||
|
||||
namespace TWASys_App.DBModels
|
||||
{
|
||||
public class DBManagement
|
||||
{
|
||||
public static string GetConnectionString()
|
||||
{
|
||||
string fp = Path.GetFullPath("Keys/db/");
|
||||
|
||||
var builder = new MySqlConnectionStringBuilder
|
||||
{
|
||||
Pooling = true, // mặc định đã true
|
||||
MinimumPoolSize = 0, // số kết nối nền tối thiểu
|
||||
MaximumPoolSize = 400, // tăng nếu tải đồng thời cao
|
||||
ConnectionLifeTime = 2520,
|
||||
ConnectionIdleTimeout = 1080, //
|
||||
Keepalive=60,
|
||||
InteractiveSession = true, // dùng interactive_timeout thay vì wait_timeout
|
||||
ConnectionReset = true,
|
||||
Server = "103.116.104.146",
|
||||
Port = 3306,
|
||||
Database = "Storage_TWA_DB",
|
||||
UserID = "apptwa",
|
||||
Password = "Twa@2025!StorageDB",
|
||||
// TLS/SSL
|
||||
SslMode = MySqlSslMode.Required, // hoặc VerifyCA / VerifyFull nếu có hostname chuẩn
|
||||
SslCa = Path.Combine(fp, "ca-cert.pem"),
|
||||
SslCert = Path.Combine(fp, "client-cert.pem"),
|
||||
SslKey = Path.Combine(fp, "client-key.pem"),
|
||||
};
|
||||
//172.168.192.204
|
||||
return builder.ConnectionString;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
73
TWASys-App/DBModels/LocalServer.cs
Normal file
73
TWASys-App/DBModels/LocalServer.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace TWASys_App.DBModels
|
||||
{
|
||||
public class LocalServer
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column("idLocalServer")]
|
||||
public int IdLocalServer { get; set; } = 0;
|
||||
|
||||
[StringLength(20)]
|
||||
[Column("ipPrivateServer")]
|
||||
public string IpPrivateServer { get; set; } = "";
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("ipPrivateServer6")]
|
||||
public string IpPrivateServer6 { get; set; } = "";
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("ipPublicServer")]
|
||||
public string IpPublicServer { get; set; } = "";
|
||||
|
||||
[StringLength(45)]
|
||||
[Column("pathServer")]
|
||||
public string PathServer { get; set; } = "";
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("serialNumber")]
|
||||
public string SerialNumber { get; set; } = "";
|
||||
|
||||
// Ảnh gốc ghi "osVesion" (sai chính tả). Giữ nguyên để khớp DB.
|
||||
[StringLength(100)]
|
||||
[Column("osVesion")]
|
||||
public string OsVersion { get; set; } = "";
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("osName")]
|
||||
public string OsName { get; set; } = "";
|
||||
|
||||
[StringLength(45)]
|
||||
[Column("osArch")]
|
||||
public string OsArch { get; set; } = "";
|
||||
|
||||
// Ảnh gốc ghi "osKernal". Giữ nguyên để khớp DB.
|
||||
[StringLength(100)]
|
||||
[Column("osKernal")]
|
||||
public string OsKernel { get; set; } = "";
|
||||
|
||||
[Column("socketNum")]
|
||||
public int SocketNum { get; set; } = 0;
|
||||
|
||||
[StringLength(150)]
|
||||
[Column("cpuName")]
|
||||
public string CpuName { get; set; } = "";
|
||||
|
||||
[Column("totalRam")]
|
||||
public int TotalRam { get; set; } = 0;
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("biosVendor")]
|
||||
public string BiosVendor { get; set; } = "";
|
||||
|
||||
[StringLength(100)]
|
||||
[Column("productUUID")]
|
||||
public string ProductUuid { get; set; } = "";
|
||||
|
||||
[Column("status")]
|
||||
public int Status { get; set; } = 0;
|
||||
|
||||
}
|
||||
}
|
||||
23
TWASys-App/DBModels/StorageServer_has_LocalServer.cs
Normal file
23
TWASys-App/DBModels/StorageServer_has_LocalServer.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace TWASys_App.DBModels
|
||||
{
|
||||
public class StorageServerHasLocalServer
|
||||
{
|
||||
|
||||
[Column("idStorageServer")]
|
||||
public int IdStorageServer { get; set; } = 0;
|
||||
|
||||
[Column("idLocalServer")]
|
||||
public int IdLocalServer { get; set; } = 0;
|
||||
|
||||
[Column("createDate")]
|
||||
public DateTime CreateDate { get; set; } = DateTime.UtcNow; // nên lưu UTC
|
||||
|
||||
[Column("modifyDate")]
|
||||
public DateTime? ModifyDate { get; set; } = null; // nên lưu UTC
|
||||
|
||||
[Column("status")]
|
||||
public int Status { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
17
TWASys-App/DBModels/TypeStorageServer.cs
Normal file
17
TWASys-App/DBModels/TypeStorageServer.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TWASys_App.DBModels
|
||||
{
|
||||
public class TypeStorageServer
|
||||
{
|
||||
[Key]
|
||||
public int IdTypeStorageServer { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
|
||||
public TypeStorageServer()
|
||||
{
|
||||
IdTypeStorageServer = 0;
|
||||
TypeName = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
TWASys-App/DBModels/ValidationDomain.cs
Normal file
22
TWASys-App/DBModels/ValidationDomain.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TWASys_App.DBModels
|
||||
{
|
||||
public class ValidationDomain
|
||||
{
|
||||
[Key]
|
||||
public int IdValidationDomain { set; get; }
|
||||
|
||||
public string Protocol { set; get; }
|
||||
public int PortNumber { set; get; }
|
||||
public string DomainName { set; get; }
|
||||
|
||||
public ValidationDomain()
|
||||
{
|
||||
IdValidationDomain = 0;
|
||||
Protocol = string.Empty;
|
||||
DomainName = string.Empty;
|
||||
PortNumber = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user