添加缺失提交的文件

Former-commit-id: 57eb8ecf926da09615745caf037a17cc63ae2100
TangShanKaiPing
wanggang 5 years ago
parent 689c211a6a
commit 6c4ce59062

@ -0,0 +1,14 @@
using System;
namespace CameraCard.Data
{
public abstract class Entity
{
public Entity()
{
this.Id = Guid.NewGuid().ToString();
}
public string Id { get; set; }
}
}

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
namespace CameraCard.Data
{
public class MyDbContext : DbContext
{
public DbSet<User> Users { get; set; }
public DbSet<Student> Students { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite("Data Source=data.db;Password=123456;");
public static void Init()
{
using (var db = new MyDbContext())
{
if (db.Database.EnsureCreated())
{
db.Seed();
}
}
}
private void Seed()
{
this.Users.Add(new User { UserName = "admin", PasswordHash = "123456" });
}
}
}

@ -0,0 +1,13 @@
using System;
namespace CameraCard.Data
{
public class Student : Entity
{
public string Name { get; set; }
public string IdCardNo { get; set; }
public string Image { get; set; }
public bool HasUploaded { get; set; }
public bool IsChecked { get; set; }
}
}

@ -0,0 +1,8 @@
namespace CameraCard.Data
{
public class User : Entity
{
public string UserName { get; set; }
public string PasswordHash { get; set; }
}
}

@ -0,0 +1,14 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public static class DllExtern
{
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public static void FullScreen(this Control control)
{
SetParent(control.Handle, IntPtr.Zero);
}
}
Loading…
Cancel
Save