Наконец-то
This commit is contained in:
parent
d3fe1a06c8
commit
37f88a13f0
@ -5,7 +5,7 @@
|
||||
<add key="SmtpClientPort" value="587" />
|
||||
<add key="PopHost" value="pop.gmail.com" />
|
||||
<add key="PopPort" value="995" />
|
||||
<add key="MailLogin" value="labwork73@gmail.com" />
|
||||
<add key="MailPassword" value="laba73" />
|
||||
<add key="MailLogin" value="niiiyaziiik@gmail.com" />
|
||||
<add key="MailPassword" value="fbuz lxpx sirr rzbp" />
|
||||
</appSettings>
|
||||
</configuration>
|
@ -48,8 +48,8 @@
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "Почта";
|
||||
Text = "FormMails";
|
||||
Name = "FormMails";
|
||||
Text = "Почты";
|
||||
Load += ViewMailForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -42,8 +42,7 @@ namespace CarRepairShop
|
||||
string.Empty,
|
||||
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
||||
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
||||
});
|
||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])});
|
||||
// ñîçäàåì òàéìåð
|
||||
var timer = new System.Threading.Timer(new
|
||||
TimerCallback(MailCheck!), null, 0, 100000);
|
||||
|
@ -108,7 +108,7 @@ namespace CarRepairShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentException("Некорретно введен email клиента", nameof(model.Email));
|
||||
}
|
||||
if (!Regex.IsMatch(model.Password, @"^(?=.*\d)(?=.*\W)(?=.*[^\d\s]).+$"))
|
||||
if (!Regex.IsMatch(model.Password, @"^(?=.*\d)(?=.*\w)(?=.*[^\d\s]).+$"))
|
||||
{
|
||||
throw new ArgumentException("Некорректно введен пароль клиента", nameof(model.Password));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace CarRepairShopDatabaseImplement.Implements
|
||||
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||
{
|
||||
using var context = new RepairsShopDatabase();
|
||||
var newMessage = MessageInfo.Create(model);
|
||||
var newMessage = MessageInfo.Create(context, model);
|
||||
if (newMessage == null || context.Messages.Any(x => x.MessageId.Equals(model.MessageId)))
|
||||
{
|
||||
return null;
|
||||
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace CarRepairShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(RepairsShopDatabase))]
|
||||
[Migration("20240506164851_InitialCreate")]
|
||||
[Migration("20240507162722_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
@ -15,7 +15,7 @@ namespace CarRepairShopDatabaseImplement.Models
|
||||
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)
|
||||
public static MessageInfo? Create(RepairsShopDatabase context, MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -25,7 +25,8 @@ namespace CarRepairShopDatabaseImplement.Models
|
||||
{
|
||||
Body = model.Body,
|
||||
Subject = model.Subject,
|
||||
ClientId = model.ClientId,
|
||||
ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName).Id,
|
||||
Client = context.Clients.FirstOrDefault(x => x.Email == model.SenderName),
|
||||
MessageId = model.MessageId,
|
||||
SenderName = model.SenderName,
|
||||
DateDelivery = model.DateDelivery,
|
||||
|
@ -9,7 +9,7 @@ namespace CarRepairShopDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=RepairsShopDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=CarRepairsShopDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"
|
||||
);
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
|
@ -20,7 +20,7 @@ builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IRepairLogic, RepairLogic>();
|
||||
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at
|
||||
https://aka.ms/aspnetcore/swashbuckle
|
||||
|
@ -10,6 +10,6 @@
|
||||
"SmtpClientPort": "587",
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "labwork73@gmail.com",
|
||||
"MailPassword": "laba73"
|
||||
"MailLogin": "niiiyaziiik@gmail.com",
|
||||
"MailPassword": "fbuz lxpx sirr rzbp"
|
||||
}
|
||||
|
@ -6,10 +6,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="Views\Home\Mails.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
@ -19,16 +15,4 @@
|
||||
<ProjectReference Include="..\CarRepairShopRestApi\CarRepairShopRestApi.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\Home\Mails.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Views\Home\Mails.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Views\Home\Mails.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user