Пока не особо работает

This commit is contained in:
Yunusov_Niyaz 2024-05-07 16:18:10 +04:00
parent 85e325491e
commit d3fe1a06c8
10 changed files with 112 additions and 18 deletions

View File

@ -6,6 +6,6 @@
<add key="PopHost" value="pop.gmail.com" />
<add key="PopPort" value="995" />
<add key="MailLogin" value="labwork73@gmail.com" />
<add key="MailPassword" value="laba73000" />
<add key="MailPassword" value="laba73" />
</appSettings>
</configuration>

View File

@ -44,8 +44,7 @@ namespace CarRepairShopBusinessLogic.MailWorker
{
try
{
client.Connect(_popHost, _popPort,
SecureSocketOptions.SslOnConnect);
client.Connect(_popHost, _popPort, SecureSocketOptions.SslOnConnect);
client.Authenticate(_mailLogin, _mailPassword);
for (int i = 0; i < client.Count; i++)
{
@ -63,7 +62,7 @@ namespace CarRepairShopBusinessLogic.MailWorker
}
}
}
catch (MailKit.Security.AuthenticationException)
catch (AuthenticationException)
{ }
finally
{

View File

@ -7,7 +7,6 @@ namespace CarRepairShopContracts.BusinessLogicsContracts
public interface IMessageInfoLogic
{
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
bool Create(MessageInfoBindingModel model);
}
}

View File

@ -3,7 +3,6 @@
public class MessageInfoSearchModel
{
public int? ClientId { get; set; }
public string? MessageId { get; set; }
}
}

View File

@ -7,11 +7,8 @@ namespace CarRepairShopContracts.StoragesContracts
public interface IMessageInfoStorage
{
List<MessageInfoViewModel> GetFullList();
List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model);
MessageInfoViewModel? GetElement(MessageInfoSearchModel model);
MessageInfoViewModel? Insert(MessageInfoBindingModel model);
}
}

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace CarRepairShopDatabaseImplement.Migrations
{
[DbContext(typeof(RepairsShopDatabase))]
[Migration("20240422174051_InitialCreate")]
[Migration("20240506164851_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -97,6 +97,36 @@ namespace CarRepairShopDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
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("CarRepairShopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -186,6 +216,15 @@ namespace CarRepairShopDatabaseImplement.Migrations
b.ToTable("RepairComponents");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("CarRepairShopDatabaseImplement.Models.Client", "Client")
.WithMany()
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("CarRepairShopDatabaseImplement.Models.Client", "Client")

View File

@ -70,6 +70,27 @@ namespace CarRepairShopDatabaseImplement.Migrations
table.PrimaryKey("PK_Repairs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.MessageId);
table.ForeignKey(
name: "FK_Messages_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
@ -134,6 +155,11 @@ namespace CarRepairShopDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
@ -163,6 +189,9 @@ namespace CarRepairShopDatabaseImplement.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Orders");

View File

@ -94,6 +94,36 @@ namespace CarRepairShopDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
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("CarRepairShopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -183,6 +213,15 @@ namespace CarRepairShopDatabaseImplement.Migrations
b.ToTable("RepairComponents");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("CarRepairShopDatabaseImplement.Models.Client", "Client")
.WithMany()
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("CarRepairShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("CarRepairShopDatabaseImplement.Models.Client", "Client")

View File

@ -9,19 +9,12 @@ namespace CarRepairShopDatabaseImplement.Models
{
[Key]
public string MessageId { get; private set; } = string.Empty;
public int? ClientId { get; private set; }
public string SenderName { get; private set; } = string.Empty;
public DateTime DateDelivery { get; private set; } = DateTime.Now;
public string Subject { get; private set; } = string.Empty;
public string Body { get; private set; } = string.Empty;
public Client? Client { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model)
{
if (model == null)

View File

@ -11,5 +11,5 @@
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "labwork73@gmail.com",
"MailPassword": "laba73000"
"MailPassword": "laba73"
}