Files
DE70/Model/CDMDbContext.cs
T
2024-09-16 23:46:33 +07:00

132 lines
3.9 KiB
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HandyControl.Controls;
using HandyControl.Expression.Shapes;
using System.Data;
namespace SafeBagDE70.Model
{
internal class CDMDbContext:DbContext
{
public DbSet<History> Histories { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<DeviceEvent> DeviceEvents { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=.\\SQLEXPRESS;Database=CDMLOCAL;User Id=cdm;Password=Navis@123;Trusted_Connection=False;TrustServerCertificate=True");
}
}
public class History
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime? DepositTime { get; set; }
public string UserCode { get; set; }
public string Data { get; set; }
public bool? IsSent { get; set; }
public DateTime? SyncTime { get; set; }
public string? Status { get; set; }
}
public class DeviceEvent
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Data { get; set; }
public bool? IsSent { get; set; }
public DateTime? SyncTime { get; set; }
public DateTime? DeviceTime { get; set; }
}
public class Customer
{
public int Id { get; set; }
public string? TenantName { get; set; }
public string? TenantCode { get; set; }
public string? AccountNumber { get; set; }
public string? AccountHolder { get; set; }
public string? PinCode { get; set; }
public DateTime? UpdatedTime { get; set; }
}
// USE[CDMLOCAL]
//GO
///****** Object: Table [dbo].[Customers] Script Date: 07/09/2024 11:22:32 ******/
//SET ANSI_NULLS ON
//GO
//SET QUOTED_IDENTIFIER ON
//GO
//CREATE TABLE[dbo].[Customers]
// (
// [Id][int] IDENTITY(1,1) NOT NULL,
// [TenantName] [nvarchar] (50) NULL,
// [TenantCode][nvarchar] (128) NULL,
// [AccountNumber][nvarchar] (128) NULL,
// [AccountHolder][nvarchar] (128) NULL,
// [PinCode][nvarchar] (128) NULL,
// [UpdatedTime][datetime] NULL,
// CONSTRAINT[PK_Customers] PRIMARY KEY CLUSTERED
//(
// [Id] ASC
//)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON[PRIMARY]
//) ON[PRIMARY]
//GO
///****** Object: Table [dbo].[DeviceEvents] Script Date: 07/09/2024 11:22:32 ******/
//SET ANSI_NULLS ON
//GO
//SET QUOTED_IDENTIFIER ON
//GO
//CREATE TABLE[dbo].[DeviceEvents]
// (
// [Id][int] IDENTITY(1,1) NOT NULL,
// [Data] [nvarchar] (1024) NULL,
// [SyncTime][datetime] NULL,
// [IsSent][bit] NULL,
// [DeviceTime][datetime] NULL,
// CONSTRAINT[PK_DeviceStatus] PRIMARY KEY CLUSTERED
//(
// [Id] ASC
//)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON[PRIMARY]
//) ON[PRIMARY]
//GO
///****** Object: Table [dbo].[Histories] Script Date: 07/09/2024 11:22:32 ******/
//SET ANSI_NULLS ON
//GO
//SET QUOTED_IDENTIFIER ON
//GO
//CREATE TABLE[dbo].[Histories]
// (
// [Id][int] IDENTITY(1,1) NOT NULL,
// [DepositTime] [datetime] NULL,
// [UserCode][nvarchar] (128) NULL,
// [Data][nvarchar] (1024) NULL,
// [IsSent][bit] NULL,
// [SyncTime][datetime] NULL,
// [Status][nvarchar] (1024) NULL,
// CONSTRAINT[PK_History] PRIMARY KEY CLUSTERED
//(
// [Id] ASC
//)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON[PRIMARY]
//) ON[PRIMARY]
//GO
}