2021-07-21 16:57:47 +05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace Diplom_O.DataBase
|
|
|
|
|
{
|
|
|
|
|
public class MainDB : DbContext
|
|
|
|
|
{
|
|
|
|
|
public DbSet<Shtat> Shtat { get; set; }
|
|
|
|
|
public DbSet<Rabotnik> Rabotniky { get; set; }
|
|
|
|
|
public DbSet<Chel> Chely { get; set; }
|
|
|
|
|
|
|
|
|
|
public MainDB()
|
|
|
|
|
{
|
|
|
|
|
Database.EnsureCreated();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
optionsBuilder.UseSqlite("Data Source=" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Diplom_O.db;");
|
|
|
|
|
}
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder) { }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class Rabotnik
|
|
|
|
|
{
|
|
|
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
public int Id { get; set; }
|
2021-07-23 16:44:42 +05:00
|
|
|
|
[ForeignKey("Chel")]
|
2021-07-21 16:57:47 +05:00
|
|
|
|
public int ChelId { get; set; }
|
|
|
|
|
public Chel Chel { get; set; }
|
2021-07-23 16:44:42 +05:00
|
|
|
|
[ForeignKey("Shtat")]
|
2021-07-21 16:57:47 +05:00
|
|
|
|
public int ShtatId { get; set; }
|
|
|
|
|
public Shtat Shtat { get; set; }
|
|
|
|
|
|
|
|
|
|
public string KodSotr { get; set; }
|
|
|
|
|
public string Kategoriya { get; set; }
|
|
|
|
|
public bool Pensiya { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime Start { get; set; }
|
|
|
|
|
public DateTime? End { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Shtat
|
|
|
|
|
{
|
|
|
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public string Doljnost { get; set; }
|
|
|
|
|
public int Size { get; set; }
|
|
|
|
|
public bool Active { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Chel
|
|
|
|
|
{
|
|
|
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public string FName { get; set; }
|
|
|
|
|
public string SName { get; set; }
|
|
|
|
|
public string TName { get; set; }
|
|
|
|
|
public bool Male { get; set; }
|
|
|
|
|
public DateTime Birthday { get; set; }
|
|
|
|
|
public string Address { get; set; }
|
|
|
|
|
public string INN { get; set; }
|
|
|
|
|
public string SNILS { get; set; }
|
|
|
|
|
public string Pasport { get; set; }
|
|
|
|
|
public List<Rabotnik> Rabota { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|