diff --git a/labs/CameraCard/CameraCard/Data/Entity.cs b/labs/CameraCard/CameraCard/Data/Entity.cs new file mode 100644 index 00000000..fdea0644 --- /dev/null +++ b/labs/CameraCard/CameraCard/Data/Entity.cs @@ -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; } + } +} \ No newline at end of file diff --git a/labs/CameraCard/CameraCard/Data/MyDbContext.cs b/labs/CameraCard/CameraCard/Data/MyDbContext.cs new file mode 100644 index 00000000..6e2203eb --- /dev/null +++ b/labs/CameraCard/CameraCard/Data/MyDbContext.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore; + +namespace CameraCard.Data +{ + public class MyDbContext : DbContext + { + public DbSet Users { get; set; } + public DbSet 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" }); + } + } +} \ No newline at end of file diff --git a/labs/CameraCard/CameraCard/Data/Student.cs b/labs/CameraCard/CameraCard/Data/Student.cs new file mode 100644 index 00000000..7dcbe496 --- /dev/null +++ b/labs/CameraCard/CameraCard/Data/Student.cs @@ -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; } + } +} \ No newline at end of file diff --git a/labs/CameraCard/CameraCard/Data/User.cs b/labs/CameraCard/CameraCard/Data/User.cs new file mode 100644 index 00000000..636067e4 --- /dev/null +++ b/labs/CameraCard/CameraCard/Data/User.cs @@ -0,0 +1,8 @@ +namespace CameraCard.Data +{ + public class User : Entity + { + public string UserName { get; set; } + public string PasswordHash { get; set; } + } +} \ No newline at end of file diff --git a/labs/CameraCard/CameraCard/Infrastructure/DllExtern.cs b/labs/CameraCard/CameraCard/Infrastructure/DllExtern.cs new file mode 100644 index 00000000..35a758d2 --- /dev/null +++ b/labs/CameraCard/CameraCard/Infrastructure/DllExtern.cs @@ -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); + } +} \ No newline at end of file