Diplom_B/DB/MainDB.cs

75 lines
2.1 KiB
C#
Raw Normal View History

2021-07-15 12:21:22 +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_B.DB
{
public class MainDB : DbContext
{
public DbSet<Zakazchik> Zakazchiki { get; set; }
public DbSet<User> Users { get; set; }
2021-07-15 16:58:51 +05:00
public DbSet<Izdelie> Izdeliya { get; set; }
2021-07-16 16:43:55 +05:00
public DbSet<Izveschenie> Izvescheniya { get; set; }
2021-07-15 16:58:51 +05:00
public MainDB() {
//Database.Migrate();
Database.EnsureCreated();
}
2021-07-15 12:21:22 +05:00
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Diplom_B.db;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder) { }
}
public class User
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string Pass { get; set; }
}
public class Zakazchik
{
2021-07-15 16:58:51 +05:00
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
2021-07-15 12:21:22 +05:00
public int Id { get; set; }
public string Name { get; set; }
2021-07-16 16:43:55 +05:00
public string Adress { get; set; }
2021-07-15 12:21:22 +05:00
public string Phone { get; set; }
2021-07-16 16:43:55 +05:00
public string Email { get; set; }
2021-07-15 12:21:22 +05:00
}
2021-07-15 16:58:51 +05:00
public class Izdelie
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string DecNum { get; set; }
public string Shifr { get; set; }
public string Litera { get; set; }
public double Cena { get; set; }
public int OtdelRazrab { get; set; }
public string Ved { get; set; }
public string GlavKonstr { get; set; }
}
2021-07-16 16:43:55 +05:00
public class Izveschenie
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string IzvNum { get; set; }
public int InvNum { get; set; }
public int IzmNum { get; set; }
public string UkazZad { get; set; }
public string UkazVnedr { get; set; }
public string FileName { get; set; }
public byte[] FileStruct { get; set; }
}
2021-07-15 12:21:22 +05:00
}