ПОЧТИ ГОТОВАЯ 7-Я ХАРД!!!

This commit is contained in:
Programmist73 2023-04-30 19:38:24 +04:00
parent 6ca35bcd5d
commit a4e6186104
13 changed files with 796 additions and 18 deletions

View File

@ -0,0 +1,140 @@
namespace BlacksmithWorkshop
{
partial class FormAnswerMail
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
buttonSave = new Button();
buttonCancel = new Button();
textBoxHead = new TextBox();
textBoxBody = new TextBox();
labelHead = new Label();
labelBody = new Label();
labelAnswer = new Label();
textBoxAnswer = new TextBox();
SuspendLayout();
//
// buttonSave
//
buttonSave.Location = new Point(203, 227);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(125, 29);
buttonSave.TabIndex = 0;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(350, 227);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(123, 29);
buttonCancel.TabIndex = 1;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// textBoxHead
//
textBoxHead.Location = new Point(151, 34);
textBoxHead.Name = "textBoxHead";
textBoxHead.Size = new Size(322, 27);
textBoxHead.TabIndex = 2;
//
// textBoxBody
//
textBoxBody.Location = new Point(151, 98);
textBoxBody.Name = "textBoxBody";
textBoxBody.Size = new Size(322, 27);
textBoxBody.TabIndex = 3;
//
// labelHead
//
labelHead.AutoSize = true;
labelHead.Location = new Point(30, 37);
labelHead.Name = "labelHead";
labelHead.Size = new Size(84, 20);
labelHead.TabIndex = 4;
labelHead.Text = "Заголовок:";
//
// labelBody
//
labelBody.AutoSize = true;
labelBody.Location = new Point(30, 101);
labelBody.Name = "labelBody";
labelBody.Size = new Size(94, 20);
labelBody.TabIndex = 5;
labelBody.Text = "Сообщение:";
//
// labelAnswer
//
labelAnswer.AutoSize = true;
labelAnswer.Location = new Point(30, 163);
labelAnswer.Name = "labelAnswer";
labelAnswer.Size = new Size(51, 20);
labelAnswer.TabIndex = 6;
labelAnswer.Text = "Ответ:";
//
// textBoxAnswer
//
textBoxAnswer.Location = new Point(151, 160);
textBoxAnswer.Name = "textBoxAnswer";
textBoxAnswer.Size = new Size(322, 27);
textBoxAnswer.TabIndex = 7;
//
// FormAnswerMail
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(512, 284);
Controls.Add(textBoxAnswer);
Controls.Add(labelAnswer);
Controls.Add(labelBody);
Controls.Add(labelHead);
Controls.Add(textBoxBody);
Controls.Add(textBoxHead);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormAnswerMail";
Text = "Просмотр письма";
Load += FormAnswerMail_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonCancel;
private TextBox textBoxHead;
private TextBox textBoxBody;
private Label labelHead;
private Label labelBody;
private Label labelAnswer;
private TextBox textBoxAnswer;
}
}

View File

@ -0,0 +1,98 @@
using BlacksmithWorkshopBusinessLogic.MailWorker;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopContracts.SearchModels;
using BlacksmithWorkshopContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BlacksmithWorkshop
{
public partial class FormAnswerMail : Form
{
private readonly ILogger _logger;
private readonly IMessageInfoLogic _logic;
private readonly AbstractMailWorker _mailWorker;
private MessageInfoViewModel _message;
public string MessageId { get; set; } = string.Empty;
public FormAnswerMail(ILogger<FormAnswerMail> logger, AbstractMailWorker mailWorker, IMessageInfoLogic logic)
{
InitializeComponent();
_logger = logger;
_mailWorker = mailWorker;
_logic = logic;
}
private void FormAnswerMail_Load(object sender, EventArgs e)
{
try
{
_logger.LogInformation("Получение письма");
_message = _logic.ReadElement(new MessageInfoSearchModel { MessageId = MessageId });
if (_message != null)
{
Text += $"для {_message.SenderName}";
textBoxHead.Text = _message.Subject;
textBoxBody.Text = _message.Body;
}
if (_message.IsRead is false)
{
_logic.Update(new() { MessageId = MessageId, IsRead = true, Answer = _message.Answer });
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения письма");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
//отправка письма с ответом
_mailWorker.MailSendAsync(new()
{
MailAddress = _message.SenderName,
Subject = _message.Subject,
Text = textBoxAnswer.Text,
});
_logic.Update(new()
{
MessageId = MessageId,
Answer = textBoxAnswer.Text,
IsRead = true,
});
MessageBox.Show("Успешная отправка письма", "Отправка письма", MessageBoxButtons.OK);
DialogResult = DialogResult.OK;
Close();
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -31,23 +31,23 @@
dataGridView = new DataGridView();
buttonForward = new Button();
buttonBack = new Button();
buttonAnswer = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Top;
dataGridView.Location = new Point(0, 0);
dataGridView.Location = new Point(12, 12);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(800, 393);
dataGridView.Size = new Size(781, 393);
dataGridView.TabIndex = 0;
//
// buttonForward
//
buttonForward.Location = new Point(156, 409);
buttonForward.Location = new Point(155, 416);
buttonForward.Name = "buttonForward";
buttonForward.Size = new Size(175, 29);
buttonForward.TabIndex = 1;
@ -57,7 +57,7 @@
//
// buttonBack
//
buttonBack.Location = new Point(466, 409);
buttonBack.Location = new Point(468, 416);
buttonBack.Name = "buttonBack";
buttonBack.Size = new Size(173, 29);
buttonBack.TabIndex = 2;
@ -65,11 +65,22 @@
buttonBack.UseVisualStyleBackColor = true;
buttonBack.Click += ButtonBack_Click;
//
// buttonAnswer
//
buttonAnswer.Location = new Point(806, 34);
buttonAnswer.Name = "buttonAnswer";
buttonAnswer.Size = new Size(136, 29);
buttonAnswer.TabIndex = 3;
buttonAnswer.Text = "Ответить";
buttonAnswer.UseVisualStyleBackColor = true;
buttonAnswer.Click += ButtonAnswer_Click;
//
// FormMails
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
ClientSize = new Size(963, 457);
Controls.Add(buttonAnswer);
Controls.Add(buttonBack);
Controls.Add(buttonForward);
Controls.Add(dataGridView);
@ -85,5 +96,6 @@
private DataGridView dataGridView;
private Button buttonForward;
private Button buttonBack;
private Button buttonAnswer;
}
}

View File

@ -78,19 +78,40 @@ namespace BlacksmithWorkshop
private void ButtonForward_Click(object sender, EventArgs e)
{
numberPaginationPage += 1;
if (dataGridView.Rows.Count == paginationSize)
{
numberPaginationPage += 1;
}
LoadData();
}
private void ButtonBack_Click(object sender, EventArgs e)
{
if(numberPaginationPage > 1)
if (numberPaginationPage > 1)
{
numberPaginationPage -= 1;
}
LoadData();
}
private void ButtonAnswer_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormAnswerMail));
if (service is FormAnswerMail form)
{
form.MessageId = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString();
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
}
}

View File

@ -109,6 +109,7 @@ namespace BlacksmithWorkshop
services.AddTransient<FormImplementers>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormMails>();
services.AddTransient<FormAnswerMail>();
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();

View File

@ -42,7 +42,30 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
return list.OrderByDescending(x => x.DateDelivery).ToList();
}
public bool Create(MessageInfoBindingModel model)
MessageInfoViewModel? IMessageInfoLogic.ReadElement(MessageInfoSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadList. ClientId:{ClientId}. MessageId:{MessageId}", model.ClientId, model?.MessageId);
var element = _messageInfoStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.MessageId);
return element;
}
public bool Create(MessageInfoBindingModel model)
{
if (_messageInfoStorage.Insert(model) == null)
{

View File

@ -13,7 +13,9 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
{
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
bool Create(MessageInfoBindingModel model);
MessageInfoViewModel? ReadElement(MessageInfoSearchModel model);
bool Create(MessageInfoBindingModel model);
bool Update(MessageInfoBindingModel model);
}

View File

@ -14,8 +14,6 @@ namespace BlacksmithWorkshopContracts.ViewModels
public int? ClientId { get; set; }
public bool IsRead { get; set; } = false;
[DisplayName("Отправитель")]
public string SenderName { get; set; } = string.Empty;
@ -29,7 +27,7 @@ namespace BlacksmithWorkshopContracts.ViewModels
public string Body { get; set; } = string.Empty;
[DisplayName("Прочитано")]
public string statusChecking { get; set; } = string.Empty;
public bool IsRead { get; set; } = false;
[DisplayName("Ответ")]
public string? Answer { get; set; } = string.Empty;

View File

@ -0,0 +1,383 @@
// <auto-generated />
using System;
using BlacksmithWorkshopDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
[DbContext(typeof(BlacksmithWorkshopDatabase))]
[Migration("20230430151520_LabWork07Hard")]
partial class LabWork07Hard
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ManufactureName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Manufactures");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureWorkPiece", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.Property<int>("WorkPieceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ManufactureId");
b.HasIndex("WorkPieceId");
b.ToTable("ManufactureWorkPieces");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Answer")
.HasColumnType("nvarchar(max)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("IsRead")
.HasColumnType("bit");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("ManufactureId");
b.ToTable("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpen")
.HasColumnType("datetime2");
b.Property<int>("MaxCountManufactures")
.HasColumnType("int");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ShopManufacture", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.Property<int>("ShopId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ManufactureId");
b.HasIndex("ShopId");
b.ToTable("ShopManufactures");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.WorkPiece", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("Cost")
.HasColumnType("float");
b.Property<string>("WorkPieceName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WorkPieces");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureWorkPiece", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("WorkPieces")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.WorkPiece", "WorkPiece")
.WithMany("ManufactureWorkPieces")
.HasForeignKey("WorkPieceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacture");
b.Navigation("WorkPiece");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
.WithMany("MessageInfos")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Orders")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Manufacture");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ShopManufacture", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Shops")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
.WithMany("Manufactures")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacture");
b.Navigation("Shop");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
{
b.Navigation("MessageInfos");
b.Navigation("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
{
b.Navigation("Orders");
b.Navigation("Shops");
b.Navigation("WorkPieces");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Manufactures");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.WorkPiece", b =>
{
b.Navigation("ManufactureWorkPieces");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class LabWork07Hard : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Answer",
table: "Messages",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsRead",
table: "Messages",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Answer",
table: "Messages");
migrationBuilder.DropColumn(
name: "IsRead",
table: "Messages");
}
}
}

View File

@ -125,6 +125,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Answer")
.HasColumnType("nvarchar(max)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
@ -135,6 +138,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("IsRead")
.HasColumnType("bit");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");

View File

@ -63,11 +63,6 @@ namespace BlacksmithWorkshopDatabaseImplement.Models
}
MessageId = model.MessageId;
ClientId = model.ClientId;
SenderName = model.SenderName;
Body = model.Body;
DateDelivery = model.DateDelivery;
Subject = model.Subject;
IsRead = model.IsRead;
Answer = model.Answer;
}