104 lines
5.9 KiB
C#
104 lines
5.9 KiB
C#
using Microsoft.EntityFrameworkCore;
|
||
using PARR.DAL.Contracts;
|
||
using PARR.DAL.Models;
|
||
using PARR.DAL.Models.AIHIT;
|
||
using PARR.DAL.Models.V1;
|
||
using System.ComponentModel;
|
||
|
||
namespace PARR.DAL.Context
|
||
{
|
||
internal class DataContext : DbContext
|
||
{
|
||
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
|
||
|
||
#region v1
|
||
public DbSet<V1_JobType> JobTypes { get; set; }
|
||
public DbSet<V1_JobCategory> JobCategories { get; set; }
|
||
public DbSet<V1_JobMode> JobModes { get; set; }
|
||
public DbSet<V1_JobStatus> JobStatuses { get; set; }
|
||
public DbSet<V1_Host> V1_Hosts { get; set; }
|
||
public DbSet<V1_Job> Jobs { get; set; }
|
||
public DbSet<V1_JobJournal> JobJournals { get; set; }
|
||
public DbSet<V1_Application> V1_Applications { get; set; }
|
||
public DbSet<V1_ApplicationType> V1_ApplicationTypes { get; set; }
|
||
public DbSet<V1_ApplicationInHost> V1_ApplicationsInHosts { get; set; }
|
||
#endregion
|
||
|
||
public DbSet<Host> Hosts { get; set; }
|
||
public DbSet<Application> Applications { get; set; }
|
||
public DbSet<ApplicationType> ApplicationTypes { get; set; }
|
||
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
|
||
|
||
public DbSet<Setting> Settings { get; set; }
|
||
public DbSet<RawDataEK> RawDataEKs { get; set; }
|
||
public DbSet<Template> Templates { get; set; }
|
||
public DbSet<StatusTemplate> StatusTemplates { get; set; }
|
||
|
||
public DbSet<Process> Processes { get; set; }
|
||
public DbSet<Subprocess> Subprocesses { get; set; }
|
||
public DbSet<Tnk> Tnks { get; set; }
|
||
public DbSet<Work> Works { get; set; }
|
||
|
||
public DbSet<ApplicationsInWork> ApplicationsInWorks { get; set; }
|
||
|
||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||
{
|
||
base.OnModelCreating(modelBuilder);
|
||
|
||
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
|
||
|
||
modelBuilder.Entity<V1_JobMode>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() },
|
||
new() { Id = new Guid("7516B952-510D-4AAA-971C-A14B184FC1D5"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.manual.ToString() }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<V1_JobStatus>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" },
|
||
new() { Id = new Guid("7B945EB6-D885-4570-AFF5-8866F1F75FF2"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.finished.ToString(), Description = "Задание выполнено" }
|
||
);
|
||
});
|
||
|
||
|
||
modelBuilder.Entity<ApplicationType>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Поле СП xml АИХ ИТ" },
|
||
new() { Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.OS.ToString(), Description = "Поле ОС xml АИХ ИТ" },
|
||
new() { Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.DB.ToString(), Description = "Поле СУБД xml АИХ ИТ" }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<Models.AIHIT.Setting>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("1AD12210-BE62-459A-AA6C-FDA7648503F7"), DateCreated = dateCreated, DateModified = null, Group = null, Name = "ConnectionString", Value = @"Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;", Description = "Строка подключения к базе данных АИХ ИТ" },
|
||
new() { Id = new Guid("50F66704-4D26-4587-BB1E-DCA70C8F4B89"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ZAB", Value = "94-ЗАБ", Description = "Зона ответственности" },
|
||
new() { Id = new Guid("1FD43634-4A06-4237-9727-EDFA6F3EEBE8"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "DVS", Value = "96-ДВС", Description = "Зона ответственности" },
|
||
new() { Id = new Guid("77C73C0A-8E4D-4676-B6E2-6A112F20E346"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.StatusGroupName, Name = "Exploitation", Value = "3-В эксплуатации", Description = "Статус актуальных ЭК" }
|
||
);
|
||
});
|
||
|
||
|
||
modelBuilder.Entity<StatusTemplate>(f =>
|
||
{
|
||
f.HasData(
|
||
|
||
new() { Code = (int)StatusTemplateEnum.Creating, Name = StatusTemplateEnum.Creating.ToString(), Description = "Создали шаблон в ПАРР" },
|
||
new() { Code = (int)StatusTemplateEnum.Updating, Name = StatusTemplateEnum.Updating.ToString(), Description = "Выявлено несоответствие. Требуется привлечение робота" },
|
||
new() { Code = (int)StatusTemplateEnum.Ok, Name = StatusTemplateEnum.Ok.ToString(), Description = "Нормальное состояние шаблона в ЕСПП и ПАРР. Шаблон в ПАРР соответствует шаблону в ЕСПП" }
|
||
);
|
||
});
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|